Try add this rule:
iptables -A FORWARD --in-interface br -j ACCEPT
and eventually replace
sudo iptables -t nat -A POSTROUTING -o wan1 -j MASQUERADE
by
sudo iptables -t nat -A POSTROUTING -s 192.168.3.0/24 -o wan1 -j MASQUERADE
A Wireshark (or tshark, tcpdump) can be used for diagnose on both interfaces simultaneously.
Extended analysis
There can be many reasons why your router is not working:
- IP forwarding is not enabled
- DNS server is unreachable for LAN hosts
- NAT (network address translation) setting does not work for LAN hosts
- ...
Reboot your PC to get all services to their normal state.
Do not use names but numeric IP addresses to ping test until you verify that all other tests listed below are OK. You eliminate possible simultaneous DNS problem by this way.
Test 1
Check IP routing (forwarding) status (result 1 means forwarding is enabled):
cat /proc/sys/net/ipv4/ip_forward
Test 2
Check the correct NAT (masquerade) setting for your LAN interface:
ping -c 3 8.8.8.8
ping -c 3 -I 192.168.3.1 8.8.8.8
First command above is an accessibility test of destination IP address. You must get 3 valid ping responses. Second command tests whether the NAT is working for your LAN IP addresses. If you get no response, it means masquerade cannot translate your source address 192.168.3.1. and your other addresses in LAN (192.168.3.0/24) have the same problem too. Verify your NAT section of the iptables setting very carefully. Continue to next tests if the NAT setting looks good, but you get no ping response.
If ping response is OK but other network nodes in the LAN still cannot ping to 8.8.8.8, then possible solution is to specify complete network address (not only own br
interface address 192.168.3.1) as source for NAT:
sudo iptables -t nat -A POSTROUTING -s 192.168.3.0/24 -o wan1 -j MASQUERADE
Test 3
Outgoing WAN packets and their IP addresses:
Verify the tcpdump
is installed and install it, if it is not present.
which tcpdump
sudo apt-get install tcpdump
Described process will guide you to check the tcpdump functionality and a network data capturing. You can stop the capturing process by pressing the Ctrl+C in running tcpdump instance window. Open second terminal window (T2). First (T1) will be used for traffic generation and response checking. You will use the second terminal (T2) to start and stop capture tasks using tcpdump. It is possible use only one terminal for both tasks, but if you are not familiar with the foreground and background task switching, it is more safe to use two terminals.
T2
sudo tcpdump -i wan1 -n icmp and host 8.8.8.8
T1
ping -c 2 8.8.8.8
You will see the two ICMP outgoing packets (echo request) and two incoming echo responses. Watch their source and destination IP addresses. Outgoing packet has destination IP 8.8.8.8 and source is your public WAN IP address. You will compare them with addresses displayed in next step.
Press Enter key in T2 terminal to create new line space there in output of running tcpdump
. It helps you to separate old and new captured data in window.
T1
ping -c 2 -I 192.198.3.1 8.8.8.8
What do you see? There are these possibilities:
- no packets are captured
- only outgoing packets are displayed and they have wrong source IP adress (e.g. 192.168.3.1 instead of your public IP address of WAN interface.)
- both outgoing and incoming packets are visible.
Break the tcpdump
in T2 window (Ctrl+C).
Please, copy the response from T2 and paste it to your answer here. Add the response of ip route
and eventually these commands:
ip neigh
sudo iptables-save
Describe results of other tests.