1. 程式人生 > 其它 >kali linux 靜態地址和動態地址的設定

kali linux 靜態地址和動態地址的設定

在檔案系統裡找到/etc/network下的interfaces檔案,開啟後可以看到eth0為dhcp,將其修改為

# This file describes the network interfaces available on your system

# and how to activate them. For more information, see interfaces(5)。

# The loopback network interface

auto lo

iface lo inet loopback

auto eth0

iface eth0 inet static //配置eth0使用預設的靜態地址

address 192.168.77.133 //設定eth0的IP地址

netmask 255.255.255.0 //配置eth0的子網掩碼

gateway 192.168.77.254 //配置當前主機的預設閘道器

“interfaces”檔案中還有很多其他的設定項,如需要了解更多的資訊,可以使用man命令查詢“interfaces”檔案的手冊頁。

******後期想將靜態地址改成dhcp,只需要改成如下格式即可*****

auto lo

iface lo inet loopback

auto eth0

iface eth0 inet dhcp //配置eth0使用動態地址

#man interfaces

其中eth0指本機乙太網卡一,類似的,eth1指本機的乙太網卡2。一般一臺電腦只有一個eth0。網絡卡的裝置名/dev/eth0 和硬體的MAC 地址52:54:AB:DD:6F:61對應,MAC 地址是生產廠家定的,每個網絡卡擁有的唯一地址。

linux下,用ifconfig後,能看到eth0,可能還會看到eth0:1。其中eth0:1是指eth0的分ip儲存檔案,分ip儲存檔案格式為ifcfg-eth0:X, X為任意正整數(包括0)

具體作用是實現單網絡卡多ip,類似與windows的多ip。