Linux – Ping reply not getting to LAN machines but getting in Linux router Gateway,Internet not working on client

centosgatewaylinux

I have configured Centos 6.2 as Gateway machine.its having two interfaces

eth0 with ip address that provided by isp 116.x.x.x(Static) and eth1 with ip address 192.168.0.1(no,dns,no dhcp configured yet just ip-forwarding is enabled in router box).

Client machine is configured as:

ip address 192.168.0.5 and gateway 192.168.0.1

After i reboot centos,iptables rules are not all gone.

STEPS FOLLOWED

Router machine:two interfaces eth0:116.X.X.X(static ip) eth1:192.168.0.1

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

iptables -A FORWARD -i eth0 -j ACCEPT

Save the iptable rules in /etc/sysconfig/iptables

Selinix is disabled.

changes done on /etc/sysctl.conf

sysctl -w net.ipv4.ip_forward=1

But still when system reboot everything gone.

Best Answer

When you say that you enabled ip forwarding, did you set it in sysctl.conf so that it is pervasive across reboots?

Setting it via sysctl -w net.ipv4.ip_forward=1 or echo 1 >/proc/sys/net/ipv4/ip_forward is only good for the current runtime and it is reset to the default or whatever is in /etc/sysctl.conf at boot time.

Also make sure that your iptables rules are getting saved in /etc/sysconfig/iptables