How to disable and re-enable wireless network card in Fedora?

31,564

Solution 1

Us these to turn Eth0 or Wlan0 off if these are the network interfaces you want to toggle on and off.

To turn off use:

ifconfig wlan0 down

Or

ifdown wlan0

To turn back on use:

Ipconfig wlan0 up

Or

Ifup wlan0

If you install a more updated package ---> iproute2 Suggested by @MariusMatutiae

Turn Off wlan0.

ip link set dev wlan0 down

Flush wlan0

ip addr flush dev wlan0

Restart Wlan0

ip link set dev wlan0 up

Solution 2

Just to be clear, how can I make sure I'm disabling and restarting the right interface, because mine is not wlan0?

The command

ip link show 

displays all your interfaces. You will have one called lo which is only an internal interface, used for IPC (=Inter Process Commnication). Among the remaining ones you can identify the wifi interface by means of

$ iwconfig
  eth0      no wireless extensions.

  wlan0     IEEE 802.11abgn  ESSID:off/any  
      Mode:Managed  Access Point: Not-Associated   Tx-Power=15 dBm   
      Retry short limit:7   RTS thr:off   Fragment thr:off
      Power Management:off

  wwan0     no wireless extensions.

  lo        no wireless extensions.

which shows clearly that, on my pc, wlan0 is the only wifi interface.

If you have more than one remaining interface, like in my case, you can identify the ethernet NIC by means of

  sudo ethtool eth0
  sudo ethtool wwan0

: the ethernet interface will produce a long output, the other one will be very short. In my case, I have a wwan0 interface which is used to connect to telephone data networks, Edge/3G/4G.

Share:
31,564

Related videos on Youtube

Jefferson
Author by

Jefferson

Updated on September 18, 2022

Comments

  • Jefferson
    Jefferson almost 2 years

    I have a laptop that I use mainly as as a back up, but it has a problem with the network card needing to be disabled and re-enabled from time to time. This is easy enough in Windows, but how would I go about this in Fedora (23) from the command line? I don't mean that I just want to stop the wireless connection, but actually disable the network card and re-enable it.

    Thanks for the help.

  • MariusMatutiae
    MariusMatutiae over 8 years
    It is best to forget obsolete utilities like ifconfig, and to use the current ip utility from the iproute2 package. Then the commands become ip link set dev wlan0 down, ip addr flush dev wlan0, ip link set dev wlan0 up.
  • NetworkKingPin
    NetworkKingPin over 8 years
    @MariusMatutiae Appreciate that I will Add this in and give you Props.
  • Jefferson
    Jefferson over 8 years
    I tried the ip utility method, but got this when I tried to restart it: 'RTNETLINK answers: Input/output error'
  • Jefferson
    Jefferson over 8 years
    Just to be clear, how can I make sure I'm disabling and restarting the right interface, because mine is not wlan0?
  • NetworkKingPin
    NetworkKingPin over 8 years
    @Jefferson Check here fedoraproject.org/wiki/Features/…
  • MariusMatutiae
    MariusMatutiae over 8 years
    @Jefferson Pls see my answer, only to your question °Just to be clear, how can I make sure I'm disabling and restarting the right interface, because mine is not wlan0?*