Lab 04 ‐ DHCP - AidanP017/Aidan-SYS-255 GitHub Wiki

Overview

In this lab, we used our DHCP01 virtual machines to install and configure a Linux DHCP service.

How to Connect to DHCP01 Using PuTTY

To connect to DHCP01 using PuTTY, take the following steps:

  • Open PuTTY.
  • Enter the hostname or IP address of the DHCP01 virtual machine.
    • Make sure the port is specified as 22.
  • Specify the connection type as SSH.
  • Click on "Open".
  • Log in with your DHCP01 username and password.

You should now have access to DHCP01 using PuTTY.

How to Use Vim in DHCP01

Vim is one of several Linux text editors used to edit scripts and other files of information. To use Vim in DHCP01, take the following steps:

  • Type vi followed by the directory and/or the file within it that you would like to edit. The file will then open up in the Vim editor within DHCP01.
  • Press i to insert text.
  • When you are ready to save your changes, press the Esc key and type either :w (saves the file) or :wq (saves the file and exits Vim).

How to Start and Monitor DHCP Services in DHCP01

To start and monitor DHCP Services in DHCP01, take the following steps:

  • Enter the command systemctl start dhcpd to enable DHCP.
    • Enter your password for administrative permission.
  • Enter the command systemctl status dhcpd to view the status of DHCP. It should now say that it is active and running.

In addition, to enable DHCP to start at boot, enter the command systemctl enable dhcpd. This is important to execute so that way the DHCP Service will always start upon boot.

How to Configure the Firewall to Allow Incoming DHCP Requests in DHCP01

To configure the firewall to allow incoming DHCP requests in DHCP01, take the following steps:

  • Gain elevated privileges using the sudo -i command.
  • Enter the command firewall-cmd --list-all.
  • Enter the command firewall-cmd --add-service=dhcp --permanent to permanently add the ports associated with DHCP.
  • Enter the command firewall-cmd --reload to invoke the above change.
  • Re-enter the command firewall-cmd --list-all and you should see "dhcp" next to "services".

How to Release and Renew your Current DHCP

To release and renew your current DHCP, take the following steps:

  • Open Windows Powershell.
  • Enter the command ipconfig /release. This will release your IP configurations.
  • Enter the command ipconfig /renew. This will renew your IP configurations.
  • By entering the command ipconfig /all, you can view your updated IP configurations.

How to Change the Default Lease Time for DHCP Clients

To change the default lease time for DHCP clients, take the following steps:

  • In DHCP01, open the configuration file for DHCP.
    • vi /etc/dhcp/dhcpd.conf
  • Below the IP range, enter the following:
    • default-lease-time "time in seconds";
    • max-lease-time "time in seconds";
  • Press the esc key and type :wq! to leave the text editor and save these changes.
  • For added measure, in WKS01, open Windows Powershell.
  • Enter the command ipconfig /release | ipconfig /renew.
  • Open Windows Command Prompt.
  • Enter the command ipconfig /all | findstr /R "Gateway". This will give you the IP address of your router's default gateway.
  • Open up a web browser and type the IP address into the search bar.
  • Enter the administrator credentials for your router and sign in.
  • Click on the three horizontal lines at the top right of the page.
  • In the Services tab, click on "DCHP Server".
  • Scroll down to "Other Options".
  • Where it says "Default lease time", change the lease time to whatever you desire.
  • Scroll down and click Save.
  • Click on the three horizontal lines again and select Diagnostics, then select Reboot.
  • Click Submit.
  • After the router reboots, open Windows Command Prompt and type telnet "your router's IP".
  • Once the computer has fully restarted, open Windows Command Prompt and type ipconfig /all. You should now see the updated lease time in the results.