2

I am trying the command:

ip link set dev wlp3s0 down

to bring down the interface 'wlp3s0' (which is Wi-Fi in my case) down which works. But when I try to bring the interface back up with the command:

ip link set dev wlp3s0 up

The interface 'wlp3s0' does not come back up.

In fact, I have to use the GUI button for 'GNOME Network Manager' (which is located below when I click the volume control icon) for turning off the Wi-Fi and then connecting to it again manually, which automatically does the job.

Why is the command to bring the network interface back up not working (which in my case happens to be 'wlp3s0')?

I am using: 4.7.1-1-ARCH #1 SMP PREEMPT x86_64 system. Arch Linux.

Note:

I have been searching the Internet for this problem and some posts have suggested that this might be a hardware problem. My Wireless driver chipset information is as follows:

$ lspci | grep -i wireless
03:00.0 Network controller: Qualcomm Atheros QCA9565 / AR9565 Wireless Network Adapter (rev 01)
5

You question is why it is not working. Remember that the OSI network system is composed of several layers: physical (cable/radio), link (ethernet/802.11), network (IP), transport (TCP), and some higher ones that are often mangled together. When you do.

ip link set dev wlp3s0 down

It does bring the link layer (OSI link layer) down. This means that all higher layers will be brought down as well: the IP is forgotten, any TCP connections are broken.

ip link set dev wlp3s0 up

Does bring the link layer up (given that there is no encryption involved, see extra encryption note below). After running it you should see:

$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether 00:22:43:1b:ae:46 brd ff:ff:ff:ff:ff:ff

wlp3s0 should be either in the state DORMANT or UP (depending if there is traffic coming through at the moment you run the command). For all link layer purposes it is up, ip did what you asked it.

Now that you have a link layer connection you need to use a DHCP client to acquire an IP from a nearby DHCP server (normally a home router). Arch uses dhcpcd as the DCHP client.

dhcpcd wlp3s0

Will give you an IP (and occupy your current terminal since it is not running in daemon mode without the -b flag).


Encryption note

Most wireless connections are not plain, they use either WEP or WPA/WPA2. In such case, to establish a link layer, there is more work than plain:

ip link set dev wlp3s0 up

iw can deal with WEP encryption by specifying a key to be used by a certain interface. After which ip link set will be able to establish a link layer connection.

WPA (and WPA2) requires a much more involved process with key negotiation. For WPA wpa_supplicant is used, it wraps around ip to build all necessary messages with the router and then sets the link layer up.

Note that neither iw or wpa_suppicant will not provide you with an IP.

Also,

ip link set dev wlp3s0 down

Will happily drop a link layer connection configured with iw or made with wpa_supplicant, this is because dropping a link layer does not involve any encryption function. It just tells the router: I'm not talking to you anymore, forget about me.


NetworkManager

Now, networkmanager is an even higher wrapper. It uses ip for plain connections, wpa_supplicant for encrypted connections, and runs dhcpcd (or its own in-built DHCP client if it cannot find dhcpcd) automatically when a link layer is established.

In other words networkmanager does a lot behind the scenes.

  • dhcpcd wlp3s0 appended after ip link set dev wlp3s0 up connects to the network and I don't have to deal with the encryption probably because the network is remembered/saved. Can you please suggest some resources where I can learn about Linux Networking apart from wiki.archlinux.org/index.php/Network_configuration. Excellent answer! – Arun Aug 22 '16 at 4:12
  • @Arun - Yup, iw configuration is semi-permanent (with some dependence on hardware). As of how to get practice: to be fair with you, I simply used my Arch laptop without using NetworkManager for a year (as an experiment in learning). Yet, I had a decent knowledge of the OSI model first and a lot of debugging practice, for that I strongly recommend practical packet analysis. Without that I'd probably give up on my experiments with arch. – grochmal Aug 22 '16 at 17:26

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.