1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > Kali DHCP获取动态ip和静态IP设置方法

Kali DHCP获取动态ip和静态IP设置方法

时间:2024-04-26 16:06:00

相关推荐

Kali  DHCP获取动态ip和静态IP设置方法

把下面这一段存为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

参考链接:/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.0

gateway 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 (版本需要先sudo su后才可以用ifconfig这个命令)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。