把下面这一段存为interface文本文件,就是kali 的DHCP获取IP,想办法替换掉/etc/network/interface文件即可。
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
DEVICE=eth0
ONBOOT=yes
TYPE=Ethernet
HWADDR=00:0c:29:02:88:54
BOOTPROTO=dhcp
NM_CONTROLLED=yes
UUID=4c3bb601-cf11-4967-93c1-c7195700500d
注意:
MAC,就是HWADDR的地址用ip a命令查,或者用sudo su后用ifconfig命令查。
UUID(通用唯一识别码)获取的命令是:nmcli con | sed -n '1,2p'
把下面这一段存为interface文本文件,就是kali网卡静态配置IP,想办法替换掉/etc/network/interface文件即可。
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 172.16.15.50
netmask 255.255.255.0
gateway 172.16.15.1
参考链接:https://www.cnblogs.com/iaknehc/p/6792372.html
静态双网卡配置
vim /etc/network/interfaces
auto eth0
iface eth0 inet static
address 172.16.15.50
netmask 255.255.255.0
gateway 172.16.15.254
auto eth1
iface eth1 inet static
address 172.16.14.50
netmask 255.255.255.0gateway 172.16.14.254
如果是两个内网,那在interfaces中只添加一个gateway就可以了,
另一个用路由命令添加一条静态路由:route add -net 172.16.16.0/24 gw 192.168.40.254 dev eth1
或者添加8个0的默认路由也可以,如果出去可以有优先级。看实际场景需求。
//保存后
service networking restart
ip a //查看ip地址
ifconfig (2020版本需要先sudo su后才可以用ifconfig这个命令)