DHCP on EL7

From AN!Wiki
Jump to: navigation, search

 AN!Wiki :: How To :: DHCP on EL7

Start, as always, by creating a backup.

mkdir /etc/dhcp/backups
cp /etc/dhcp/dhcpd.conf /etc/dhcp/backups/

Edit the dhcpd.conf file. Remove the default comments at the top and then configure it for your environment.

vim /etc/dhcp/dhcpd.conf
### Global options
# General domain information
option domain-name "alteeve.com";
option domain-name-servers 8.8.8.8, 8.8.4.4;
 
# Tell the server that it's authoritative on our network.
authoritative;
 
# This is required for EL5 operating systems but is optional on EL6 and newer
# Fedoras (F13+, at least). It controls how dynamic DNS updating is handled. In
# our case, we aren't concerned about DDNS so we'll set it to 'none'.
ddns-update-style none;
 
### Subnet options
subnet 10.200.0.0 netmask 255.255.0.0 {
	# This is the DHCP server, but not the actual Internet gateway. So this
	# Argument points our clients to the right box.
	option routers 10.200.255.254;
 
	# Set our range. This can be whatever you want so long as it fits in
	# your netmask.
        range 10.200.1.10 10.200.1.250;
 
	# If clients don't ask, make the lease available for the following
	# number of seconds. If the client does ask, allow up to this number of
	# seconds. 86,400s = 24h.
	default-lease-time 86400;
	max-lease-time 86400;
}

Start and enable the dhcp server.

systemctl start dhcpd.service
systemctl enable dhcpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/dhcpd.service to /usr/lib/systemd/system/dhcpd.service.

Make sure it started OK:

systemctl status dhcpd.service
● dhcpd.service - DHCPv4 Server Daemon
   Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2016-07-02 04:14:17 EDT; 36s ago
     Docs: man:dhcpd(8)
           man:dhcpd.conf(5)
 Main PID: 1922 (dhcpd)
   Status: "Dispatching packets..."
   CGroup: /system.slice/dhcpd.service
           └─1922 /usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid
 
Jul 02 04:14:17 an-fw05.alteeve.com dhcpd[1922]: Sending on   LPF/lan0/00:90:fb:4d:3b:a1/10.200.0.0/16
Jul 02 04:14:17 an-fw05.alteeve.com dhcpd[1922]: 
Jul 02 04:14:17 an-fw05.alteeve.com dhcpd[1922]: No subnet declaration for wan0 (10.255.1.105).
Jul 02 04:14:17 an-fw05.alteeve.com dhcpd[1922]: ** Ignoring requests on wan0.  If this is not what
Jul 02 04:14:17 an-fw05.alteeve.com dhcpd[1922]:    you want, please write a subnet declaration
Jul 02 04:14:17 an-fw05.alteeve.com dhcpd[1922]:    in your dhcpd.conf file for the network segment
Jul 02 04:14:17 an-fw05.alteeve.com dhcpd[1922]:    to which interface wan0 is attached. **
Jul 02 04:14:17 an-fw05.alteeve.com dhcpd[1922]: 
Jul 02 04:14:17 an-fw05.alteeve.com dhcpd[1922]: Sending on   Socket/fallback/fallback-net
Jul 02 04:14:17 an-fw05.alteeve.com systemd[1]: Started DHCPv4 Server Daemon.

Don't worry about that error. We only want the DHCP server listening for requests on lan0. We can verify that it is by checking syslog;

journalctl -n 100 |grep lan0
Jul 02 04:14:17 an-fw05.alteeve.com dhcpd[1922]: Listening on LPF/lan0/00:90:fb:4d:3b:a1/10.200.0.0/16
Jul 02 04:14:17 an-fw05.alteeve.com dhcpd[1922]: Sending on   LPF/lan0/00:90:fb:4d:3b:a1/10.200.0.0/16

Done! That was easy.

 

Any questions, feedback, advice, complaints or meanderings are welcome.
Us: Alteeve's Niche! Support: Mailing List IRC: #clusterlabs on Freenode   © Alteeve's Niche! Inc. 1997-2019
legal stuff: All info is provided "As-Is". Do not use anything here unless you are willing and able to take responsibility for your own actions.
Personal tools
Namespaces

Variants
Actions
Navigation
projects
Toolbox