LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Linux Answers > Networking
User Name
Password

Notices

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
Code:
  if [ -f /proc/sys/net/ipv4/ip_forward ]; then
    echo "Activating IPv4 packet forwarding."
    echo 1 > /proc/sys/net/ipv4/ip_forward
  fi
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
on B as root and this
Code:
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.



All times are GMT -5. The time now is 12:05 PM.

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