DHCP - samuel-richardson/Sam-Tech-Journal GitHub Wiki

Setting up DHCP server

Configure DHCP

  • Install dhcp with yum install dhcp
  • Edit the /etc/dhcp/dhcpd.conf file.
  • Add

subnet 10.0.5.0 netmask 255.255.255.0 {

    `option routers 10.0.5.2;`

    `option subnet-mask 255.255.255.0;`

    `option domain-name "samuel.local";`

    `option domain-name-server 10.0.5.5;`

    `range 10.0.5.100 10.0.5.150;`

}

  • Additional Options for lease Default-lease-time 3600; Max-lease-time 14400;

  • Start dhcp with systemctl start dhcpd

  • Check if it's running.

  • Enable the service to start on boot with systemctl enable dhcpd

Configure Firewall

  • View firewall services with firewall-cmd --list-all
  • Add dhcp to firewall with firewall-cmd --add-service=dhcp --permanent
  • Reload firewall firewall-cmd --reload

workstation changes

  • Configure adapter to use DHCP over ipv4.

Additional Notes

  • Lease times are useful in preventing too many ips from being used up on larger networks. The lease time will free up ips that are being used after a certain amount of time.
  • In the case of DHCP the server broadcasts a DHCPACK packet to find offer on IP lease. The client responds to the offer packet by broadcasting a request packet to accept the offer. Lastly, the client responds with a ack or nack packet to determine in the IP has been assigned.
  • DHCP runs on UDP port 67. This port assigns IP addresses and other network information to DHCP clients. The clients listen for responses from DHCP on port 68. When filtering by port 67 only packets sent by the server are seen.