Back to main blog list.

Gentoo as a router

Date: Monday 11 February 2013
Changed: Monday 11 February 2013

My telecom-provider comes with a Comtrend modem but unfortuantely the provider has decided that it's easier for them if they switch off all configurations. Since I like to set several custom preferences for my home-network this is a big problem. It's also impossible to replace it with an own modem/router. The only way to solve (most of)  the problems was to buy a router and put it in between the modem and the LAN. But why buying a router if I have a server running 24/7?

First I bought a PCI-network for my server. it's a 10/100Mbits card because I couldn't care for Gigabit-LAN. The I had to rebuild the kernel because I didn't have the driver for it.

The on-board ethernet-card is eth0 and the extra card is eth1.

On the server runs shorewall as a firewall, so I used this for the routing. First I had to add the new networkinterface to /etc/shorewall/interfaces and /etc/shorewall/policy

Now my firewall is much saver because I can open up all the fun stuff to the LAN while keeping the evil internet locked out.

in /etc/shorewall/masq i have the following rule:

eth0            192.168.1.0/24

For DHCP and DNS I used dnsmasq wich is a lightweight alternative to bind and DHCPd.

For uPnP I used miniupnpd. Unfortunately this program is made to cooperate with iptables, not with shorewall so I had to modify the init script and the shorewall files to make it work. In some tutorials I found the name of linux-igd, but this is not in the Gentoo-repo anymore.