Super User is a question and answer site for computer enthusiasts and power users. 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

I'm thinking of setting up a local server on an old machine I have lying around. So that I can easily ssh into it, I would like to add it to my current network by plugging it right into my router. Currently, all my other devices access the Internet via this router, but I would like to restrict this in my server's case.

Is this something that I can set up right in the router? Or is it operating system specific (I should mention I will be virtualizing my server so it can live beside other VMs, all of them Linux)?

share|improve this question
I'm not clear on what you're getting at. Are you trying to prevent your server from accessing the internet? – digitxp Aug 25 '11 at 2:38
Yes that's exactly what I'm trying to do. However, other devices should still be able to access the net. – n0pe Aug 25 '11 at 2:40
You could just not give it a default gateway in the IP configuration. That would prevent it from accessing the internet. – bfhd Aug 25 '11 at 3:13
@bfhd: Thanks, I'll keep than in mind. – n0pe Aug 25 '11 at 3:14
up vote 5 down vote accepted

Modified from this Server Fault question:

#Flush existing rules
iptables -F
# Set up default DROP rule for eth0
iptables -P INPUT DROP
# Allow existing connections to continue
iptables -A INPUT -i eth0 -m state EXISTING,RELATED -j ACCEPT
# Accept everything from the 192.168.1.x network
iptables -A INPUT -i eth0 -s -j ACCEPT
# Allow connections from this host to
iptables -A OUTPUT -o eth0 -s -j ACCEPT
share|improve this answer
iptables rules. – digitxp Aug 25 '11 at 2:53

This can be acheived on most commercial home routers, as well as the OS. Just check out your routers manual.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .