Lab 1.8 DHCP-Server

 Lab 1.8 Dhcp-Server

Name: Yunita Prima Rizka

Class: XI TKJ A


Objectives:

  1. Perform the installation of Debian on a virtual machine using the required resources, allocating a 20 GB storage disk and 2 GB of memory.
  2. Set up two types of network connections: one configured in bridged mode for external internet access, and another in host-only mode to simulate a private network.
  3. Install and adjust the DHCP server service on Debian so it can hand out IP addresses automatically to connected clients.
  4. Test the DHCP server functionality by connecting a client through the host-only network and confirming it receives an IP address.
  5. Build practical skills in Linux server management, with an emphasis on handling network configuration and DHCP operations.
Tools & Materials:
  1. Laptop
    The laptop functions as the main host machine that provides the physical resources needed to run the virtual machines. It supplies the processor, memory (RAM), and storage capacity required during the installation of Debian and Windows operating systems. Without a laptop as the host, it would not be possible to simulate a real server-client environment. In this project, the laptop ensures that both the server (Debian) and client (Windows 7) can run simultaneously, supporting the learning objective of practicing DHCP configuration in a virtualized setup.
  2. VirtualBox

    VirtualBox is the virtualization software used to create, configure, and run multiple virtual machines on the laptop. It allows Debian to be installed as a server operating system and Windows 7 to be installed as a client operating system, all within the same host machine. VirtualBox provides options for different types of network adapters, such as bridged for internet access and host-only for internal communication. These settings directly support the objective of configuring two network interfaces on Debian and testing DHCP services with a client machine.
    3. File ISO Debian 12
The Debian 12 ISO file is the installation media that contains the Debian GNU/Linux operating system. This ISO is mounted on VirtualBox to install Debian inside the virtual machine. Debian is chosen because it is a stable and widely used Linux distribution for server administration tasks. In this module, Debian serves as the DHCP server, and the ISO provides all the necessary tools and packages to configure network services. Using Debian aligns with the objective of gaining hands-on experience in Linux server administration, specifically in managing network interfaces and DHCP.
    

   4. Windows 7 ISO File
The Windows 7 ISO file is used to install a client operating system inside another virtual machine. This client VM acts as a test device to verify whether the DHCP server running on Debian can assign IP addresses dynamically. The presence of the Windows 7 client ensures that the DHCP configuration is not only theoretical but also practically tested in a simulated client-server environment. This directly supports the objective of verifying the DHCP server by connecting a client through the host-only adapter.

    5. PuTTY
PuTTY is a terminal emulator and SSH client that allows remote access to the Debian server from the laptop. Instead of managing Debian only through the VirtualBox console, PuTTY enables users to log in remotely and execute configuration commands more flexibly. This tool simplifies the process of editing files, restarting services, and monitoring logs, which are crucial when setting up the DHCP server. The use of PuTTY supports the objective of practicing real-world server administration techniques. 

    6. Control Panel

The Control Panel in the Windows 7 client is essential for verifying the results of the DHCP server configuration. Through the Control Panel, specifically the Network and Sharing Center, the network adapter can be set to obtain an IP address automatically. Once connected to the host-only network, the client can be checked to confirm whether it has received an IP address from the Debian DHCP server. This step ensures that the objective of validating the DHCP functionality is achieved.
  7. Internet Connection
A stable internet connection is necessary when installing and setting up Debian. Its primary role is to enable access to online repositories, allowing the system to fetch and install the DHCP server package, update essential components, and apply the latest security patches to keep the server reliable and secure.

Topology:

In this DHCP server setup, the network topology is constructed within Oracle VirtualBox. The goal of this configuration is to emulate a real network environment, where the server is responsible for distributing IP addresses automatically to client machines. The host operating system plays the role of the main platform, running VirtualBox and connecting to the internet via Wi-Fi or LAN. It also allocates system resources such as CPU, memory, and storage to run two virtual machines: one Debian system acting as the DHCP server and one Windows 7 system serving as the client.

