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 device, if 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.
6. Next we will create a new Object again the same way just right-click then select Node.
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.
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
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.
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 Client, in
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.
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. A pop-up will appear as below, just 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.
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 before, just 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.
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.
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
Posting Komentar