Configuring a DHCP Server Using PNETLAB

 


Configuring a DHCP Server and Connecting to the Internet

 

What is DHCP? DHCP (Dynamic Host Configuration Protocol) is a protocol used to facilitate the automatic deployment of IP (Internet Protocol) addresses to other devices.

This DHCP configuration does not have to be manually implemented on each computer in order to get a different IP address. This will certainly be troublesome and time-consuming.

IP Address or IP address itself is a row of numbers on a device that allows our device to connect to the internet, so that we can access web pages, emails, etc.

Well, by using dhcp this IP address can be shared to many devices at one time automatically. That is why these devices are widely applied to networks both small-scale and large-scale.

There are also functions of this DHCP Server, including:

  • Managing and Distributing IP Addresses
  • Preventing IP Conflict
  • Renewing IP Addresses Automatically
  • Supports IP Address Reuse

The following is the DHCP Server Configuration and Connecting to the Internet:

1. Because here I have imported PNETLAB into the VMWare Workstation and have entered the PNETLAB dashboard and also here I have downloaded the Ubuntu deviceif you haven't downloaded it then you can drop it in the Device section then click Get Device in the ubuntu section which I colored it red and just wait until the Get Device turns green as it is on the drawn.



2. If it has been downloaded, then we will return to the initial dashborad displaybyclicking the Main section then select Add to lab to create a new lab.



3. Here you make the LAB name free of anything and just click the Add section if it has been named.



4. This is the LAB view that we have created before, well here I will create a new object, just right-click then select the Network one.

5. The display appears as below, then here we change the name to Switch because we want to add a Switch then the Type section selects bridge and the Icon section is changed by just clicking on the Icon section then replacing it by serching in the left corner just write Switch and select any Switch, if you have just saved it.




6. Next we will create a new Object again the same way just right-click then select Node.


7. Then we set the Name section to Ubuntu Server, the Ethernet section just change it to 3, then in the eth1 Static IP section we fill in manually type the one network with your Laptop IP, and eth2 is free, the Default Route section fills in the Gateway IP on your Laptop IP and finally don't forget to fill in the DNS with 8.8.8.8.

8. If it's at the top, you just have to scroll down and then the Primary Console section fills it with Telnet and the Secondary Console select SSH because later we will remote using SSH then don't forget the User Name is filled in so root then if it's all you just save.


9. Next we will create the Client by right-clicking as well and selecting Node again.


10. Then here we just select it using a Virtual PC (VPCS).


11. Because we need 2 Clients, then change the Number to 2 and the Name section also change it to VPC, if you just save it



12. After that we will add a Cloud the way is to right-click then select Network.


13. Well, in the Name section we change it to Internet and then change the Type to Management (Cloud) and don't forget the Icon is changed to Cloud too




14. Connect the Cloud (Internet) to the Ubuntu Server by bringing the cursor closer to the cloud and it will look like the plugs shown below


15. Then pull the plug above and paste it towards the Ubuntu Server, then just put the cursor and the cable on the Ubuntu server.
16. Later a screen will appear to change the interface, here I use the eth1 interface from the Internet to Ubuntu Server, when it is finished click Save.




17. Then pull the plug above and paste it towards the Ubuntu Server, then just put the cursor and the cable on the Ubuntu server.

18. Next we will connect it to the Switch, the method is the same as in no.16

19. The display appears for interface selection, here I use the eth2 interface to connect from Ubuntu Server to switch, if you have clicked save at the bottom.


20. Here we will connect from the Switch to the Clientin the same way as above.



21. Then just connect directly, navigate to the respective Client.



22. Then select the interface, use the eth0 interface to connect from the Switch to the Client, if you have clicked Save.



23. The next step we will turn on the Ubuntu Server and its 2 clients, how to point the cursor to Ubuntu and its 2 clients then there is a small green triangle sign, you just click




24. When it is finished, it will be as below the topology display that we have previously set will later match the interface.


25. To start the configuration and be able to enter the Terminal, we just double click the Ubuntu Server section then enter and write down the commands ifconfig eth1 and ifconfig eth2 to check whether the IP Address that we type manually is appropriate or not, in the picture below the IP Address is the same as we have previously set.


26. Then ping the DNS to check whether this Ubuntu Server has got the internet or notif the replay is like the one in the picture below it means it has got the internet.

27. Before we enter the DHCP Server configuration we will first remote the device so that it can use the putty application, After that we will update the packages on this Ubuntu Server with the apt update command then wait until it is as early as or until there is a sentence root@Ubuntu Server: /home#.


