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