Lab 04: DHCP - devinziegler/Devin-Tech-Journal GitHub Wiki
Assignment: DHCP
Objectives: Install and configure DHCP service on CENTOS.
To use SSH open a terminal and type the following command:
ssh <user_name@hostname
PuTTY can be downloaded here: chiark.greenend.org.uk
PuTTY is pretty straight forward and the setup is similar to the ssh command listed above. Instead of putting the username in, all you need is a the system hostname.
The following command will install the DHCP package:
yum install dhcpd -y
Becoming the system user for a brief time using the following command:
sudo -i
This is helpful when you are doing work that requires elevated privileges for a long period of time. Don't forget to exit
when finished.
- This is the path to the target config:
/etc/dhcp/dhcpd.conf
- The following information is required in dhcpd.conf
subnet <network_address> netmask <netmask> {
option routers <default_gateway
option subnet-mask <subnet_mask>
option domain-name <domain_name>
range <first_usable> <last_usable>
}
Lease time can be added to the config as well:
default-lease-time <timeinseconds>
max-lease-time <timeinseconds>
Start the service:
systemctl start dhcpd
View DHCP service status:
systemctl status dhcpd
Start service on boot:
systemctl enable dhcpd
list default firewall rules:
firewall-cmd --list-all
Add DHCP service to the firewall rules:
fiewall-cmd --add-service-dhcp --permanent
command output should be success.
- Configure workstation so it uses DHCP.
- These options can be added to the dhcpd.conf file and allow for some cool features.
In order to reserve an IP address the host hardware address is needed.
The following changes can be made to dhcpd.conf
:
host <host_name> {
hardware ethernet <host_mac>;
fixed-address <address_to_reserve>;
}
Looking at the changes in Wireshark, something interesting is happening. When the host IP is released, the same one is requested. Dhcp01 however, knows that another address is reserved for that workstation. The DHCP server offers the new IP THREE times before the workstation finally accepts the new IP address.
In all packets of the DHCP process captured, there is client hardware address padding in the DHCP header.
The purpose of this padding is to insure proper alignment in the data fields.
In every DHCP packet there are options that determine what it is. For example this is a discover
packet with the corresponding option of 53
:
A source to find out other options can be found here