一:查看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## 标题