I am trying to set up a Raspberry Pi 4 as a wlan0 <-> wlan1 router and followed Ingo's excellent guide here:
Access point as WiFi router/repeater with additional WiFi-dongle
Having gone through all the steps on a fresh, updated Buster installation, I've not been able to make this work.
wlan1 happily connects to the internet (I am typing this on the Raspberry Pi 4 in question) and other computers can connect to the access point I set up at wlan0.
However no internet access is happening for computers connected to wlan0.
ifconfig on computers connected to wlan0 indicates that they are somehow picking up an IP address from wlan1's range instead of wlan0's DHCP range.
I'm tearing my few remaining hairs out here. Have gone through the entire process described in Ingo's answer with a fresh install of Buster.
Any help is greatly appreciated!
Additional info:
# Here is my /etc/resolvconf.conf:
resolvconf=NO
resolv_conf=/etc/resolv.conf
dnsmasq_resolv=/var/run/dnsmasq/resolv.conf
pdnsd_conf=/etc/pdnsd.conf unbound_conf=/var/cache/unbound/resolvconf_resolvers.conf
# My /etc/wpa_supplicant/wpa_supplicant-wlan0.conf:
country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="Illusionary 2"
mode=2
key_mgmt=WPA-PSK
psk="connectme"
frequency=2412
}
# My /etc/wpa_supplicant/wpa_supplicant-wlan1.conf:
country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="ActualSSID"
psk="ActualPW"
}
# My [email protected]:
[Service]
ExecStartPre=/sbin/iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE
ExecStopPost=-/sbin/iptables -t nat -D POSTROUTING -o wlan1 -j MASQUERADE
# My /etc/systemd/network/08-wlan0.network:
[Match]
Name=wlan0
[Network]
Address=192.168.4.1/16
IPForward=yes
DHCPServer=yes
[DHCPServer]
DNS=84.200.69.80 1.1.1.1
RouteMetric=200
# My /etc/systemd/network/12-wlan1.network:
[Match]
Name=wlan1
[Network]
Address=192.168.1.199/24
DNS=8.8.8.8 8.8.4.4
DHCP=yes
[Route]
Gateway=192.168.1.1
Metric=10
[DHPC]
RouteMetric=100
# ifconfig output:
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 12 bytes 600 (600.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12 bytes 600 (600.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.4.1 netmask 255.255.0.0 broadcast 192.168.255.255
inet6 fe80::dea6:32ff:fe03:2d7c prefixlen 64 scopeid 0x20<link>
ether dc:a6:32:03:2d:7c txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 121 bytes 42965 (41.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.199 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::76da:38ff:feea:7fcb prefixlen 64 scopeid 0x20<link>
ether 74:da:38:ea:7f:cb txqueuelen 1000 (Ethernet)
RX packets 6617 bytes 4308027 (4.1 MiB)
RX errors 0 dropped 1625 overruns 0 frame 0
TX packets 3264 bytes 481039 (469.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
# iwconfig output:
wlan0 IEEE 802.11 Mode:Master Tx-Power=31 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
eth0 no wireless extensions.
lo no wireless extensions.
wlan1 IEEE 802.11bgn ESSID:"ActualSSID" Nickname:"<WIFI@REALTEK>
Mode:Managed Frequency:2.437 GHz Access Point: 80:2A:A8:44:F6:19
Bit Rate:72.2 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality=99/100 Signal level=49/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
# route -n output:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 10 0 0 wlan1
0.0.0.0 192.168.1.1 0.0.0.0 UG 1024 0 0 wlan1
192.168.0.0 0.0.0.0 255.255.0.0 U 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan1
192.168.1.1 0.0.0.0 255.255.255.255 UH 1024 0 0 wlan1`
Updated 2019-10-25:
I've implemented Ingo's suggestions, but so far have had no luck with getting this to work. Access to the internet via wlan1 is (still) working locally, but wlan0 still doesn't connect clients to the internet.
My new /etc/systemd/network/08-wlan0.network:
[Match]
Name=wlan0
[Network]
Address=192.168.4.1/24
IPForward=yes
DHCPServer=yes
[DHCPServer]
DNS=84.200.69.80 1.1.1.1
My new /etc/systemd/network/12-wlan1.network:
[Match]
Name=wlan1
[Network]
DHCP=yes
My new ifconfig output:
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 156 bytes 15032 (14.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 156 bytes 15032 (14.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.4.1 netmask 255.255.255.0 broadcast 192.168.4.255
inet6 fe80::dea6:32ff:fe03:2d7c prefixlen 64 scopeid 0x20<link>
ether dc:a6:32:03:2d:7c txqueuelen 1000 (Ethernet)
RX packets 9 bytes 1107 (1.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 139 bytes 42957 (41.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.123 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::76da:38ff:feea:7fcb prefixlen 64 scopeid 0x20<link>
ether 74:da:38:ea:7f:cb txqueuelen 1000 (Ethernet)
RX packets 2151 bytes 949342 (927.0 KiB)
RX errors 0 dropped 129 overruns 0 frame 0
TX packets 1043 bytes 244850 (239.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
My new iwconfig output:
wlan0 IEEE 802.11 Mode:Master Tx-Power=31 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
eth0 no wireless extensions.
lo no wireless extensions.
wlan1 IEEE 802.11bgn ESSID:"ActualSSID" Nickname:"<WIFI@REALTEK>"
Mode:Managed Frequency:2.437 GHz Access Point: 80:2A:A8:44:F6:19
Bit Rate:72.2 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Encryption key:****-****-****-****-****-****-****-**** Security mode:open
Power Management:off
Link Quality=100/100 Signal level=53/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
My new route -n output:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 1024 0 0 wlan1
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan1
192.168.1.1 0.0.0.0 255.255.255.255 UH 1024 0 0 wlan1
192.168.4.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
Updated 2019-10-26, output from 2nd Pi:
iw wlan0 link:
Connected to dc:a6:32:03:2d:7c (on wlan0)
SSID: Illusionary 2
freq: 2412
RX: 21652487 bytes (154629 packets)
TX: 1115276 bytes (7331 packets)
signal: -20 dBm
tx bitrate: 72.2 MBit/s MCS 7 short GI
bbs flags: short preamble short-slot-time
dtim period: 2
beacon int: 100
ip addr:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
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: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether b8:27:eb:14:2d:b1 brd ff:ff:ff:ff:ff:ff
inet 192.168.2.175/24 brd 192.168.2.255 scope global eth0:1
valid_lft forever preferred_lft forever
4: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:0b:81:87:b9:bb brd ff:ff:ff:ff:ff:ff
inet 192.168.1.114/24 brd 192.168.1.255 scope global wlan0
valid_lft forever preferred_lft forever
inet6 fe80::20b:81ff:fe87:b9bb/64 scope link
valid_lft forever preferred_lft forever
raspbian-stretch
. Using Stretch doesn't make sense on a RPi 4B so I assume to use a Buster installation.ping google.com
from the RasPi?