I just installed Ubuntu 10.04 LTS server on a old desktop PC with a dual port network card I would like to use as router for my home network. How do I have to set up the interfaces so that the internet connection is passed through the server?

link|improve this question

feedback

2 Answers

up vote 1 down vote accepted

The first step when configuring Linux as a router is to enable IP forwarding:

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

Now the OS can route packets between interfaces.

Next use iptables and netfilter to create traffic rules.

I would suggest that you use a front-end to iptables and Netfilter in order to configure your router and manage the interface rules and policies.

If you prefer a GUI then see some of the other helpful answers on this page.

If you would like to hack at the command line and experience the true power of the Force, then try the excellent Shorewall front-end to iptables and netfilter which will allow you to easily configure your router straight away. Yet, as you learn more about routing Shorewall will allow increasingly fine-grained configurations and packet level network flow control.

The shorewall package is available in the Ubuntu repositories (choose either the shell or Perl package). The Shorewall site has great documentation and helpful tutorials for a multitude of scenarios. The basic 2- or 3- interface examples should get you going.

link|improve this answer
feedback

The easiest way would be to use iptables. Have a read on iptables over on the Ubuntu community site. You could also use something like firestarter for a nicer GUI experience.

Personally, I would recommend using a dedicated gateway distro such as ipcop, m0n0wall or an all-in-one system like ClearOS or Untangle. It would simplify the management of the firewall as well as offer you quite a few other features (also, with simplicity built in).

link|improve this answer
Thanks for the answer! The only problem I have at the moment is that the other network interfaces (three in total, two on the two port network card and one integrated into the mainboard) are not listed under /etc/network/interfaces. How can I get them to be listed? They were correctly shown during setup of Ubuntu. – wowpatrick Dec 30 '11 at 0:40
@wowpatrick I think it would work to your advantage to make a whole new question since that's completely different than the question posted above. Try the Ubuntu Stack Exchange site: askubuntu.com – WesleyDavid Dec 30 '11 at 3:18
Thanks! Will do that! – wowpatrick Dec 30 '11 at 15:40
feedback

Your Answer

 
or
required, but never shown

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