Enable DHCP/DNS Server For SpaceWalker Server

TurnToJPG -->

DHCP Server

Install the dhcp server via:

# yum install -y dhcp

Then edit the configuration of /etc/dhcp/dhcpd.conf, like following:

# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#   see dhcpd.conf(5) man page
# specify name server's hostname or IP address
option domain-name-servers;
# default lease time
default-lease-time 600;
# max lease time
max-lease-time 7200;
# this DHCP server to be declared valid
# specify network address and subnet mask
subnet netmask {
    # specify the range of lease IP address
    range dynamic-bootp;
    # specify broadcast address
    option broadcast-address;
    # specify default gateway
    option routers;
    # Specify default dns server
    option domain-name-servers;

Start the dhcpd server via:

# service dhcpd start

DNS Server(Bind9)

Just serve the private network. Install the bind9 via:

# yum install -y bind bind-utils

Our server’s name is spacewalker, need to map to, following is the configuration steps:
Edit the file of /etc/named.conf.

Change the listen address of port 53:

options {
        listen-on port 53 {;; };
#        listen-on-v6 port 53 { ::1; };

Also add the allow-query items, to let the local network nodes for querying its dns:

 allow-query     { localhost;;};

Add a new zone named spacewalker:

zone "spacewalker" {
        type master;
        file "/etc/named/zones/db.spacewalker";

Now add the zone definition file:

# vim /etc/named/zones/db.spacewalker
$TTL 604800
@       IN      SOA     spacewalker. root.spacewalker. (
                                3               ;Serial
                                604800          ;Refresh
                                86400           ;Retry
                                2419200         ;Expire
                                604800 )        ;Negative Cache TTL
; name servers - NS records
      IN      NS      spacewalker.

; name servers  - A records
spacewalker.         IN      A

Check the configuration file format:

# sudo named-checkconf
# sudo named-checkzone spacewalker /etc/named/zones/db.spacewalker 
zone spacewalker/IN: loaded serial 3

Start bind9 service via:

# systemctl start named

If in CentOS6, then the steps may like following:

[root@spacewalk named]# service named start
Generating /etc/rndc.key:                                  [  OK  ]
Starting named:                                            [  OK  ]
[root@spacewalk named]# chkconfig --level 345 named on
[root@spacewalk named]# chkconfig --list named
named           0:off   1:off   2:off   3:on    4:on    5:on    6:off

You could verify the correctness by startup a live-cd and view its ping result of ping spacewalker.