[CentOS] CentOS-6 dhcpd

Sat Jul 16 00:17:55 UTC 2011
Don Krause <dkrause at optivus.com>

On Jul 15, 2011, at 4:59 PM, Timothy Murphy wrote:

> Les Mikesell wrote:
> 
>>> But what puzzles me is, what defines the correspondence
>>> between interface and network,
>>> eg in my case eth1 ->  192.168.2.0/24
>>> 
>>> Surely this should be there independently of dhcpd ?
>> 
>> Dhcpd shouldn't care about the name of the interface, but if the request
>> hasn't been forwarded by a router/relay agent it needs to figure out the
>> subnet of the interface where the request is received so it uses the
>> corresponding range and options for the response.
> 
> I'm not sure what router/relay agent is supposed to forward the request.
> 
> In my case, I am trying to run dhcpd on my CentOS-6 server,
> but I get the message
> ------------------------------------
> alfred dhcpd: No subnet declaration for eth1 (no IPv4 addresses).
> alfred dhcpd: ** Ignoring requests on eth1.  If this is not what
> alfred dhcpd:    you want, please write a subnet declaration
> alfred dhcpd:    in your dhcpd.conf file for the network segment
> alfred dhcpd:    to which interface eth1 is attached. **
> alfred dhcpd:
> alfred dhcpd:
> alfred dhcpd: Not configured to listen on any interfaces!
> ------------------------------------
> 
> My /etc/dhcpd.conf reads (after removing comments and several hosts)
> -------------------------------------
> option domain-name "gayleard.com";
> option domain-name-servers 208.67.222.222, 208.67.220.220;
> 
> default-lease-time 600;
> max-lease-time 7200;
> 
> authoritative;
> 
> subnet 192.168.1.0 netmask 255.255.255.0 {
> }
> 
> subnet 192.168.2.0 netmask 255.255.255.0 {
> 
>        authoritative;
> 
>        option routers                  192.168.2.1;
>        option subnet-mask              255.255.255.0;
> 
>        option domain-name              "gayleard.com";
>        option domain-name-servers      208.67.222.222,208.67.220.220;
> 
>        range 192.168.2.100 192.168.2.250;
>        range dynamic-bootp 192.168.2.128 192.168.2.254;
> 
>        host alfred {
>                hardware 00:1B:21:AB:C9:4C;
>                fixed-address 192.168.2.2;
>        }
> 
>        host blanche {
>                hardware ethernet 00:1B:77:04:00:12;
>                fixed-address 192.168.2.7;
>        }
> 
>        host blanche-ether {
>                hardware ethernet 00:36:6B:35:26:8E;
>                fixed-address 192.168.2.27;
>        }
> 
>        host linksys {
>                hardware ethernet 00:16:B6:DA:56:B3;
>                fixed-address 192.168.2.1;
>        }
> 
> # several hosts omitted
> 
> }
> -------------------------------------
> 
> In /etc/sysconfig/network-scripts/ I have
> ifcfg-eth0
> -------------------------------------
> # Broadcom Corporation NetXtreme BCM5723 Gigabit Ethernet PCIe
> DEVICE=eth0
> HWADDR=3C:4A:92:77:B3:AE
> IPADDR=192.168.1.2
> GATEWAY=192.168.1.254
> NETMASK=255.255.255.0
> NM_CONTROLLED=no
> ONBOOT=yes
> BOOTPROTO=none
> USERCTL=no
> -------------------------------------
> ifcfg-eth1
> -------------------------------------
> # Intel Corporation 82574L Gigabit Network Connection
> DEVICE=eth1
> TYPE=Ethernet
> HWADDR=00:1B:21:AB:C9:4C
> IPADDR=192.168.2.2
> NETMASK=255.255.255.0
> GATEWAY=192.168.2.1
> NM_CONTROLLED=yes
> ONBOOT=yes
> BOOTPROTO=dhcp
> IPV6INIT=no
> USERCTL=yes
> -------------------------------------
> 
> eth0 is connected to a Billion modem/router
> and thence to the ethernet;
> eth1 is connected to a Linksys WRT54GL router.
> 
> If anyone can point out the error of my ways
> I should be most grateful.
> 
> 
> -- 
> Timothy Murphy  
> e-mail: gayleard /at/ eircom.net
> tel: +353-86-2336090, +353-1-2842366
> s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland


