一:查看IP
1.查看eth0网卡
ifconfig eth0
2.查看IP
iconfig
3.查看路由表
route或netstat -rn
4.打开关闭eth0网卡
1.1 打开eth0
ifconfig eth0 up
1.2 关闭eth0
ifconfig eth0 down
二:临时配置的IP,直到重启网络服务
1.临时配置的IP,直到重启网络服务。
ifconfig eth0 192.168.31.72/24
2.设置默认路由
route add default gw 192.168.1.1
3.配置DNS服务器
echo nameserver 8.8.8.8 > /etc/resolv.conf
三:永久配置IP地址
1.配置路径
vim /etc/network/interfaces
2.配置信息
路由器信息
MAC地址:#############
IP地址:192.168.31.72 (动态ip)
子网掩码:255.255.255.0
网关:192.168.31.1 (释放)
DNS服务器:10.64.0.10 , 10.64.0.100
2.配置信息
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 dhcp
iface eth0 inet static #静态分配IP
address 192.168.1.53 #ip
netmask 255.255.255.0
gateway 192.168.1.1
3.重启服务
systemctl restart networking## 标题
本文介绍了如何在Kali Linux中查看和配置网络接口,包括查看IP、打开/关闭网卡、临时和永久配置IP地址,以及设置默认路由和DNS服务器。通过修改`/etc/network/interfaces`文件并重启网络服务来实现静态IP配置。
1436

被折叠的 条评论
为什么被折叠?



