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?