7

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

$ sudo ifconfig wlan0 down
$ sudo ip link set wlan0 down

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

$ sudo ifconfig wlan0 up
$ sudo ip link set wlan up

did not restore the connectivity!

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

wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether <my_MAC_address> brd ff:ff:ff:ff:ff:ff
inet 192.168.1.29/24 brd 192.168.1.255 scope global wlan0
   valid_lft forever preferred_lft forever

and this is the output after putting the interface up:

wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether <my_MAC_address> brd ff:ff:ff:ff:ff:ff
inet 192.168.1.29/24 brd 192.168.1.255 scope global wlan0
   valid_lft forever preferred_lft forever

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?

8

I think that ifconfig is not handling wireless stuff like ESSID, channel and key. Take a look to iwconfig instead.

http://manpages.ubuntu.com/manpages/vivid/en/man8/iwconfig.8.html

-EDIT-

You can also use "NetworkManager command line" nmcli: https://askubuntu.com/questions/461825/connect-to-wifi-from-command-line

  • thanks, but can you provide some example about deactivating and reactivating the wireless card? After reading the original manual (the one you provided is in Italian!) I did not find such an example. – BowPark Feb 17 '16 at 15:42
  • 1
    If using WPA take also a look to wpasupplicant. A search to "ubuntu WPA wifi command line" will give you many links like: ubuntuforums.org/showthread.php?t=1798927 askubuntu.com/questions/461825/… – sgargel Feb 18 '16 at 9:50
  • with the second link I succeded to correctly shut down and then put up the interface. Maybe you can include it in your answer, and I will choose it. – BowPark Feb 18 '16 at 22:56
1

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.

  • Ok, yes I use WPA very often. So a configuration is needed to be set up when the interface turns up again, which makes the re-connection a non-trivial task? – BowPark Feb 17 '16 at 18:46
-1

this info comes on my friends machine

eth1 IEEE 802.11g ESSID:"DLINK_WIRELESS" 

Nickname:"localhost.localdomain"
Mode:Managed Frequency:2.437 GHz Access Point: 00:19:5B:21:01:32 
Bit Rate:48 Mb/s Tx-Power=20 dBm Sensitivity=8/0 
Retry limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=95/100 Signal level=-24 dBm Noise level=-90 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

using iwconfig...if that helps

  • thank you, my one is similar. But (as in the comment to the other question) how to use this command to put down (deactivate) and then up (reactivate) the network interface? – BowPark Feb 17 '16 at 15:43

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.