Latest LQ Deal: Latest LQ Deals
Go Back > Linux Answers > Networking
User Name


By erklaerbaer at 2007-04-27 16:53
This was only tested with Slackware, but should work on almost every other distribution and even for Windows.

Assume this is your setup:
A --> B --> Internet

You want to connect A to the internet, B is already connected.

Run this
  if [ -f /proc/sys/net/ipv4/ip_forward ]; then
    echo "Activating IPv4 packet forwarding."
    echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
on B as root and this
route add default gw $(ipadresse of B)
on A.

Done. Isn't it great?

You could setup a DHCP daemon on B to automate some things, but there are other HOWTOs for that.

by teluguswan on Sat, 2009-12-05 22:49
Very nice easy and shortcut

why dont you provide the example

by placing the values of A, B and ipaddress

that will be more helpfull to understand


All times are GMT -5. The time now is 10:42 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration