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

OK I'm admin noob.

Is there a way for adding static DNS entry?

I already tried to modify /etc/hosts file but without success.

Here is my hosts file:   localhost   hitsu

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Eveyrything is fine, but when I enter for example I still get the page.

Is there a way to block that sites?

I am trying to increase productivity in work via disabling off-topic sites.


Well I would like to block all sites from deviantart something like *

Browser add-ons/extensions are a good solutions, but I use multiple browsers (chrome, opera etc) so it will be probably easier to block this in linux.


There are some solutions for this problem eg

However it won't work for multidomains..

share|improve this question
You could setup dnsmasq with some overrides, or configure a proxy like squid (in which you could even make non-productivity sites blocking time-dependent) – Wrikken May 14 '13 at 19:37

You cannot use wildcards in /etc/hosts. You will need to add every subhost separately.

Tell us more about the problem. Do you want to block traffic originating from your machine only, from the whole network? Only WWW traffic?

If you want to block all traffic to deviantart:

 host gives

 iptables -A OUTPUT -d -j DROP

This will DROP all packages going to This IP can change of course but you can check it periodically. If you want this to be persistent you would probably need to add this line to some /etc/rc.local script or appropriate for your distro.

share|improve this answer
I want to block specific traffic only for my machine. – nothing-special-here May 14 '13 at 8:29
So you can add all subdomains to /etc/hosts or use iptables like in my eidt – tdi May 14 '13 at 8:38
I don't know bash. Can I use Ruby or other dynamic languages at /etc/rc.local scripts? Do you other tools which can do the same job? – nothing-special-here May 14 '13 at 11:55
Nope. Just write there: /usr/sbin/iptables -A OUTPUT -d -j DROP – tdi May 14 '13 at 12:36

Easiest way is probably to use dnsmasq

Install dnsmasq

$ sudo apt-get install dnsmasq

and add this line to /etc/dnsmasq.conf


This will block and all its subdomains.

Note: For ubuntu see this post.

share|improve this answer

You need to add to /etc/hosts to block

But perhaps better way to boost productivity is to not visit voluntarily? You can also install Adblock Plus plugin for Firefox and use it to block these sites. Adblock lets you add pattern like and automatically block all subdomains - unlike /etc/hosts.

share|improve this answer
I have edited my answer and added more info. – nothing-special-here May 14 '13 at 8:47

You must log in to answer this question.

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