- 编辑/etc/network/interfaces文件
sudo vim /etc/network/interfaces
- 加入下面内容
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto enp3s0
iface enp3s0 inet static
address 192.xxx.x.xxx # 你的固定ip地址
netmask 255.xxx.xxx.0 # 子网掩码
gateway 192.xxx.x.1 # 网关地址
dns-nameservers 192.xxx.x.14 # dns地址
- 重启服务
sudo service network restrart