I setup successfully an USB wlan1
as AP via hostapd
, and isc-dhcpd
(it listens only to wlan1
-interface) on a Raspberry 4 (using Raspbian). Regardless if wlan0
(the onboard WIFI) is connected to a WAN hotspot, wlan1
Clients can ping that wlan1
interface. IP Forwarding/masquerade works, and if wlan0
is connected to WAN AP, wlan1
clients also have internet access. Perfect!
But in the moment i plug-in eth0
, wlan1
clients can still connect to that AP (Status connected
), but can NOT PING that wlan1
interface anymore (and no WAN access anymore).
That's weird! The DHCP Server pushed the same valid IP's to the client as before, and static IP of wlan1
also stays the same (eth0
and wlan1
have static IP). wlan1
can be pinged locally from the rapsberry (but not from an external client).
When i un-plug eth0
, it work's again.
What's going wrong and why i canot even ping that interface anymore?
sysctl IPv4 forwarding is enabled.
...
$ ip link
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
4: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
...
$ ip addr
...
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether e4:5f:01:84:db:34 brd ff:ff:ff:ff:ff:ff
inet 10.8.0.2/8 brd 10.255.255.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
...
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether e4:5f:01:84:db:37 brd ff:ff:ff:ff:ff:ff
4: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether a0:f3:c1:23:2d:62 brd ff:ff:ff:ff:ff:ff
inet 10.8.5.1/8 brd 10.255.255.255 scope global noprefixroute wlan1
valid_lft forever preferred_lft forever
...
$nft list ruleset
...
table ip nat {
chain postrouting {
type nat hook postrouting priority srcnat; policy accept;
masquerade
}
}
...
$ cat /etc/hostapd/hostapd.conf
interface=wlan1
#If this fails, try rt1871xdrv a
#driver=nl80211
# Name of the new network: best use the hostname
ssid=xxx
# Pick a channel not already in use
channel=1
# Change to b for older devices?
hw_mode=g
macaddr_acl=0
auth_algs=3
# Disable this to insure the AP is visible:
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=xxx
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
#bridge=br0 # no bridge! We're using routing
country_code=JP
cat /etc/dhcpcd.conf
...
interface eth0
static ip_address=10.8.0.2/8
static routers=10.8.0.1
static domain_name_servers=127.0.0.1
interface wlan1
static ip_address=10.8.5.1/8
nohook wpa_supplicant
static domain_name_servers=127.0.0.1
interface wlan0
static domain_name_servers=127.0.0.1
cat /etc/dhcp/dhcpd.conf
...
authoritative;
subnet 10.8.5.0 netmask 255.255.255.0 {
range 10.8.5.201 10.8.5.250;
option broadcast-address 10.8.5.255;
option routers 10.8.5.1;
default-lease-time 600;
max-lease-time 7200;
option domain-name "local";
option domain-name-servers 10.8.5.1;
}
host ares {
hardware ethernet 04:ea:56:ae:58:03;
fixed-address 10.8.5.20;
}
$ ipconfig # on Windows 11 Client
...
Wireless LAN adapter Wi-Fi:
Connection-specific DNS Suffix . : local
Description . . . . . . . . . . . : Intel(R) Dual Band Wireless-AC 8265
Physical Address. . . . . . . . . : 04-EA-56-AE-58-03
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::9300:7ccf:3e03:eaf9%17(Preferred)
IPv4 Address. . . . . . . . . . . : 10.8.5.20(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : Friday, 16 December 2022 22:56:38
Lease Expires . . . . . . . . . . : Friday, 16 December 2022 23:06:37
Default Gateway . . . . . . . . . : 10.8.5.1
DHCP Server . . . . . . . . . . . : 10.8.5.1
DHCPv6 IAID . . . . . . . . . . . : 168094294
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-26-1E-05-25-48-2A-E3-3A-C9-F0
DNS Servers . . . . . . . . . . . : 10.8.5.1
NetBIOS over Tcpip. . . . . . . . : Enabled
...