DHCP - samuelGreitzer/SYS255-tech-journal GitHub Wiki

Config File

The DHCP config file will be installed to /etc/dhcp/dhcpd.conf

in this file you must declare the subnet the DHCP will work on, followed by some curly brackets

ex:

subnet x.x.x.x netmask x.x.x.x{

}

Within the curly brackets you can specify the various conditions and specification of the DHCP configuration such as, range of ip addresses, the gateway and dns server in the style of c++

Assign IP range:

range x.x.x.x x.x.x.x;

Assign Subnet Mask:

option subnet-mask x.x.x.x;

Assign router:

option routers x.x.x.x;

Assign domain:

option domain-name "example.domain";

assign DNS:

option domain-name-servers x.x.x.x; option domain-name-servers example.dns.server;

Specify lease time:

default-lease-time x; (seconds) max-lease-time x; (seconds)

Firewall

Remember to allow DHCP through the default firewall using this command

firewall-cmd --add-service=dhcp --permanent

and don't forget to reload the firewall

User config

Remember to go to the IPv4 settings on your client box and select the "obtain an IP address automatically" and "Obtain DNS server automatically"

Then open a terminal and run "ipconfig /release" to clear its existing IP address and then run "ipconfig /renew" and your PC will query the DHCP server for a new IP