Raspberry Pi won't bring up wlanX interface - multiple wireless interfaces

Let me jump straight in.

I am using a raspberry pi 3 running latest version of raspbian (pixel) as a router/wifi hotspot


I have 3 wireless interfaces:

  1. built in wifi interface (brcmfmac)
  2. TP-Link WN722 for 2.4Ghz Wifi-AP (not working yet) (ath9k_htc)
  3. Comfast CF-912AC (rtl88112au)

purpose of each interface:

  • wlan0 => 5Ghz hostapd daemon
  • wlan1 => link to router (refer to wpa_supplicant in interfaces file)
  • wlan2 => 2.4Ghz hostapd daemon (not operational)

see bottom for more info


Problem:

This has been a frequent problem, I have had, with Raspberry Pi's

I simply cannot bring up an interface wlan0 and wlan2, and wlan2 won't budge to configuration set in /etc/network/interfaces.

I have tried various commands to bring up these interfaces, of which none work:

$ sudo ifdown wlan0
ifdown: interface wlan0 not configured
$ sudo ifup wlan0
RTNETLINK answers: File exists
Failed to bring up wlan0.
$ sudo ifdown wlan2
ifdown: interface wlan2 not configured
$ sudo ifup wlan2
Ignoring unknown interface wlan2=wlan2.

and with wlan0 and wlan2 being down seen from ip addr

`sudo ip link set wlan0 up`
`sudo ip link set wlan2 up`

which has no success in bringing up these interfaces (confirmed down state with ip tool).


How did this happen:

Note: all was working previously, although I could never bring up my tp-link wifi adapter, the ath9k_htc, so I left it down

  1. I was busy configuring my raspberry pi to run a second hostapd daemon on wlan2 (which I would have sorted out after - driver issue):

    • copied my working hostapd config and modified it for 2.4Ghz, saved into /etc/hostapd directory with a unique name.
  2. I used dnsmasq as the dhcp server, where dhcpcd was disabled and stopped:

    • I configured /etc/dnsmasq.conf to also listen on interface wlan2, adding ip to listen on 192.168.4.254 (not sure if needed)
  3. Lastly edited /etc/default/hostapd.conf and added the second hostapd config with a space separation mentioned here

  4. Finally, called a restart on these 2 services

    sudo service dnsmasq restart

    sudo service hostapd restart

This is where everything went to hell.

calling sudo service networking restart brought down wlan0 (existing 5ghz hostapd daemon) and I couldn't bring it up since, nor wlan0. However eth0 and wlan1 stayed up, i.e.

In conlusion:

I had a 5Ghz wifi hotspot, and attempted to create a 2.4Ghz hotspot, now I am in the hotseat with no hotspot

I removed all the settings (i.e. revert back to previous working state) but was unsuccessful.

Note aswel: several reboot did not solve anything


The question:

1. How do I bring up these interfaces

2. Why does this issue of not being able to bring up an interface occur when everything seems right

p.s. let me know if I missed anything


More info:

my interfaces file:

$ sudo cat /etc/network/interfaces
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
allow-hotplug wlan0
iface wlan0 inet static address 192.168.0.254 subnet 255.255.255.0 gateway 192.168.8.254 network 192.168.0.0 broadcast 192.168.0.255
allow-hotplug wlan2
iface wlan0 inet static address 192.168.4.254 subnet 255.255.255.0 gateway 192.168.8.254 network 192.168.4.0 broadcast 192.168.4.255
allow-hotplug eth0
iface eth0 inet static address 192.168.1.254 subnet 255.255.255.0 gateway 192.168.8.254 network 192.168.1.0 broadcast 192.168.1.255
allow-hotplug wlan1
iface wlan1 inet static address 192.168.8.254 subnet 255.255.255.0 gateway 192.168.8.1 wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

The logs:

running sudo ip link set wlan0 down

  • dmesg reports:

    n/a

  • but /var/log/syslog reports:

    Apr 24 20:47:09 gateway avahi-daemon[480]: Interface wlan0.IPv4 no longer relevant for mDNS.

    Apr 24 20:47:09 gateway avahi-daemon[480]: Leaving mDNS multicast group on interface wlan0.IPv4 with address 192.168.0.254.

    Apr 24 20:47:09 gateway avahi-daemon[480]: Withdrawing address record for 192.168.0.254 on wlan0.

