Ubuntu 配置内网静态ip

485 阅读1分钟

1. 查询网卡信息

ifconfig

2. 修改配置文件 /etc/network/interfaces

sudo vi /etc/network/interfaces

auto eth1 			# 其中eth0是步骤1中确定的网卡名字
iface eth1 inet static
address x.x.x.x                 # x.x.x.x为设置的静态ip地址
netmask 255.255.255.0		# 此处设置子网掩码
gateway x.x.x.x                 # 此处设置网关
dns-nameservers 8.8.8.8		# 此处设置dns服务器

3. 重启服务

sudo systemctl restart networking.service