1

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.

5
  • Do you enable ip forward in Centos server?
    – cuonglm
    Jul 12, 2013 at 6:19
  • yes i did,everything is going fine before restart,but after restart no connectivity to internet from client side
    – vic
    Jul 12, 2013 at 9:10
  • I would expect that the nic connected to "the modem" (eth1) would be the internet facing IP?
    – symcbean
    Jul 12, 2013 at 9:57
  • yes eth1 is internet facing ip
    – vic
    Aug 5, 2013 at 8:21
  • Couple of things. 1. Double check you ip_forward is still enable sysctl net.ipv4.ip_forward 2. What does your routing table look like route -n 3. You have under you steps followed eth1 is set to 192.168.0.3, is that a typo? Aug 9, 2013 at 4:05

1 Answer 1

0

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

3
  • i did everything as described by you,but still the result is same
    – vic
    Jul 23, 2013 at 10:32
  • At this point I would start adding logging rules into iptables -j LOG --log-prefix <some text indicating which table> and running tcpdump -ni eth0 and tcpdump -ni eth1 on the router and see what is happening to the packets. Jul 24, 2013 at 6:36
  • can elaborate it more,plz.....i configured and install centos and other distro many times,never face such issue,don't know why this time i am facing it.....if possible can you plz give me all steps that has perform while installing and configuring centos as a internet gateway(permanent settingings so that it won't go after restart)...Please its important for me to do it as soon as possible
    – vic
    Jul 24, 2013 at 11:33

You must log in to answer this question.

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