Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

as a lab assignment we are supposed to configure our linux pc with two network interfaces and make it behave as a router. could you give me some guidance on how to proceed?

share|improve this question

migrated from Oct 5 '09 at 15:08

This question came from our site for professional and enthusiast programmers.

Just toss in a Vyatta live CD :) – Tim Post Oct 5 '09 at 15:20
up vote 4 down vote accepted

This will enable routing temporarily:

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

If your want this option to survive a reboot, add net.ipv4.ip_forward=1 to your /etc/sysctl.conf


share|improve this answer
You'll also want each interface configured in different subnets – Charles Hooper Oct 5 '09 at 15:30
If you do that, what exactly is the effect? An example? – djangofan Oct 5 '09 at 19:17
Example? Use the IP of that box as gateway to the subnet on the other side of the router an it will forward your packets... – PEra Oct 5 '09 at 19:47
where do you configure the forward address? – djangofan Apr 9 '10 at 23:17

If it is just a simple packet forwarding, do what PEra suggested. Try looking up shorewall for a quick and easy way to configure more things. For more advanced information, refer to LARTC instead.

share|improve this answer
+1 for shorewall, though it does involve a bit of a learning curve, however the curve is MUCH less than diving straight into iptables. – Tim Post Oct 5 '09 at 15:19

There is a large, detailed How-To here. There is another good one here.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.