Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I NAT my local Lan 1

Status
Not open for further replies.

amitatharkar

IS-IT--Management
Jul 8, 2002
42
IN
Hi ..
I have a linux server as a Internet server. I have installed Squid to share internet connection. But I want to configure NAT for my local lan.
I have local lan network as 192.168.0.0 and i have on static ip form ISP.
I am using iptables under RH 8.0. I tried it with the nat table but not able to ping through my local lan to Internet. Any body suggest me the steps that are required for NAT.
 
Let's assume that your internal network (192.168.0.0) device is eth0 on the linux box

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

where eth1 is your internet device. If you are on dial up then it may be ppp0


then activate ipforward

On Red Hat systems, this is controlled in /etc/sysctl.conf
You need to set net.ipv4.ip_forward=1 in this file, or the
command below will have no effect.


echo "1" >/proc/sys/net/ipv4/ip_forward


Now cat /etc/sysconfig/network and check that your gateway device is set to eth0. If not change it.


Now it should work


Bye

Qatqat




I have been happy throughout my life in thinking that samba was I kind of dance; now I live with Linux and all I do is working.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top