Заметки сисадмина » Putting a network interface up/down from command line

Заметки сисадмина о интересных вещах из мира IT, инструкции и рецензии. Настраиваем Компьютеры/Сервера/1С/SIP-телефонию в Москве

Putting a network interface up/down from command line

2024-03-01 · Posted in Debian

In Xubuntu 14.04, I tried to use both ip and ifconfig to handle a network interface, but they gave the same result.

both correcly put down the interface and the connectivity does not work; but then

did not restore the connectivity!

This is the output of ip link show after putting the interface down:

and this is the output after putting the interface up:

So it has no carrier and I can’t access the web, but it has an IP!

1) Why? Shouldn’t the up command restore the previous situation? I had to turn off and on the physical switch of the wireless board to browse again the web. I also tried with dhclient -r wlan0 and dhclient wlan0, but the result was that neither the physical switch was useful and I had to restart the whole system.

2) Even after putting the interface down, the GUI connectivity icon was active and a connection to the wireless Access-Point was normally shown (even if no webpages were actually available). Why?

1)This answer is only for a wired connection. Use ifup and ifdown, not ifconfig, unless you want to manually specify the parameters. ifup will look at your network configuration in /etc/network/interfaces (or wherever your distro puts it).

2)If you’re using wpa for your wifi, you cannot connect to it with just ifup; a helper application must be configured and running (usually wpa_supplicant). Usually your distro will provide you with network scripts to perform these tasks automatically.

Leave a Reply