Sunday, August 31, 2014

dns server in ubuntu

I need a simple DNS server to work around my experiment. Here is my steps to build a dns server in ubuntu.

1. apt-get install bind9

2. update /etc/bind/named.conf.options
        forwarders {
                8.8.8.8;
        };

        dnssec-enable no;
        //dnssec-validation auto;

       // listen-on-v6 { any; };

3. /etc/init.d/bind9 restart

When encounter the error like,
named[4597]: error (network unreachable) resolving './NS/IN': 2001:dc3::35#53
It seems like the ipv6 address cannot be reachable, so just disable ipv6 setting.

named[4597]: error (no valid RRSIG) resolving 'gov/DS/IN': 192.203.230.10#53
disable dnssec to workaround this error.

Reference:
http://ubuntuforums.org/showthread.php?t=1984950

Sunday, August 17, 2014

apt command list

I used apt command very extensively.

# it is like sync the database
apt-get update

# it is like do the whole system upgrade
apt-get dist-upgrade

# search the database with the keyword
apt-cache search keyword

# show the keyword status, like version, description
apt-cache show keyword

# install the keyword
apt-get install keyword

# list the related file system path with the keyword.
dpkg -L keyword

DHCP daemon in ubuntu

1. bind a static ip for the interface, for example eth1
in /etc/network/interfaces

# 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
#allow-hotplug eth0
auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
address 169.254.1.2
netmask 255.255.255.0

2. install isc-dhcp-server
 apt-get install isc-dhcp-server

3. in /etc/default/isc-dhcp-server
  INTERFACES="eth1"

4. in /etc/dhcp/dhcpd.conf
 subnet 169.254.1.0 netmask 255.255.255.0 {
   range 169.254.1.3 169.254.1.254;
   option routers 169.254.1.2;
   option domain-name-servers 169.254.1.2;
 }

or

 subnet 169.254.1.0 netmask 255.255.255.0 {
   range 169.254.1.1 169.254.1.254;
   option routers 169.254.1.120;
   option domain-name-servers 169.254.1.120;
 }

5. restart the service by the following steps
 ifdown eth1
 ifup eth1
 killall dhclient

6. if the steps cannot work, just reboot.

Reference:
http://askubuntu.com/questions/4826/switching-a-server-to-static-ip-from-dhcp