The Debian virtual machine functions as the DHCP server and makes use of two network adapters. The first adapter, configured in bridged mode, provides internet access through the host operating system so the server can perform updates and install required packages. The second adapter is set to host-only mode, which establishes a private internal link between the server and the client. Through this adapter, the DHCP service automatically distributes IP addresses to connected client devices.

On the other side, the Windows 7 virtual machine is used as the client for testing the DHCP configuration. This client employs a single host-only adapter, ensuring it communicates only with the DHCP server and not directly with the internet. Its network settings are left on automatic, so it relies on the DHCP server to obtain an IP address. VirtualBox supplies a virtual switch for the host-only network, acting like a physical switch inside the virtual setup, allowing both the server and client to exchange data as though they were part of a real LAN.

This design is straightforward but effective in demonstrating the core function of a DHCP server. The server provides IP addresses dynamically, while the client receives its configuration automatically, making the topology suitable for grasping the basics of computer networking.

Configuration Step:
Step 1: The first task before configuring the DHCP service is to install the Debian 12 operating system on VirtualBox using its ISO image. The Debian ISO can be downloaded from the official website. During the installation, configure two network interfaces: one using Bridged Adapter mode and the other using Host-Only Adapter mode. The Bridged Adapter connects the Debian virtual machine to the internet through the host system, allowing updates and package installations. Meanwhile, the Host-Only Adapter creates a private network between the Debian server and the Windows 7 client. This setup enables the server to automatically assign IP addresses to the client machine without relying on an external network.

Step 2: The next step is to manage the Debian server remotely using PuTTY. First, check the server’s IP configuration inside VirtualBox. Open the terminal and type the command ip a. This will display all active network interfaces. Typically, the output shows that only enp0s3 (the first adapter) has an IP address, while enp0s8 (the second adapter) does not. Note down the IP address of enp0s3, as it will be used to create a PuTTY session with the Debian server. After establishing the connection in PuTTY, run ip a again to verify the interface status. The result should be the same: enp0s3 already has an IP address, and enp0s8 remains unassigned. This condition is intentional, since enp0s8 will be configured manually later for the DHCP service.


Step 3: In this step, configure the network interfaces by opening the /etc/network/interfaces file. This can be done by entering the command nano /etc/network/interfaces in the terminal. Inside this file, the primary interface enp0s3 is set to DHCP with the IP address 192.168.101.90/24, gateway 192.168.101.1, and DNS 192.168.101.1. Meanwhile, the secondary interface enp0s8 is assigned a static IP address 35.35.35.1/24. With this configuration, the server remains connected to the internet through enp0s3, while enp0s8 is prepared for the DHCP service to distribute IP addresses to the client.

Step 4: After saving the configuration in the /etc/network/interfaces file, restart the networking service by running the command systemctl restart networking. This ensures that the changes take effect. Once the service has restarted, check the status of the interfaces using ip a show enp0s8 or simply ip address. The output confirms that enp0s3 has obtained the IP address 192.168.101.90/24 from DHCP, while enp0s8 is now assigned the static IP address 35.35.35.1/24. This result verifies that both interfaces have been configured correctly and are active.

Step 5: To confirm that the configuration works correctly, open PuTTY and connect to the Debian server using the IP address obtained from enp0s3 in VirtualBox. After logging in, run the command ip address to recheck the network interfaces. The output shows that enp0s3 still has the DHCP-assigned IP (in this case 192.168.101.90/24), while enp0s8 remains active with the static IP 35.35.35.1/24. This confirms that the configuration has been applied successfully and is consistent after reconnecting.

Step 6: The next step is to prepare the package sources before installing the DHCP server. First, navigate to the /etc/apt directory with the command cd /etc/apt. Inside this directory, you can see the sources.list file, which contains the list of repositories used by the system. To prevent issues during modification, create a backup of this file by running cp sources.list sources.list.backup. After that, check again using ls to confirm that the backup file has been successfully created.

