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。


免責聲明!

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



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