0

Goal is for clients to connect through Pi4 AP to the WAN. The Pi4 is inside the LAN and wire connected to a router LAN port.

After much effort a client can now connect to the Pi4 AP but cannot ping the Pi4 wlan0 interface at 192.168.0.3 (which I had thought would work at this point).

Am surprised that ping on the Pi4 to a client works with:

ping 192.168.0.104 -I wlan0
PING 192.168.0.104 (192.168.0.104) from 192.168.0.3 wlan0:
64 bytes from 192.168.0.104: icmp_seq=1 ttl=64 time=93.2 ms

A client wireless connected setup shows default route as 192.168.0.1 and DNS as 192.168.0.3

Clients are getting the correct ip address as per MAC addresses in the DNSmasq setup.

Here's the setup:

/etc/dhcpcd.conf: (ifconfig confirms the interfaces settings)

interface eth0
static ip_address=192.168.0.2/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
noipv6

interface wlan0
static ip_address=192.168.0.3/24
noipv6

nohook wpa_supplicant

/etc/network/interfaces:

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual

/etc/wpa_supplicant/wpa_supplicant.conf: Nothing added

/etc/hostapd/hostapd.conf:

interface=wlan0
driver=nl80211
ssid=MyAPtest
wpa_passphrase=mytest
hw_mode=g
channel=6
wmm_enabled=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

/etc/default/hostapd:

DAEMON_CONF="/etc/hostapd/hostapd.conf"

/etc/sysctl.conf:

net.ipv4.ip_forward=1

Tried the following that didn't do anything (and not surprised):

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
6
  • Can you ping any other PC in the WAN interface? The NAT might not be configured properly for doing that. Jan 28 at 1:51
  • The Pi can ping all other systems on the NAT and each other. The only problem is the client on the Pi AP cannot ping the Pi but the Pi can ping that client.
    – Herondas
    Jan 28 at 6:29
  • The most common configuration for an AP is to configure a bridge interface, so both wlan0 and eth0 interfaces behave like a single one. The two interfaces shouldn't be in the same LAN, nor should be NATed, unless they belong to different LAN. Jan 28 at 9:01
  • Thanks! I set wlan0 to 192.168.1.1 network and added its dhcp-range and now it pings both ways, wireless client <-> Pi4
    – Herondas
    Jan 28 at 19:58
  • @H Please create an answer for the solution and mark it as the accepted one with a click on the tick on its left side after two days. That prevents your Question from being shown as an unsolved Post to the community and saves them/us a lot of work.
    – Ingo
    Jan 28 at 20:15
0

Following up on the eventHandler comment that wlan0 should not be in the same NAT as eth0 did the following:

In /etc/dhcpcd.conf changed wlan0 from 0.3 to 1.1:

interface eth0
static ip_address=192.168.0.2/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
noipv6

interface wlan0
static ip_address=192.168.1.1/24
noipv6

nohook wpa_supplicant

In /etc/dnsmasq.d/home.dns changed from one dhcp-range to two for wlan0 and eth0:

# General Configuration
domain-needed
bogus-priv
domain=MyDom
dhcp-range=eth0,192.168.0.100,192.168.0.130,12h
dhcp-range=wlan0,192.168.1.100,192.168.1.130,12h
dhcp-option=3,192.168.0.1

Now a wireless client can ping the Pi wlan0 interface, and the Pi wlan0 interface can ping the wireless client.

The next phase is to network the wlan0 network with the tun0 OpenVPN network which will be posted as necessary depending on how it goes.

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.