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


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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM