Flylib.com

Books Software

 
 
 

3.13 DHCP server configuration

 <  Day Day Up  >  

3.13 DHCP server configuration

Dynamic Host Configuration Protocol (DHCP) can be used for automatically assigning IP addresses and other information to the hosts in the network. The configuration contains only one file. However, starting the dhcpd server in the enterprise network with one dhcpd server already running can result in some confusion or damage if the clients configured to use dhcp suddenly receive other addresses.

So be sure to have your server in a separate network, or use statical IP configuration for all nodes and servers that you do not want to serve. Clients usually take the first address offer they get, and often it is the wrong one.

Example 3-25. /etc/dhcpd.conf
not authoritative;

ddns-update-style ad-hoc;

default-lease-time 60000;

max-lease-time 720000;



option myoption code 129 = text ;

# dynamically assigned adress range

# every client can get one



subnet 192.168.100.0 netmask 255.255.255.0 {

range 192.168.100.211 192.168.100.212;

option routers 192.168.100.60;

option nameservers 192.168.100.110;

option domain residency.local;



# statically assigned adresses, only clients

# with designated MAC adress will get it

group {

        next-server 192.168.100.110;



       host lpar1 {

             fixed-address 192.168.100.77;

             hardware ethernet 00:02:55:3A:06:8C;

            filename "install";

       }

       host lpar2 {

             fixed-address 192.168.100.78;

             hardware ethernet 00:02:55:6f:1f:e3;

            filename "yaboot";

            option root-path "/tftpboot/";

}



       host lpar3 {

            fixed-address 192.168.100.79;

            hardware ethernet 00:02:55:3a:06:19;

           filename "yaboot";

       }

}

}

After editing /etc/dhcpd.conf, we start our dhcpd server:

# /etc/init.d/dhcpd start

Check /var/log/messages:

Example 3-26. /ect/var/log/messages excerpt:
....

dhcpd: Internet Software Consortium DHCP Server V3.0.1rc9

Oct 22 15:40:50 p630sles dhcpd: Copyright 1995-2001 Internet Software

Consortium.

Oct 22 15:40:50 p630sles dhcpd: All rights reserved.

Oct 22 15:40:50 p630sles dhcpd: For info, please visit

http://www.isc.org/products/DHCP

Oct 22 15:40:50 p630sles dhcpd: Wrote 0 deleted host decls to leases file.

Oct 22 15:40:50 p630sles dhcpd: Wrote 0 new dynamic host decls to leases file.

Oct 22 15:40:50 p630sles dhcpd: Wrote 0 leases to leases file.

Oct 22 15:40:50 p630sles dhcpd: Listening on LPF/eth0/00:02:55:4f:60:8a/CSM

Oct 22 15:40:50 p630sles dhcpd: Sending on   LPF/eth0/00:02:55:4f:60:8a/CSM

Oct 22 15:40:50 p630sles dhcpd: Sending on   Socket/fallback/fallback-net

....

If you have left the dynamically assigned address range in the dhcpd.conf file, then every client configured to be a dhcpd client will get an address from this range. For network installations or network boot, we strongly recommend that you use statically assigned addresses in order to prevent installing servers or clients you do not intend.

 <  Day Day Up  >  
 <  Day Day Up  >  

3.14 DNS server configuration

As a starting point we use the default caching only nameserver configuration provided by SuSE. The caching only name server forwards requests to other nameservers provided by keyword forwarders and caches the answers for better performance. This configuration is good enough if you only need to resolve names and addresses in the Internet.

In order to use local name resolution too, we add two new zone records: residency.local (name to IP address), and 100.168.192.rev for reverse name resolution (IP address to name). For debugging, we add the logging section because it forces the name server daemon to log all requests in /var/log/messages. [18]

[18] For more information see BIND 9 Administrator Reference Manual : http://www.bind9.net/Bv9ARM.html

Example 3-27. /etc/named.conf
options {

directory "/var/named";

        forwarders {

                9.12.6.7;

                };

listen-on { any;};

notify no;

        forward first;

};



zone "localhost" in {

        type master;

        file "localhost.zone";

};



zone "0.0.127.in-addr.arpa" in {

        type master;

        file "127.0.0.zone";

};



zone "." in {

type hint;

        file "root.hint";

};



# You can insert further zone records for your own domains below.





logging {

        category queries {

                default_syslog;

                };

        category update {

                default_syslog;

                };

        };

zone "residency.local" {

        type master;

        file "/var/named/residency.local.hosts";

        };



zone "100.168.192.in-addr.arpa" {

type master;

        file "/var/named/100.168.192.rev";

        };

Now we create our own local zone files: residency.local, and for reverse lookup, 100.168.192.rev. We need a residency.local file in order to be able to resolve names to IP addresses.

Example 3-28. /var/named/residency.local
$ttl 38400 residency.local.   IN    SOA     192.168.100.110. root.p630sles. (

                        0310221736    ; serial

                        10800         ; refresh

                        3600          ; retry

                        604800        ; expiry

                        38400 )       ; minimum



residency.local.        IN      NS      192.168.100.81

$GENERATE 111-254      node-$   A       192.168.100.$

lpar8.residency.local.  IN      A       192.168.100.84

lpar7.residency.local.  IN      A       192.168.100.83

lpar6.residency.local.  IN      A       192.168.100.82

lpar5.residency.local.  IN      A       192.168.100.81

lpar4.residency.local.  IN      A       192.168.100.80

lpar3.residency.local.  IN      A       192.168.100.79

lpar2.residency.local.  IN      A       192.168.100.78

lpar1.residency.local.  IN      A       192.168.100.77

p630sles.residency.local.       IN      A       192.168.100.110

Important

Every time you change something in the zone file, you need to change the serial number in the second line.


In order to resolve addresses to names, we need a file for reverse name resolution. In this file, addresses are written in opposite order: 77.100.168.192, instead of 192.168.100.77.

Example 3-29. /var/named/100.168.192.rev
$ttl 38400100.168.192.in-addr.arpa.  IN    SOA    p630sles. root.p630sles. (

                        9998899999

                        10800

                        3600

                        604800

                        38400 )



100.168.192.in-addr.arpa.       IN      NS      p630sles



77.100.168.192.in-addr.arpa.    IN      PTR     lpar1.

78.100.168.192.in-addr.arpa.    IN      PTR     lpar2.

79.100.168.192.in-addr.arpa.    IN      PTR     lpar3.

80.100.168.192.in-addr.arpa.    IN      PTR     lpar4.

81.100.168.192.in-addr.arpa.    IN      PTR     lpar5.

82.100.168.192.in-addr.arpa.    IN      PTR     lpar6.

83.100.168.192.in-addr.arpa.    IN      PTR     lpar7.

84.100.168.192.in-addr.arpa.    IN      PTR     lpar8.

110.100.168.192.in-addr.arpa.   IN      PTR     p630sles.

$GENERATE 111-254 $            PTR     node-$

.

Tip

The trick in both zone files is in the line starting with $GENERATE: it will assign all nodes above 111 names; that is, node-111, node-112 and so on. This is a useful feature in combination with a dhcpd server for a larger environment or cluster, because you do not need to add nodes one by one anymore.


 <  Day Day Up  >