Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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. –  MaxMackie Aug 25 '11 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 '11 at 3:13
    
@bfhd: Thanks, I'll keep than in mind. –  MaxMackie Aug 25 '11 at 3:14
add comment

2 Answers

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 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
share|improve this answer
1  
iptables rules. –  digitxp Aug 25 '11 at 2:53
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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