Russ Bateman
2 May 2013
last update:
This is very tentative and unfinished; it's mostly research right now.
You may be looking for this post:
Failure to ping outside of LAN, ping google.com.
First, discover your existing DNS service by it primary and secondary IP addresses:
root@af-blackpearl:/etc/bind# cat /etc/resolv.conf domain americas.hpqcorp.net search americas.hpqcorp.net nameserver 16.110.135.51 <---------- primary DNS server nameserver 16.110.135.52 <---------- secondary DNS server
Assume all commands here from root...
$ apt-get install bind9 dnsutils
127.0.0.1 af-blackpearl.site localhost.localdomain localhost 16.86.192.110 af-blackpearl.example.com af-blackpearl
$ vim /etc/bind/named.conf.options forwarders { 16.110.135.51 16.110.135.52 };
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 #iface eth0 inet dhcp (originally DHCP; we want static IP now...) iface eth0 inet static address 16.86.192.110 netmask 255.255.255.0 network 16.86.192.0 broadcast 16.86.192.255 gateway 16.86.192.1 dns-nameservers 127.0.1 dns-search example.com dns-domain example.com # Use this address for our Tomcat ReST URIs! #auto eth0:0 #iface eth0:0 inet static # address 16.86.192.119 # netmask 255.255.255.0
zone "example.com" IN { type master; file "/etc/bin/zones/example.com.db"; }
zone "192.86.16.in-addr.arpa" { type master; file "/etc/bind/zones/rev.192.86.16.in-addr.arpa"; };
$ mkdir /etc/bind/zones
$ cd zones $ vim example.com.db ; Use semicolons to add comments. ; Host-to-IP Address DNS Pointers for example.com ; Note: The extra dots at the end of the domain names are important. ; The following parameters set when DNS records will expire, etc. ; The serial number must always increase to prevent undesirable ; consequences. A good format to use is YYYYMMDDII where the II index ; is in case you make more than one change on the same day. $ORIGIN . $TTL 86400 ; 1 day example.com. IN SOA ubuntu.example.com. hostmaster.example.com. ( 2008080901 ; serial 8H ; refresh 4H ; retry 4W ; expire 1D ; minimum ) ; NS indicates that Ubuntu is the name server on example.com ; MX indicates that Ubuntu is (also) the mail server on example.com example.com. IN NS ubuntu.example.com. example.com. IN MX 10 ubuntu.example.com. $ORIGIN example.com. ; Set the address for localhost.example.com localhost IN A 127.0.0.1 ; Set the hostnames in alphabetical order print-srv IN A 16.86.192.9 router IN A 16.86.192.1 server IN A 16.86.192.5 ubuntu IN A 16.86.192.2 xbox IN A 16.86.192.3
; IP Address-to-Host DNS Pointers for the 16.86.192 subnet @ IN SOA ubuntu.example.com. hostmaster.example.com. ( 2008080901 ; serial 8H ; refresh 4H ; retry 4W ; expire 1D ; minimum ) ; define the authoritative name server IN NS ubuntu.example.com. ; our hosts, in numeric order 1 IN PTR router.example.com. 2 IN PTR ubuntu.example.com. 3 IN PTR xbox.example.com. 5 IN PTR server.example.com. 9 IN PTR print-srv.example.com.
$ service bind9 restart - or - $ /etc/init.d/bind9 restart
$ nohup sh -c "ifdown eth0 && ifup etch0"
--this has been deprecated if you're using DHCP. See http://lani78.wordpress.com/2012/07/19/change-to-static-ip-on-the-ubuntu-precise-pangolin-server/
search example.com nameserver 16.86.192.110
instead of it continuing to use what's been (before setting up local DNS).
Warning: Most *nicies have changed how /etc/resolv.conf works! Please see here.
$ host ping.sunet.se
The response should be
ping.sunet.se has address 16.86.192.18 ping.sunet.se has IPv6 address blah:blah:blah::blah$ host -l example.com example.com name server ubuntu.example.com. localhost.example.com has address 127.0.0.1 print-srv.example.com has address 192.168.0.9 router.example.com has address 192.168.0.1 server.example.com has address 192.168.0.5 ubuntu.example.com has address 192.168.0.2 xbox.example.com has address 192.168.0.3
$ host 16.86.192.1 1.192.86.16.in-addr.arpa domain name pointer ubuntu.example.com.
Last, a firewall is needed if this is being done behind a router at home to keep from exposing your network. Port 53 nust not be forwarded to your DNS server!