Linux – How to setup Ubuntu server as router

firewalllinuxrouterSecurity

I'm getting a Fit-pc2i one of these days, and plan to use it as a router (it's the one with 2 NICs)

However having never setup a linux server as a router before, I'm pretty much in the wilds here. So does anyone have any good links showing how to do this ? I imagine it's pretty simple setting up some static routes and such, but how about firewall and general security concerns of a device hooked directly up onto the Internet ? (that is, my fiber modem)

Finally is it possible to setup the ssh server, so it only answers on the LAN side ?

To recap:

  1. How do I setup the actual routing part ?
  2. What about firewall setup ? (I'm no good with iptables)
  3. Any other security concerns ? (e.g. services which should be disabled, and so forth)
  4. Can I setup ssh server so it only answers on the LAN side, thus not opening for SSH on the WAN ? (Maybe just block port 22 in the firewall WAN side ?)

That's a lot of questions – if I should redo them as seperate question in here, let me know – thanks 🙂

EDIT: This seems to answers the first question: linux router setup

EDIT 2: Might need to mention I plan on using it as a backup server, as well as a LAMP also. In case this changes the needs security-wise.

Also the routing part is for a very small network, and should support WLAN as well (the fit-pc2i has 2 LAN NICs and 1 WLAN NIC) (we only have 3 machines in the office)

Best Answer

for the first part of your answer let me simply just make a suggestion.

shorewall + webmin. (webmin has a very nice module for shorewall)

if you dont like that option; have a look at eBox. its soon to be based on ubuntu 10.04 (currently 8.04) and is a full fledged UTM.

as for the ssh question; in your /etc/ssh/sshd_config, set the following:

#IPv6
ListenAddress ::

#IPv4
ListenAddress 192.168.1.x (or whatever your private ip is)