1

I'm following this guide: Setting up a Raspberry Pi as an access point in a standalone network (NAT) to create an access point. The only difference is that I'm using another wifi connection where the ethernet connection would be, so I just changed eth0 by wlan1 in the entire tutorial, because wlan1 is my USB dongle which is connect to my router.

However, there's nothing being said about the /etc/network/interfaces file. Here's mine:

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

auto wlan1
allow-hotplug wlan1
iface wlan1 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

I can see the SSID and connect to it, but it keeps obtaining IP address forever. I think it has something to do with /etc/network/interfaces. Take a look at my ifconfig:

pi@raspberrypi:~ $ ifconfig 
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 4  bytes 156 (156.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4  bytes 156 (156.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.25.6  netmask 255.255.255.0  broadcast 192.168.25.255
        inet6 fe80::ba27:ebff:feaa:1f8  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:aa:01:f8  txqueuelen 1000  (Ethernet)
        RX packets 42  bytes 5757 (5.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 37  bytes 5838 (5.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.25.6  netmask 255.255.255.0  broadcast 192.168.25.255
        inet6 2804:7f0:e181:b678:2e0:4dff:fe06:4f8  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::2e0:4dff:fe06:4f8  prefixlen 64  scopeid 0x20<link>
        ether 00:e0:4d:06:04:f8  txqueuelen 1000  (Ethernet)
        RX packets 86  bytes 11978 (11.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 86  bytes 15855 (15.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

How can wlan0 have IP 192.168.25.6? This is the IP given by the router in which wlan1 connects.

How should I edit wlan0 configurations? I've been trying lots of static configurations but when I do anything different that what's on screen, the onboard wifi interface vanishes and then the USB dongle takes the place of wlan0.

Also, is there a way to guarantee that the usb dongle will always get wlan1 and the onboard wifi wlan0? It seems arbitrary.

UPDATE

● dhcpcd.service - dhcpcd on all interfaces
   Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/dhcpcd.service.d
           └─wait.conf
   Active: failed (Result: exit-code) since Sun 2018-08-05 04:54:32 UTC; 7s ago
  Process: 853 ExecStart=/usr/lib/dhcpcd5/dhcpcd -q -w (code=exited, status=6)

Aug 05 04:54:32 raspberrypi systemd[1]: Starting dhcpcd on all interfaces...
Aug 05 04:54:32 raspberrypi dhcpcd[853]: Not running dhcpcd because /etc/network/interfaces
Aug 05 04:54:32 raspberrypi dhcpcd[853]: defines some interfaces that will use a
Aug 05 04:54:32 raspberrypi dhcpcd[853]: DHCP client or static address
Aug 05 04:54:32 raspberrypi systemd[1]: dhcpcd.service: Control process exited, code=exited status=6
Aug 05 04:54:32 raspberrypi systemd[1]: Failed to start dhcpcd on all interfaces.
Aug 05 04:54:32 raspberrypi systemd[1]: dhcpcd.service: Unit entered failed state.
Aug 05 04:54:32 raspberrypi systemd[1]: dhcpcd.service: Failed with result 'exit-code'.
1

If wlan0 is going to be the access point (AP), then you shouldn't attempt to use it as a client (station, STA). But this is what

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

says: "Please use wlan0 as in client-mode, and get an IP address for it using DHCP". Instead, you want something like

auto wlan0
iface wlan0 inet static
address 10.0.0.1
netmask 255.255.255.0
broadcast 10.0.0.255

Replace 10.0.0.* and netmask with the IP range you want to have for your AP.

  • but in the tutorial I followed, it uses dhcpcd to configure wlan0. Shouldn't this configurations be overwritten? – Guerlando OCs Aug 5 '18 at 13:19
  • In the tutorial you followed, dhcpcd gave it a static address. It doesn't really matter who gives the interface the static address; if it gets one with dhcpcd, that's also fine. However, you wrote in the question that it gets 192.168.25.6, which suggests the dhcpcd method doesn't work (for whatever reason). Now you can either fix dhcpcd, or just give it the gorram static address in the first place. – dirkt Aug 5 '18 at 13:24
  • I tried your method and it worked, but I can't use internet, maybe a problem with routing. The dhcpd error is in the post. Do you have an idea of why it happens? It says that the error is due to /etc/network/interfaces – Guerlando OCs Aug 5 '18 at 13:26
  • I am not very familiar with dhcpcd (I use dhclient), but apparently it wants to control everything and doesn't like it if anyone else gives out static addresses, so if refuses to run. Which is also why you can't use internet. So I guess you'll have to change /etc/network/interfaces back and figure out how to make dhcpcd behave, and give out the correct static address. At least that narrows down the problem to the dhcpcd-configuration... – dirkt Aug 5 '18 at 13:43
  • 1
    I specified that it should control only wlan0 but that's ok, I simply disabled it. I'm now having a problem that the wireless disappears after some time. That is. my SSID won't show up anymore. I created another question because this is a completely different problem, maybe you can help? unix.stackexchange.com/questions/460681/… anyways, I'm gonna accept your solution because it worked – Guerlando OCs Aug 5 '18 at 17:09

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.