-
[네트워크실습] DHCP serv configuration카테고리 없음 2022. 9. 26. 17:08
network configuration : Ethernet and DHCP
실습
1. Build a Local Area Network (LAN) and analyze network traffic.
2. After analyzing the basic network properties, connect a router to the network. (In this first phase, it will only be used as a DHCP server)
3. Configure a DHCP server with the IPRange provided.
4 . Connect machines to each other and connect two networks with different subnets to each other
환경
- two PCs
- One of them will act as router and will therefore be called Router. (connecting PC network to the lab network)
- The second PC will act as a client and is therefore called Client 1.
Task1
1. Connect your two computers as shown in Figure 1. One of the computers will act as the Router and the other one as Client 1. The interface enp3s0 of Client 1 is directly connected to Router enp3s0. On the Router, enp4s0 is connected to the lab network (wall socket X.1).
2. Check whether you have an active internet connection on the Router. Otherwise run, `sudo dhclient enp4s0` - This tells the machine to acquire an IP address by using DHCP (Dynamic Host Configuration Protocol). Once the command terminated check the IP address on enp4s0, if it takes a long time to complete there is most likely an issue with the physical connection. If there is already an IP address configured run this first to release it: sudo dhclient enp4s0 -r
3. Now, you can either use the Graphical User Interface (GUI) to set up the default route i.e., check the Wired Settings of the Network Settings). Or you can use the terminal to configure the default route on Client 1 with the route command. Use man route to get help with the command. Look at the routing table before and after you add the default route. What is the command to add the route?
4. Similar to the previous step, you can either use the GUI (which is easier) to configure the DNS server. Or you can configure the DNS server on Client 1 in /etc/ resolv.conf. A good SysAdmin always has a backup so backup the file first like this: cp /etc/resolv.conf /etc/resolv.conf.backup. Use man resolv.conf for help.
5. Check whether the connection works, by executing ping from Client 1 to Router. Try to ping Client 1 of another group. Also try to ping a server from the internet (e.g. ping www.google.com). Which hosts are reachable?
6. Allow packet forwarding on the router by writing ‘1’ into /proc/sys/net/ipv4/ ip_forward and execute the following command (change X to your subnet): sudo iptables -t nat -A POSTROUTING -s 10.1.x.0/24 -o enpXs0 -j MASQUERADE, also change the default forwarding policy to accept sudo iptables - P FORWARD ACCEPT
7. Check again the connectivity from Client 1 to the router, Client 1 of another group and an internet server. Which ones are reachable?
8. Test the traceroute -n command. What does it show?
Task2
Configure a DHCP on the Router machine. As a help you can use the default config file, which contains many examples: /etc/dhcp/dhcpd.conf.
1. Install the DHCP server software on Router: sudo apt install isc-dhcp-server
2. Configure the dynamic address range in the server. Use addresses x.y.z.100 - 150 as dynamic range. You need to provide configuration values for subnet mask ,default gateway, and DNS (as you did manually in Section 2). The DHCP server machine (Router) will be used as gateway, therefore the server IP can be used. You need to change the default configuration by editing /etc/dhcp/dhcpd.conf to suit your needs and particular configuration.
3. You also need to edit /etc/default/isc-dhcp-server to specify the interfaces dhcpd should listen to. Write a line in the following syntax into the file even if does not exist yet: INTERFACES=” ”.
4. Restart the DNS server process sudo service isc-dhcp-server restart. Check the status of the dhcp deamon with sudo service isc-dhcp-server status if it failed the syslog /var/log/syslog might give you further clues.
5. In Client 1 restore the backup of /etc/resolv.conf, but first back up the actual one again: cp /etc/resolv.conf /etc/resolv.conf.ex2 rm /etc/resolv.conf mv /etc/resolv.conf.backup /etc/resolv.conf
6. Restart the network interface of Client 1 which is connected to the router. Restart the network on the client with: /etc/init.d/networking restart Check if your client received an IP and if itcan reach the router and an internet host. If not release the current IP and request a new one from the DHCP server: dhclient enpXs0 -r dhclient enpXs0 You can also test additional clients like your private laptops. Use sudo resolvconf - u to update the DNS settings if name resolution is not working.
7. Start Wireshark on Client 1 and start capture DHCP packets (Filter). No use dhclient enp3s0 -r and dhclient enp3s0 to release and request an IP address over DHCP. If you see the packets, save the trace as 3.1.7.pcapng and attach it to your solution email.
8. Configure the DHCP server such that it gives a static IP Address to one of your clients. How does the server identify the host to give it a specific address?
References
[1] ARP, URL: http://en.wikipedia.org/wiki/Address_Resolution_Protocol Visited in September 2020.
[2] Network Configuration, URL: https://help.ubuntu.com/12.04/serverguide/network-configuration.html Visited in September 2020.
[3] Dynamic Host Configuration Protocol (DHCP) URL: https://help.ubuntu.com/community/dhcp3-server Visited in September 2020
[4] Wireshark, URL: http://www.wireshark.org/ Visited in September 2020
[5] Wireshark display filters, URL: http://wiki.wireshark.org/DisplayFilters Visited in September 2020