DHCP - Foren-Ken/tech-journal GitHub Wiki
On Rocky Linux, the following steps can be taken:
yum install dhcp-server
to install DHCPnano /etc/dhcp/dhcp.conf
to modify the DHCP config. The following can be utilized:
subnet XXX.XXX.XXX.XXX netmask XXX.XXX.XXX.XXX {
option routers XXX.XXX.XXX.XXX ;
option subnet-mask XXX.XXX.XXX.XXX ;
option domain-name "domain-suffix";
option domain-name-servers XXX.XXX.XXX.XXX ;
range XXX.XXX.XXX.XXX XXX.XXX.XXX.XXX ;
default-lease-time time-in-seconds;
max-lease-time time-in-seconds;
}
- systemctl start dhcpd
- systemctl enable dhcpd
- firewall-cmd --add-service=dhcp --permanent
- firewall-cmd --reload
- firewall-cmd --list-all
This should provide a user with a working DHCP server.
THREE DHCP ITEMS:
- Rogue DHCP. Rogue DHCP servers are those which are unauthorized and provide misconfiguration IP addresses. This causes issues on a network since it can cause a DOS attack, caused by hosts being unable to obtain a correct IP address to use.
- DHCP Starvation Attack. This attack works by sending fake DISCOVER packets to a DHCP server to use up all the IP addresses it's able to provide. This can be used to set up a man-in-the-middle attack.
- DHCP Snooping. DHCP Snooping allows a router or switch to monitor DHCP messages from devices to the switching device. This allows the switching device to block/drop malicious or unauthorized DHCP servers from distributing IP addresses.
Releasing/Renewing DHCP Lease:
-
When releasing a lease "ipconfig /release" a "Release" packet is sent to the DHCP server to notify it that no longer needs the IP address.
-
When requesting a lease, the client will broadcast a DHCP "Discover" packet "ipconfig /renew". This will hopefully find a DHCP server.
-
When a DHCP server recieves this message, it will send an "Offer" packet to show the client what kind of lease it can get.
-
The client will then send a "Request" out as a broadcast, this confirms that it chose a lease.
-
The DHCP server sends an "Acknowledgment" signifying that it understands the client will use the lease.