followed by running sudo ip link set wlan0 up

  • dmesg reports:

    IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready

  • but /var/log/syslog reports:

    Apr 24 20:50:06 gateway avahi-daemon[480]: Joining mDNS multicast group on interface wlan0.IPv4 with address 192.168.0.254.

    Apr 24 20:50:06 gateway avahi-daemon[480]: New relevant interface wlan0.IPv4 for mDNS.

    Apr 24 20:50:06 gateway avahi-daemon[480]: Registering new address record for 192.168.0.254 on wlan0.IPv4.

    Apr 24 20:50:06 gateway kernel: [ 2964.213013] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready

NIC status

 $ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether b8:27:eb:e5:67:fb brd ff:ff:ff:ff:ff:ff inet 192.168.1.254/24 brd 192.168.1.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::ba27:ebff:fee5:67fb/64 scope link valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000 link/ether 40:a5:ef:d9:9c:4f brd ff:ff:ff:ff:ff:ff inet 192.168.0.254/24 brd 192.168.0.255 scope global wlan0 valid_lft forever preferred_lft forever
4: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether b8:27:eb:b0:32:ae brd ff:ff:ff:ff:ff:ff inet 192.168.8.254/24 brd 192.168.8.255 scope global wlan1 valid_lft forever preferred_lft forever inet6 fe80::ba27:ebff:feb0:32ae/64 scope link valid_lft forever preferred_lft forever
5: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 100 link/none inet 192.168.10.1 peer 192.168.10.2/32 scope global tun0 valid_lft forever preferred_lft forever
6: tun1: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 100 link/none inet 192.168.11.1 peer 192.168.11.2/32 scope global tun1 valid_lft forever preferred_lft forever
7: wlan2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000 link/ether 90:f6:52:13:aa:82 brd ff:ff:ff:ff:ff:ff

NIC Info

$ sudo lshw -C net *-usb:1 description: Wireless interface product: USB2.0 WLAN vendor: ATHEROS physical id: 2 bus info: usb@1:1.2 logical name: wlan2 version: 1.08 serial: 12345 capabilities: usb-2.00 ethernet physical wireless configuration: broadcast=yes driver=ath9k_htc driverversion=4.4.50-v7+ firmware=1.3 link=no maxpower=500mA multicast=yes speed=480Mbit/s wireless=IEEE 802.11bgn *-usb:2 description: Wireless interface product: 802.11n NIC vendor: Realtek physical id: 5 bus info: usb@1:1.5 logical name: wlan0 version: 0.00 serial: 123456 capabilities: usb-2.00 ethernet physical wireless configuration: broadcast=yes driver=rtl8812au ip=192.168.0.254 maxpower=500mA multicast=yes speed=480Mbit/s wireless=unassociated *-network:0 description: Ethernet interface physical id: 2 logical name: eth0 serial: b8:27:eb:e5:67:fb size: 100Mbit/s capacity: 100Mbit/s capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=smsc95xx driverversion=22-Aug-2005 duplex=full firmware=smsc95xx USB 2.0 Ethernet ip=192.168.1.254 link=yes multicast=yes port=MII speed=100Mbit/s *-network:1 description: Wireless interface physical id: 3 logical name: wlan1 serial: b8:27:eb:b0:32:ae capabilities: ethernet physical wireless configuration: broadcast=yes driver=brcmfmac driverversion=7.45.41.26 firmware=01-df77e4a7 ip=192.168.8.254 multicast=yes wireless=IEEE 802.11bgn
4

1 Answer

So I after some time, I found out that Raspbian uses the ifupdown package which you can manually download from here.

So the reason for your interface not coming up can vary, thus I cannot tell you what is the cause, but the logs CAN definitely help you if Googled.

Get the Logs

TO find these logs, use either this for a quick status update:

systemctl status networking.service

or this for detailed logs:

journalctl -u networking.service

About networking.service

You can find the service file here /lib/systemd/system/networking.service

Open it using nano/vim (I prefer nano) to view

The service runs /sbin/ifup -a --read-environment, but you can add additional verbosity -v to get more information about your network interfaces

Thus, running /sbin/ifup -a --read-environment -v will give you insight into why the interfaces cannot be brought up.

You can find an example output of the above command here, from this AskUbuntu post

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like