ISC DHCP
This page explains how to install and use the ISC DHCP server.
- Also See: DHCP and BOOTP Parameters & DNSMasq
Installing the ISC DHCP Server
First you need to install the dhcp server
yum -y install dhcp
Basic DHCP Server Configuration
This is a vary basic configuration. The below configuration will allow 20 hosts to connect via the 192.168.1.0 network. They will receive a example.com hostname and be confiured to use the 192.168.1.1 gateway and nameserver(DNS).
- /etc/dhcpd.conf
allow bootp; allow booting; default-lease-time 1080000; # The wait time before a client will start to renew, in seconds max-lease-time 288000000; # The Maximum time a client can keep it's IP before it MUST renew, in seconds option subnet-mask 255.255.255.0; option broadcast-address 192.168.1.255; option routers 192.168.1.1; # This is your clients default gateway option domain-name-servers 192.168.1.1; # This is your clients DNS server option domain-name "example.com"; # This is your clients domain name ddns-update-style ad-hoc; option ip-forwarding off; option nntp-server time.nist.gov; subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.50 192.168.1.30; } # And here is the standard static IP system setup host Samantha { hardware ethernet 00:b0:d0:db:02:bd; fixed-address 192.168.1.2; }
Now lets make sure the dhcp demon is setup to auto start
/sbin/chkconfig dhcpd on
and to confirm it will start
/sbin/chkconfig --list dhcpd
If it is setup to start at boot you will see something like this:
dhcpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
And Start it
/sbin/service dhcpd start
Advanced DHCP Server Configuration
How-to Configuration
Network Configuration
- Gateway: 10.0.0.1
- Domain: local
Primary Server
- IP Address: 10.0.0.12
Secondary Server
- IP Address: 10.0.0.11
First you must create a ddns key by running the following command:
ddns-confgen
- /etc/dhcpd.conf
# dhcpd.conf ddns-update-style standard; # The type of DDNS update to send (standard) ddns-rev-domainname "in-addr.arpa."; # The Reverse domain name to update via DDNS deny client-updates; # Allow or Deny clients requesting DNS updates do-forward-updates on; # Enable DDNS updates update-optimization on; # Only update the DNS server when things change update-conflict-detection on; # Do multiple-client, one-name conflict detection update-static-leases on; # Send DDNS updates for static clients use-host-decl-names on; # Send DDNS updates only for the host part of a FQDN include "/etc/dhcp/dhcpd-failover.conf"; subnet 10.0.0.0 netmask 255.255.255.0 { default-lease-time 86400; # 1 day min-lease-time 43200; # 12 hours max-lease-time 259200; # 3 days option domain-name "local"; # The Network's Local Domain Name option routers 10.0.0.1; # The Network's Default Gateway option ntp-servers 10.0.0.12; # The Network's Network Time Servers option domain-name-servers 10.0.0.2, 10.0.0.12; # The Network's DNS Servers option broadcast-address 10.0.0.255; # The Network's broadcast address option netbios-name-servers 10.0.0.12; # The Network's WINS Server
pool { failover peer "Media"; range 10.0.0.51 10.0.0.250; } } include "/etc/dhcp/dhcpd-static.conf"; include "/etc/dhcp/dhcpd-ddns.conf";
- /etc/dhcpd-failover.conf (on primary server)
# If this DHCP server is the official DHCP server for the local # network, the authoritative directive should be uncommented. authoritative; failover peer "Media" { primary; address 10.0.0.12; peer address 10.0.0.11; max-response-delay 60; max-unacked-updates 10; mclt 900; split 128; load balance max seconds 3; }
- /etc/dhcpd-ddns.conf (on primary server)
key "ddns-key" { algorithm hmac-sha256; secret "w4vOHY6roUCIB5Y/BwNrRkNQ2BF3jQNOs23Etfr5mD0="; }; zone local. { # name of your forward DNS zone primary 127.0.0.1; # DNS server IP address here secondary 10.0.0.11; key ddns-key; } zone 0.0.10.in-addr.arpa. { # name of your reverse DNS zone primary 127.0.0.1; # DNS server IP address here secondary 10.0.0.11; key ddns-key; }