Linux Forums - Linux Help,Advice & support community:LinuxSolved.com

Network Troublshooting => General Networking Support in Linux => Topic started by: adham1sa on December 26, 2004, 02:25:08 PM

Title: Internet Sharing - 2 NICs
Post by: adham1sa on December 26, 2004, 02:25:08 PM
Hi,

I jus installed RedHat 9 and followed the instructions in Rick's post http://www.linuxsolved.com/forums/ftopic115.html in order enable NAT but it didn't work. I have 2 NICs in my server. eth0 is being used as external for the dedicated connection(Fixed IP)  that I have, and eth1 is being used as internal interface for my network. Hope someone can give me a simple configuration procedure to allow all users to access the internet through my Linux server.

Regards,
Title: Internet Sharing - 2 NICs
Post by: Ricky on December 27, 2004, 08:11:28 AM
have you changed ppp0 with eth0 in the above script ?
Title: Internet Sharing - 2 NICs
Post by: adham1sa on December 27, 2004, 09:18:56 AM
Yes I did. I changed also eth0 to eth1 in line no. 4. The following is what I exactly entered:

Code: [Select]
iptables=/sbin/iptables


iptables --flush -t nat


iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward

By the way, I came accross a web page that has basic configurations to enable Internet Sharing georgehewitt.co.uk/help/iptables.htm. I applied them and my server worked perfectly. In your post, the script file (rd.nat) is to be compiled and to be included in rc.local to be executed each time the computer is restarted.  The author of the configuration in the pre-mentioned link is doing it differently. Are there any advantages or disadvantages between you way and his? or is it just a different way of doing things?

Thank You.
Title: Internet Sharing - 2 NICs
Post by: Ricky on December 29, 2004, 08:10:21 AM
btw the link you have given is not working for me..

FYI the script i have given is best for dynamic ip internet connections but works also on static one, but if it is not working then there is another option in iptables called dnat instead of masquerade.

And if you are getting your worked done then it is good.
Title: Internet Sharing - 2 NICs
Post by: dragoncity99 on December 31, 2004, 02:15:47 PM
Maybe u should try the easy way:

1. Use shorewall to help u setup the ip forwarding and masquerading

2. Use proxy.
Title: Internet Sharing - 2 NICs
Post by: Ricky on January 01, 2005, 03:20:00 PM
Or Simply install firestartor and enable routing through that :)