DHCP - Foren-Ken/tech-journal GitHub Wiki

On Rocky Linux, the following steps can be taken:

  1. yum install dhcp-server to install DHCP
  2. nano /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; }

  1. systemctl start dhcpd
  2. systemctl enable dhcpd
  3. firewall-cmd --add-service=dhcp --permanent
  4. firewall-cmd --reload
  5. firewall-cmd --list-all

This should provide a user with a working DHCP server.

THREE DHCP ITEMS:

  1. 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.
  2. 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.
  3. 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:

  1. 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.

  2. When requesting a lease, the client will broadcast a DHCP "Discover" packet "ipconfig /renew". This will hopefully find a DHCP server.

  3. When a DHCP server recieves this message, it will send an "Offer" packet to show the client what kind of lease it can get.

  4. The client will then send a "Request" out as a broadcast, this confirms that it chose a lease.

  5. The DHCP server sends an "Acknowledgment" signifying that it understands the client will use the lease.