I am trying to set up a network where multiple devices can connect to each other. All devices are running Linux. The network setup includes:
- One WiFi Access Point (AP) Host
- Multiple WiFi AP Clients
- One device connected via Ethernet cable to the WiFi AP Host.
The WiFi nodes can connect to each other, and devices connected via Ethernet can also connect to each other. However, the Ethernet client cannot connect to the WiFi AP client. Notably:
- The Ethernet client can reach the WiFi network’s default gateway.
- The WiFi client can reach the Ethernet connection’s default gateway.
- If I switch the access point between WiFi devices (i.e., the Ethernet client is connected to the WiFi AP client), everything works correctly, and all devices can ping each other. This suggests that the default gateway of the WiFi network is always accessible.
Steps Taken
-
Create WiFi Access Point and connect a client device:
-
AP Host Creation:
sudo nmcli con add type wifi ifname wlan1 con-name my-access-point ssid my-access-point mode ap sudo nmcli con mod my-access-point 802-11-wireless.mode ap 802-11-wireless.band bg sudo nmcli con mod my-access-point ipv4.method shared ipv4.addresses "10.10.0.0/16" sudo nmcli con mod my-access-point wifi-sec.key-mgmt wpa-psk sudo nmcli con mod my-access-point wifi-sec.psk "password123" sudo nmcli con mod my-access-point autoconnect yes sudo nmcli con up my-access-point
-
AP Client Connection (Assigned IP: 10.10.0.162):
sudo nmcli device wifi connect my-access-point password "password123" ifname wlan1
-
-
Create and connect Ethernet interface:
-
Create Ethernet Interface on AP Host Device:
sudo nmcli connection add type ethernet ifname eth0 con-name my-wired-connection ipv4.method shared ipv4.addresses '10.0.0.0/30' sudo nmcli connection up my-wired-connection
-
Connect Other Device via Ethernet Cable (Assigned IP: 10.0.0.2):
- Connected via GUI
-
-
Setup Network Forwarding Between Devices:
-
Enable IP Forwarding:
sudo sysctl -w net.ipv4.ip_forward=1
-
Configure NAT on AP Host Device:
sudo iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE sudo iptables -A FORWARD -i wlan1 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i eth0 -o wlan1 -j ACCEPT sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo iptables -A FORWARD -i eth0 -o wlan1 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i wlan1 -o eth0 -j ACCEPT
-
-
Update IP Routes on End Devices:
- Ethernet Client:
sudo ip route add 10.10.0.0/16 via 10.0.0.0
- AP Client Device:
sudo ip route add 10.0.0.0/30 via 10.10.0.0
-
Check Connectivity:
- Ethernet Client:
- Check WiFi AP Host Ethernet IP:
ping 10.0.0.0
(success) - Check WiFi AP Host WiFi Network IP:
ping 10.10.0.0
(success) - Check WiFi AP Client IP:
ping 10.10.0.162
(failure)
- Check WiFi AP Host Ethernet IP:
- WiFi AP Host:
- Check Ethernet Client IP:
ping 10.0.0.2
(success) - Check WiFi AP Client IP:
ping 10.10.0.162
(success)
- Check Ethernet Client IP:
- WiFi AP Client:
- Check Ethernet Client IP:
ping 10.10.0.2
(failure) - Check WiFi AP Host Ethernet IP:
ping 10.0.0.0
(success)
- Check Ethernet Client IP:
- Ethernet Client:
Problem Summary
While WiFi nodes and Ethernet-connected devices can communicate within their respective networks, cross-communication between the Ethernet client and WiFi AP client fails. Despite successful reachability to default gateways from both sides, direct communication is problematic unless the AP role is switched between the WiFi devices. Any insights or solutions to enable seamless connectivity between the Ethernet client and WiFi AP client would be greatly appreciated.