Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Can somebody come up with (an) Ubuntu command line(s) that will allow me to deal with a specific site and block all other IP’s, preferably using ufw, but if not, iptables?

share|improve this question
1  
Sorry, but could could you clarify what you mean by "deal with" and "site" ? Perhaps a short story of the problem you are trying to solve will help. –  adric Oct 4 '09 at 17:43
    
Assume I’m engaged in Internet banking. –  Anonymous Oct 4 '09 at 18:01
add comment

1 Answer

As I write this it's not clear what you're looking for (and commenting that you're engaged in internet banking doesn't help one bit), but here's my guess: are you looking for a way to configure your firewall so that it allows traffic to and from only one particular IP address and blocks everything else? If so, here are the IPtables commands to do that:

iptables -I INPUT 0 --src ! xxx.xxx.xxx.xxx -j DROP
iptables -I OUTPUT 0 --dst ! xxx.xxx.xxx.xxx -j DROP

and then to reset it afterwards (assuming you haven't made any other changes to the firewall in the interim):

iptables -D INPUT 0
iptables -D OUTPUT 0
share|improve this answer
    
it'll be DROP rather then DENY –  pQd Oct 4 '09 at 19:55
    
arrrgh silly me. Thanks, I'll edit that. –  David Z Oct 4 '09 at 20:10
    
Nevertheless, I’m getting an error message about the ‘0’ in the string (Ubuntu 9.04). –  Anonymous Oct 4 '09 at 22:53
add comment

Your Answer

 
discard

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