28. Because we will configure it using text mode, then first install the SSH with the command apt install ssh, if there is a Y/n option we just select y then enter it again and wait for it to finish.


29. We do a remote experiment first using the PuTTY application and we enter using the admin first, the way is to write down the IP Address in eth1 then click open


29. A pop-up will appear as belowjust select Accept to proceed to the configuration.


30. If you have entered the putty, we will immediately log in using the admin and the password is also the admin.


31. Enter the sudo -i command again and password again, namely admin to be able to access it.


32. If you have successfully logged in using the admin, then next we will change the login using the root as we have set at the beginning, namely how we enter the ssh directoryn first by typing the nano /etc/ssh/sshhd_config command.


33. Then we will enter in the directory and in the #PermitRootLogin the prohibit-password section we Ctrl +K to delete the one line then we paste it again with Ctrl + U 2x and later it will appear 2 readings #PermitRootLogin prohibit-password then the second reading we change to PermitRootLogin yes and just just save using Ctrl + X and enter.


34. Then we also have to set the password from the root by using the sudo passwd root command then enter later enter any password and under it verify the password that we have typed before then enter it until there is a passsword reading updated successfully, the sign is that the password has been successfully done.



35. Immediately you restart the password will be listed later in the configuration by typing the command /etc/init.d/ssh restart then wait until there is an OK reading.


36. And we remotely again use putty to check whether we can use the root and password that we have set beforejust enter the root and password that we have created, if it can be later he is not told to enter sudo -i again as in the picture.


37. After we can remote as above and have entered in the putty display then next we will install the DHCP Server first with the command apt install isc-dhcp-server-ldap and jif there is an option Y / n just type y then enter and wait until the installation is complete.


38. Then we will enter the DHCP Directory with the command cd /etc/dhcp then type the ls command to see which one we will backup and which one we bakcup it in the dhcpd.conf section.


39. How to extract the file above, we enter the cp dhcpd.conf dhcpd.conf.backup command, if you have typed the command again to check whether it has been backed up or not by typing ls.

40. Here we will set the did in its DHCP directory using the dhcpd.conf nano command.

41. Then we will be displayed in the directory and here we find you times as below and replace everything by using the IP Address in the eth2 interface, if it is all correct then Just Save using Ctrl + X then enter.


42. Next we will change the interface we are using at the top of it using eth2 so we replace it using the command nano /etc/default/isc-dhcp-server.

43. If you have entered the dircotory, we look for the bottom one that uses the phrase INTERFACESv4 that we just enter eth2 because we use eth2 in the section entering the IP Address before.



44. Before proceeding to other configurations, we should first restart all the configurations that we have done with the command /etc/init.d/isc-dhcp-server restart, so that all configurations that have been running properly.


45. Also check the status of the DHCP that we have configured whether it is running or not with the command /etc/init.d/isc-dhcp-server status.



46. After configuring everything, then here we will ask for the IP Address of each PC Client by double-clicking the PC then you type the dhcp ip to ask for the IP Address automatically.


47. Similar to the other PC Client, do the same double click the PC and thenwrite dhcp ip to ask for ip address automatically.


48. Then we do a ping test to prove whether it is connected to the internet or not, we type the ping command 8.8.8.8, if it is still a timeout as below it means that the sign has not gotten the internet.


49. If you haven't got the internet as above, then you can open the sysctl directory with the command nano /etc/sysctl.conf and later a display will appear in the directory as below then we just change the net.ipv4 section just remove the hash mark.


50. The next step we can first install iptables, using the command apt install iptables-persistent.


51. In the iptables install, there will be a yes/no option, then you just select yes.

52. Next, we will add a NAT Masquerade firewall to connect to the internet with the command iptables -t nat -A POSTROO 52 TING -o eth1 -J MASQUERADE.


53. If all the iptables have been configured, then the last one we check the status of the iptables by using the command iptables -t nat -L.

54. Then we will turn off each PC Client by bringing the cursor closer to the Client PC and clicking the box button, this is to prevent all the configurations that we did earlier are not bugged.


55. Then restart the two PC Clients by bringing the cursor closer to the PC Client and clicking the triangle button.


56.
The last thing to do is check again on each Client PC, whether it has got internet or not by double-clicking the PC Client to enter the terminal and typing the ip dhcp command to ask for the IP Address automatically again and ping 8.8.8.8, if the replay is like below means that it is a sign that you have got the internet.



Komentar

Postingan populer dari blog ini

4.1 STATIC ROUTE 2 Router

1.3 UPGRADE DAN DOWNGRADE