Kali Linux經常使用服務配置教程獲取IP地址網絡
下面以Kali Linux爲例,演示獲取IP地址的方法ide
(1)設置網絡接口爲自動獲取IP地址。在Kali Linux的收藏夾中單擊圖標,將顯示全部的程序,如圖1.8所示。測試
(2)單擊「設置」圖標,將打開「設置」窗口,如圖1.9所示。ui
(3)選擇「網絡」選項,單擊有線鏈接中的齒輪按鈕,將顯示「有線」對話框,如圖1.10所示。this
(4)勾選「自動鏈接」複選框。而後,單擊IPv4標籤,將顯示IPv4選項卡,如圖1.11所示。spa
(5)在該界面選擇「自動(DHCP)」選項。而後,單擊「應用」按鈕。接下來,就能夠請求獲取IP地址了。執行命令以下所示:orm
root@daxueba:~# dhclient eth0 –dblog
Internet Systems Consortium DHCP Client 4.3.5教程
Copyright 2004-2016 Internet Systems Consortium.接口
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0/00:0c:29:25:89:95
Sending on LPF/eth0/00:0c:29:25:89:95
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4
DHCPREQUEST of 192.168.0.12 on eth0 to 255.255.255.255 port 67
DHCPOFFER of 192.168.0.12 from 192.168.0.10
DHCPACK of 192.168.0.12 from 192.168.0.100
bound to 192.168.0.12 -- renewal in 277 seconds.
從輸出的信息中,能夠看到成功獲取到IP地址192.168.0.12。由此能夠說明,搭建的DHCP服務測試成功。此時,用戶查看地址租約文件dhcpd.leases,也能夠看到分配的IP地址。以下所示:
root@daxueba:~# cat /var/lib/dhcp/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.3.5
# authoring-byte-order entry is generated, DO NOT DELETE
authoring-byte-order little-endian;
lease 192.168.0.10 {
starts 1 2018/07/02 10:15:00;
ends 1 2018/07/02 10:25:00;
cltt 1 2018/07/02 10:15:00;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet 00:0c:29:5c:ae:aa;
client-hostname "daxueba";
}
lease 192.168.0.11 {
starts 1 2018/07/02 10:18:17;
ends 1 2018/07/02 10:28:17;
cltt 1 2018/07/02 10:18:17;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet 00:0c:29:99:92:4f;
uid "\001\000\014)\231\222O";
set vendor-class-identifier = "MSFT 5.0";
client-hostname "Test";
}
lease 192.168.0.12 {
starts 1 2018/07/02 10:34:56;
ends 1 2018/07/02 10:44:56;
cltt 1 2018/07/02 10:34:56;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet 00:0c:29:25:89:95;
client-hostname "daxueba";
}
從輸出的信息中,能夠看到DHCP服務分配出去的IP地址及對應租約信息。