4

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.

4

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
  • 4
    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. – MariusMatutiae Feb 15 '16 at 11:50
  • @MariusMatutiae Appreciate that I will Add this in and give you Props. – NetworkKingPin Feb 16 '16 at 5:23
  • I tried the ip utility method, but got this when I tried to restart it: 'RTNETLINK answers: Input/output error' – Jefferson Feb 16 '16 at 6:32
  • Just to be clear, how can I make sure I'm disabling and restarting the right interface, because mine is not wlan0? – Jefferson Feb 16 '16 at 6:57
  • @Jefferson Check here fedoraproject.org/wiki/Features/… – NetworkKingPin Feb 16 '16 at 6:59
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.