Kali Linux常用服務配置教程獲取IP地址

大學霸發表於2018-12-21

Kali Linux常用服務配置教程獲取IP地址

下面以Kali Linux為例,演示獲取IP地址的方法

(1)設定網路介面為自動獲取IP地址。在Kali Linux的收藏夾中單擊圖示,將顯示所有的程式,如圖1.8所示。

(2)單擊“設定”圖示,將開啟“設定”視窗,如圖1.9所示。

(3)選擇“網路”選項,單擊有線連線中的齒輪按鈕,將顯示“有線”對話方塊,如圖1.10所示。

(4)勾選“自動連線”核取方塊。然後,單擊IPv4標籤,將顯示IPv4選項卡,如圖1.11所示。

(5)在該介面選擇“自動(DHCP)”選項。然後,單擊“應用”按鈕。接下來,就可以請求獲取IP地址了。執行命令如下所示:

root@daxueba:~# dhclient eth0 –d

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地址及對應租約資訊。

相關文章