I have set up a local linux (14.0.4 Ubuntu) machine as a router and can do the following:
- ping server/router from the clients
- ping clients from server/router
- ping one client from the other
ping the modem/router behind the server/router
But I can't ping google or 8.8.8.8. I get the following errors:
ping: unknown host www.google.com
connect: network is unreachable
But I can issue both of those commands on the server/router, without problem, which leads me to believe it is an iptables
related issue. Can someone have a look at the below code, which I use to initialize iptables, and tell me if there are any glaring mistakes.
#!/bin/bash
ethInternal=eth1
ethExternal=eth0
sudo iptables --flush
sudo iptables --table nat --flush
sudo iptables --delete-chain
sudo iptables --table nat --delete-chain
sudo iptables -t nat -A POSTROUTING -o $ethExternal -j MASQUERADE
sudo iptables -A FORWARD -i $ethExternal -o $ethInternal -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i $ethInternal -o $ethExternal -j ACCEPT
EDIT 1
client: netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
192.168.66.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
EDIT 2
client: route add -net default gw 192.168.66.254
client: netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.66.254 0.0.0.0 UG 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
192.168.66.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
EDIT 3
SV-01: vi /var/log/kern.log
Relevant section of log file can be found here.
cat /proc/sys/net/ipv4/ip_forward
?1
. on the client it is0
netstat -rn
? You'll need to edit that into your question.