3

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)?

3
  • I'm not clear on what you're getting at. Are you trying to prevent your server from accessing the internet?
    – digitxp
    Aug 25, 2011 at 2:38
  • Yes that's exactly what I'm trying to do. However, other devices should still be able to access the net.
    – nopcorn
    Aug 25, 2011 at 2:40
  • 1
    You could just not give it a default gateway in the IP configuration. That would prevent it from accessing the internet.
    – bfhd
    Aug 25, 2011 at 3:13

2 Answers 2

5

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 192.168.1.0/24 -j ACCEPT
# Allow connections from this host to 192.168.2.10
iptables -A OUTPUT -o eth0 -s 192.168.1.0/24 -j ACCEPT
1
  • 1
    iptables rules.
    – digitxp
    Aug 25, 2011 at 2:53
0

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

You must log in to answer this question.

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