cancel
Showing results for 
Search instead for 
Did you mean: 

internet pbm

 
Highlighted
Advisor

internet pbm

hi all,

Im having two nic in my linux box .
i have connected a adsl modem to eth1 of my server.the ip for eth1 is 192.168.1.2, where the adsl modem has 192.168.1.1.My eth0 connects to my local network with ip 192.168.0.1.how do i allow my local network clients with 192.168.0.0 ips to access the internet
2 REPLIES 2
Highlighted
Honored Contributor

Re: internet pbm

First, you want to enable 'ip forwarding'.

This can be done in a few ways depending on the distribution you have, but it all comes down to:

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

Use 'sysctl' (and '/etc/sysctl.conf') as the preferred method of routinely setting this.

Next is the firewall, in particular the 'FORWARD' section. This needs to have some decent rules, or have an ACCEPT policy. If you're using the firewall on your ADSL router, this is sort-of ok. If not, then set up the firewall on your Linux box properly.

Of course, you'll need to ensure that your linux box has a default route set through 192.168.1.1/eth1, so that traffic knows where to go after it's been allowed to forward.

Then all you need is to make sure you have a valid, working DNS server, and you're all good.
One long-haired git at your service...
Highlighted
Trusted Contributor

Re: internet pbm

# echo 1 > /proc/sys/net/ipv4/ip_forward
# echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
# iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
# service iptables save