Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I setup Ubuntu box so logged user can access only to several IP addresses, on all protocols?

Additional problem is that Ubuntu uses proxy to acceess to internet.

Tried with UFW, but did not manage with it (probably because pf proxy?)

share|improve this question

1 Answer 1

up vote 0 down vote accepted


You can edit your host file:

sudo gedit /etc/hosts

add the websites you want to block: www.yoursite.com

It works with all browsers I guess.


and to only allow access to one ip adress try:

iptables -A INPUT -p tcp -d {type here the ip} --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j REJECT

See! it's easy ;)

share|improve this answer
tnx :-) will it work if my ubuntu uses proxy? –  user198003 Dec 25 '12 at 7:47
try it and leave us a response to know please :) –  Hakeem Wahab Dec 25 '12 at 12:34

Your Answer


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.