Postingan kali ini saya membahas mengenai konfigurasi DHCP Client pada BSDRP (BSD Router Project). Topologi yang kita gunakan adalah seperti diatas.
Port 1 (em0) router 1 (BSDRP) kita hubungkan dengan internet yang memiliki protocol DHCP Server. Baik kita mulai langkah langkahnya. Pertama kita masuk dahulu ke console dari BSDRP nya. Untuk login default yaitu root (tanpa password)
Thu Sep 5 14:24:18 UTC 2024
FreeBSD/amd64 (router.bsdrp.net) (ttyu0)
login: root
Sep 5 14:24:28 router login[43764]: ROOT LOGIN (root) ON ttyu0
root@router:~ #
Selanjutnya, kita bisa masukkan perintah dhclient. Untuk detail penggunaan command dhclient bisa dilihat pada referensi dibawah. Untuk kali ini kita gunakan command dhclient <interface>
root@router:~ # dhclient em0
DHCPDISCOVER on em0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on em0 to 255.255.255.255 port 67 interval 10
DHCPOFFER from 192.168.11.253
DHCPREQUEST on em0 to 255.255.255.255 port 67
DHCPACK from 192.168.11.253
bound to 192.168.10.69 -- renewal in 300 seconds.
Jika sudah muncul diatas maka kita sudah mendapatkan alamat ip dari DHCP server. Untuk pengujian dapat mengikuti langgkah berikut:
root@router:~ # ifconfig em0
em0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
options=48120bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,WOL_MAGIC,VLAN_HWFILTER,HWSTATS,MEXTPG>
ether 0c:0b:b2:e7:00:00
inet 192.168.10.69 netmask 0xfffffe00 broadcast 192.168.11.255
inet6 fe80::e0b:b2ff:fee7:0%em0 prefixlen 64 scopeid 0x1
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
root@router:~ # show route
Routing tables
Internet:
Destination Gateway Flags Nhop# Mtu Netif Expire
default 192.168.11.254 UGS 4 1500 em0
127.0.0.1 link#6 UH 1 16384 lo0
192.168.10.0/23 link#1 U 2 1500 em0
192.168.10.69 link#6 UHS 3 16384 lo0
root@router:~ # ping 192.168.11.254
PING 192.168.11.254 (192.168.11.254): 56 data bytes
64 bytes from 192.168.11.254: icmp_seq=0 ttl=255 time=2.890 ms
64 bytes from 192.168.11.254: icmp_seq=1 ttl=255 time=1.180 ms
64 bytes from 192.168.11.254: icmp_seq=2 ttl=255 time=1.333 ms
^C
--- 192.168.11.254 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 1.180/1.801/2.890/0.773 ms
root@router:~ # ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1): 56 data bytes
64 bytes from 1.1.1.1: icmp_seq=0 ttl=58 time=13.821 ms
64 bytes from 1.1.1.1: icmp_seq=1 ttl=58 time=13.822 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=58 time=13.840 ms
^C
--- 1.1.1.1 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 13.821/13.828/13.840/0.009 ms
Jika sudah mendapatkan IP, DNS, Gateway. konfigurasi yang kita lakukan sudah berhasil.
Untuk detail lease DHCP yang kita dapatkan bisa kita lihat melalui file
/var/db/dhclient.leases.IFNAME
root@router:~ # cat /var/db/dhclient.leases.em0
lease {
interface "em0";
fixed-address 192.168.10.69;
next-server 192.168.11.253;
option subnet-mask 255.255.254.0;
option routers 192.168.11.254;
option domain-name-servers 10.20.22.22,1.1.1.1;
option dhcp-lease-time 600;
option dhcp-message-type 5;
option dhcp-server-identifier 192.168.11.253;
renew 4 2024/9/5 14:33:23;
rebind 4 2024/9/5 14:37:08;
expire 4 2024/9/5 14:38:23;
}
Sekian Terima Kasih
Referensi:
No comments:
Post a Comment