0

This is the first time ever I am posting something, so if I am doing wrong please tell me.

My issue is that I have an ubuntu server with 2 network cards.

One is connected into the internal network 172 ... eth0 and another connected to a vodacom lte device eth1.

netstat -anr output is as follows:

Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth1 172.27.72.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1

The server with the 2 network cards can reach the internet. The server can reach other pc's on the network and these pc's can access the server via ssh or samba shares.

My problem is that the other pc's can not access the internet. I have setup iptables on the server with the following:

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

iptables -A FORWARD -i eth1 -o eth0 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT

But still no luck. I think I am close, please help.

Windows 7 tcpip settings is as follows:

ip 172.27.72.10 subnet 255.255.255.0 gateway 172.27.72.1 (server ip)

dns 172.27.72.1 and 8.8.8.8

Thanks

  • Do you have forwarding enabled in kernel? Try 'cat /proc/sys/net/ipv4/ip_forward'. If it says 0, you need to enable forwarding. Is DNS working? What was your test for connection. If you tried web pages and DNS is not working you don't see anything. – nobody Dec 5 '15 at 10:51
  • Hi. Thank you it is working now. Ip forwarding was disabled. I did enable this but rebooted i guess I have now added this to my startup script. Thanks again – Jacques Dec 12 '15 at 4:45
0

Ip forwarding was not enabled after reboot. Added it to my startup script and all is working now.

Thanks to nobody (it would be nice to know his or her name)

  • Hi. I am glad it works. My name is Marko. You don't need to enable forwarding in a script. You can put a line net.ipv4.ip_forward = 1 in /etc/sysctl.conf and forwarding is enabled by default. – nobody Dec 12 '15 at 12:56
  • Take a look here too help.ubuntu.com/community/IptablesHowTo#Saving_iptables. You might find useful info how to properly set up iptables to work on startup. – nobody Dec 12 '15 at 12:59
  • Hi Marko. Thanks for all your help with regards to this. I prefer using startup scripts so that I can turn off and turn on items as required in one central location. – Jacques Dec 14 '15 at 10:23
  • I have 2 internet connections, one using PPOE and the other not so doing one script with both settings in it, is easier to change. The iptables are different for each one as the one forwards between eth0 and eth1 and the other eth0 and PPOE depending on the connection used – Jacques Dec 14 '15 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.