ip: 192.168.1.10/24
网关:192.168.1.1
DNS:192.168.1.254
/etc/network/interfaces
原始文件内容为:
# 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# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
修改后为:
# 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# The primary network interface
#allow-hotplug eth0
auto eth0
iface eth0 inet staticaddress 192.168.1.10netmask 255.255.255.0gateway 192.168.1.1
然后就是DNS:
/etc/resolv.conf
增加:
nameserver 202.96.134.133
基本设置完成,重启网络服务以应用更改:
systemctl restart networking