On Wed, Mar 26, 2008 at 11:44 AM, krishna chaitanya <[EMAIL PROTECTED]> wrote:
> Hi all,
>
>  I need some info on internet connection sharing
>  on linux using two nic cards one for the internet
>  other for lan.please throw some light on this.
>
>  Regards,
>  Chaitanya

Hi Chaitanya,
You will have to enable IP forwarding and masquerading on your Linux box.

IP Forwarding:
As root,
sysctl -w net.ipv4.ip_forward=1

Add the line
net.ipv4.ip_forward = 1
to /etc/sysctl.conf to enable it at system start

Configure iptables to allow masquerading(internet connection sharing):

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
service iptables save
service iptables restart

I assume eth0 is the interface connected to the internet and eth1 is
the interface connected to your LAN.
Give eth1 an IP address like 192.168.0.1
Configure other machines on your LAN to use IP addresses like
192.168.0.2-254 and set their Netmask as 255.255.255.0 and Gateway as
192.168.0.1
Also set the nameservers on your LAN machines the same as for your Linux box.

Once set you can check pinging each other to make sure it works.
If your eth0 on Linux box uses 192.168.0.* IP address then use any of
192.1.68.1-254 for eth1 and LAN.

See this page to get more info on this:
http://www.unixgeeks.org/security/newbie/misc/ipmasq.html
Let us know how it went.

--
Satish

Reply via email to