ubuntu linux mint 配置局域网固定ip地址

站群域名整理:2020-6-5测试通过linux mint

sudo vim /etc/network/interfaces #增加如下
auto eth0#网卡名称 通过ifconfig获得
#iface eth0 inet dhcp
iface eth0 inet static    #设置获取ip的方式为静态
address 192.168.3.162     #设置想要设定的ip,根据实际进行设置
netmask 255.255.255.0     #设置子网掩码
gateway 192.168.3.1       #设置网关地址,根据实际进行设置如果设置虚拟机可以通过查看物理机的网关
dns-nameservers 114.114.114.114   #设置dns服务器,可以设置其他的dns服务器

sudo /etc/init.d/networking restart


sudo ifdown eth0
sudo ifup eth0