I believe you need to wrap your networks in a "shared network" statement.  My ISC dhcp server
has no problem issuing address to either nic, and aliased address are no problem either.

The relevant portion of my dhcpd.conf file:

shared-network opt {
        subnet 192.168.2.0 netmask 255.255.255.0 {
                option subnet-mask 255.255.255.0;
                option broadcast-address 192.168.2.255;
                option routers 192.168.2.150;
                option ntp-servers 192.168.2.150;
                ddns-updates-off;
                dynamic-bootp-lease-length 7200;
        }

        subnet 192.168.12.0 netmask 255.255.255.0 {
                option subnet-mask 255.255.255.0;
                option broadcast-address 192.168.12.255;
                option routers 192.168.12.1;
                option ntp-servers 192.168.12.1;
                ddns-updates-off;
                dynamic-bootp-lease-length 7200;
        }

        subnet 172.24.1.0 netmask 255.255.255.0 {
                option subnet-mask 255.255.255.0;
                option broadcast-address 172.24.1.255;
                option routers 172.24.1.1;
                option ntp-servers 143.197.200.121;
                ddns-updates-off;
                dynamic-bootp-lease-length 7200;
                #pool {
                #       range 172.24.1.75 172.24.1.99;
                #}
        }

        subnet 172.24.200.0 netmask 255.255.255.0 {
                option subnet-mask 255.255.255.0;
                option broadcast-address 172.24.200.255;
                option routers 172.24.200.1;
                option ntp-servers 143.197.200.121;
                option netbios-name-servers 143.197.200.216;
                ddns-updates-off;
                dynamic-bootp-lease-length 7200;
                pool {
                        range 172.24.200.10 172.24.200.250;
                }
        }

        subnet 172.24.143.0 netmask 255.255.255.0 {
                option subnet-mask 255.255.255.0;
                option broadcast-address 172.24.143.255;
                option routers 172.24.143.1;
                option ntp-servers 143.197.200.121;
                option netbios-name-servers 143.197.200.216;
                ddns-updates-off;
                dynamic-bootp-lease-length 7200;
	}

        subnet 172.24.145.0 netmask 255.255.255.0 {
                option subnet-mask 255.255.255.0;
                option broadcast-address 172.24.145.255;
                option routers 172.24.145.1;
                option ntp-servers 143.197.200.121;
                option netbios-name-servers 143.197.200.216;
                ddns-updates-off;
                dynamic-bootp-lease-length 7200;
                #pool {
                #       range 172.24.145.10 172.24.145.250;
                #}
        }
        
        subnet 172.24.0.0 netmask 255.255.255.0 {
                option subnet-mask 255.255.255.0;
                option broadcast-address 172.24.0.255;
                option routers 172.24.0.1;
                option ntp-servers 143.197.200.121;
                ddns-updates-off;
                dynamic-bootp-lease-length 7200;
        }
}

<-- sniped individual host assignments.. -->

As you can see, we only allocate address to unknown devices out of the 172.24.200/24 pool,
all other hosts/devices are assigned addresses out of the other subnets. 

The "opt" in the shared network line is just a name, can be anything. 

Take care!


--
Don Krause                                                                   
Head Systems Geek, 
Waver of Deceased Chickens.
Optivus Proton Therapy, Inc.
P.O. Box 608
Loma Linda, California 92354
909.799.8327 Tel
909.799.8366 Fax
dkrause at optivus.com
www.optivus.com
"This message represents the official view of the voices in my head."






-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4657 bytes
Desc: not available
URL: <http://lists.centos.org/pipermail/centos/attachments/20110715/03fb1222/attachment-0004.p7s>