Why run a DNS server on your laptop?
- It is easy.
You are getting jerked around
- DNS built into the wireless access point is slow or broken
- Your ISP is evil and hijacks DNS
Evil is the big issue. DNS (Domain Name Service) translates names. for example, "howto.omacneil.org" should be IP# 188.8.131.52 . An evil DNS server might send it to 184.108.40.206 instead and show you a page of ads.
- You are running Debian Wheezy (not tested with Ubuntu)
- You use a dynamic (DHCP) address
- You use Network Manager
If you are using a static IP address on one interface you can edit /etc/network/interfaces and set " dns-nameservers 127.0.0.1" for the interface in question.
With DHCP (via Network Manager), your computer connects to the network, sends a broadcast asking for an IP address. The DHCP (dynamc host configuration protocal ) server replies with an IP address, default gateway, nameserver(s) and other network information.
Your goal to over-ride nameserver that your ISP sends you via DHCP
These steps should work on Debian Etch/Squeeze/Wheezy , but I've tested them only on Wheezey
# Install the DNS server sudo apt-get install bind9 # install the package that lets you tell Network Manager # what nameservers to use sudo apt-get install resolvconf
Add these lines to /etc/resolvconf/resolv.conf.d/head
# edit /etc/resolvconf/resolv.conf.d/* as appropriate # google's no cost , non-evil , free DNS server nameserver 220.127.116.11 # copy of bind running locally the cache # probably isn't as big as google's nameserver 127.0.0.1
Ignore the comment that tells you not to edit the file. The purpose is to tell you not to edit the generated /etc/resolv.conf file
If things don't work
- Revert to your backed-up copy of /etc/resolvconf/resolv.conf.d/head
- Consider DNSmasq
Use the Network Manager GUI to edit each individual connection, one-at-a-time-tediously
- Right click the icon
- Edit Conections
- Double click <your connection name>
- IPv4 settings
- Change "Automatic (DHCP)" to "Automatic (DHCP) address only"
- set DNS Servers to: '18.104.22.168 127.0.0.1'
Thanks to Thomas Hood for writing the resolvconf package