Step 7: In this step, the repository is configured so the system can download the required packages. This is done by opening the sources.list file in the /etc/apt directory and replacing its content with the repository lines (deb http://archive.debian.org/debian stretch main contrib non-free) and (deb http://archive.debian.org/debian-security stretch/updates main contrib non-free). These repositories are used because the official Debian Stretch repository is no longer active, so the system must point to the Debian Archive in order to access the necessary packages for the DHCP server installation.

Step 8: In this step, the command rm sources.list is used to delete the old repository file so it will not cause any conflicts. After that, the contents of the /etc/apt directory are listed again to confirm that the file has been removed and only the backup file remains. Finally, the command nano sources.list is executed to create and edit a new sources.list file, which will later be filled with the updated repository sources.

Step 9: In this step, the command cat sources.list is used to display the contents of the sources.list file. The result shows that the file contains two repository lines pointing to the Debian Archive, which confirms that the configuration was written correctly. After that, the command apt update is executed to refresh the package list. The output shows several repository sources being fetched successfully, and in the end, the system displays the message “All packages are up to date”. This indicates that the repository configuration works properly and the package list has been updated without any errors.

Step 10: In this step, the command apt install isc-dhcp-server-ldap is executed to install the DHCP server package along with its required dependencies. During the process, the system analyzes the package list and displays additional libraries that need to be installed, such as libldap, libdns-export, and several other supporting modules. The output also shows the total size of the packages to be downloaded and the amount of disk space that will be used after installation. At the end, the system asks for confirmation with the message Do you want to continue? [Y/n], and the installation proceeds when the user enters y.

Step 11: In this step, first navigate to the DHCP configuration directory using cd /etc/dhcp/, because this is where the main DHCP server configuration files are stored. After entering the directory, list its contents to see the available files, including dhcpd.conf, which is the primary configuration file for the DHCP service. To prevent losing the original settings, run the command cp dhcpd.conf dhcpd.conf.backup to create a backup copy. Listing the directory again confirms that the backup file dhcpd.conf.backup has been successfully created alongside the original dhcpd.conf.

Step 12: In this step, the DHCP server configuration file dhcpd.conf is opened using the nano text editor by running the command nano dhcpd.conf. This allows you to edit the settings of the DHCP server, such as defining the IP address range, default gateway, DNS servers, and other network parameters. Opening the file in nano provides a simple text interface where the configuration can be modified as needed.

Step 13: After opening the dhcpd.conf file, the default configuration template is displayed. Inside the file, there are several commented sections that serve as examples. The highlighted red box shows a sample configuration for an internal subnet. This section includes settings such as the subnet, netmask, IP address range, DNS server, domain name, router (gateway), broadcast address, and lease times. Later, this part will be modified to match the actual network being used in the lab. For example, you will replace the subnet, IP address range, and gateway with the values that suit your VLAN or network design.

Step 14: In this step, the default DHCP configuration inside the dhcpd.conf file is modified to match the network settings that were previously configured on interface enp0s8. The example configuration that was initially commented out is activated by removing the # symbols. Then, the values inside are adjusted to fit the static IP setup. Specifically, the subnet is set to 35.35.35.0 with a netmask of 255.255.255.0, which corresponds to the network of enp0s8. The DHCP range is defined from 35.35.35.2 to 35.35.35.250, so clients connected to this network will automatically receive IPs within this range. The router (gateway) is configured as 35.35.35.1, which is the IP that was assigned to enp0s8 earlier. The broadcast address is set to 35.35.35.254, and a custom domain name www.prima.com is also added. The default and maximum lease times are kept as 600 and 7200. This makes sure that the DHCP server gives out IP addresses consistent with the enp0s8 interface setup, so connected clients can communicate properly.

Step 15: At this step, we type the command nano /etc/default/isc-dhcp-server. This command is used to open the default configuration file of the DHCP server. By opening this file, we will later edit which network interface the DHCP server should use to distribute IP addresses.

Step 16: In this step, the configuration file /etc/default/isc-dhcp-server is edited. This file controls how the DHCP server service runs. Inside the file, there is a section called INTERFACESv4, which determines on which network interface the DHCP server will listen and provide IP addresses. Here, the value of INTERFACESv4 is set to "enp0s8". This means the DHCP server will only respond to DHCP requests on the enp0s8 interface, which has already been configured with the static IP address 35.35.35.1. The INTERFACESv6 line is left empty since IPv6 is not being used in this setup. By assigning enp0s8 here, we make sure the DHCP service is linked directly to the interface we previously configured for the internal network.

Step 17: At this step, the DHCP server service is restarted using the command /etc/init.d/isc-dhcp-server restart. Restarting the service is necessary to apply all the configuration changes made in the previous steps, including the DHCP settings and the network interface assignment. Once the command is executed, the system will display a confirmation message indicating that the isc-dhcp-server service has been restarted successfully.

Step 18: In this step, the Windows 7 operating system is installed on VirtualBox. A virtual machine named windows7 has been created with 512 MB of memory and a 10 GB virtual hard disk. The Windows 7 ISO file is attached to the Optical Drive to start the installation process. For the network configuration, Adapter 1 is set to Host-only Adapter, which allows the Windows 7 VM to receive an IP address automatically from the DHCP server that was previously configured. This installation is important because Windows 7 will act as a client to test whether the DHCP server can dynamically assign IP addresses.

Step 19: After successfully installing Windows 7 on VirtualBox, start the virtual machine and wait until the operating system boots up. Once the desktop screen is displayed, open the Start Menu and navigate to the Control Panel. The Control Panel will be used to access the Network and Sharing Center, where the network settings of the Windows 7 client can be checked and configured. This step ensures that the client is properly connected and ready to receive an IP address from the DHCP server.

Step 20: After searching and opening the Control Panel, the window will display several categories. From this menu, click on Network and Internet. This section contains the settings for managing network connections and verifying whether the Windows 7 client can communicate with the DHCP server.

Step 21: After entering Network and Internet, the next step is to open Network and Sharing Center. This menu provides an overview of the current network connections and allows you to manage adapter settings, configure IP addresses, and check connectivity to the DHCP server.

Step 22: After entering the Network and Sharing Center, click on Local Area Connection. This option opens the status of the network adapter being used, allowing you to view its details and make configuration changes, such as enabling DHCP or setting a static IP if needed.

Step 23: After opening the Local Area Connection Status window, click on the Details… button. This will open the Network Connection Details window, where you can see the specific configuration received from the DHCP server. Here, you can confirm if the Windows 7 client successfully obtained network information automatically. The details include the IPv4 Address, Subnet Mask, Default Gateway, DHCP Server, DNS Server, and Lease Time. The purpose of this step is to verify that the DHCP server is working correctly. By checking the details, you can confirm that the client has received the correct IP address (in this case 35.35.35.x), the gateway (35.35.35.1), and the DNS settings (www.prima.com). If these values are shown, it means the DHCP configuration is successful and the client can connect to the network automatically without manual IP configuration.

Step 24: In this step, you log in to the Debian server using PuTTY and run the command cat /var/lib/dhcp/dhcpd.leases. This command is used to display the lease records, which show the IP addresses that the DHCP server has assigned to the clients. From the result, you can see that the server has assigned the IP addresses 35.35.35.2 and 35.35.35.3 to two different clients. The output also provides detailed information such as the lease start and end times, the binding state, the MAC address of the client devices, the vendor class identifier, and the hostnames of the clients, which in this case are Prima-PC and PRIMAAt this point, the DHCP server configuration has been successfully completed. The server is now able to automatically assign IP addresses and other network parameters to client devices connected to the network. With this setup, clients can join the network without needing manual IP configuration, which makes network management more efficient and reliable.














Komentar

Postingan Populer