0

I have a Ubuntu 14.04 LTS server with two NICs. One is connected to the internal network (eth0, 192.168.4.0/24) and the other one is connected to a router with internet access (eth1, network 192.168.2.0/24).

What I want to achieve is to give the clients of the 192.168.4.0/24 network internet access. So I ran the following commands:

$ echo 1 > /proc/sys/net/ipv4/ip_forward
$ iptables -A FORWARD -i eth0 -j ACCEPT
$ iptables -A FORWARD -o eth0 -j ACCEPT

as far as I understand, the clients should now be able to reach the router, but it doesn't work:

$ ping 192.168.2.1
Request timeout for icmp_seq 0

and enabling NAT as a final step doesn't work

$ iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE 

Can you please tell me where my mistake is?

1 Answer 1

2

Did you check your routes eg default gateway? Check route -n.

Otherwise you could try setting a rule to route back the packets from the established connections.

iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
iptables -A FORWARD -i eth1 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .