登陸系統後,編輯文件/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 auto eno1 iface eno1 inet dhcp # This is an autoconfigured IPv6 interface iface eno1 inet6 auto
修改爲以下內容:oop
# 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 auto eno1 iface eno1 inet static address 192.168.0.100 netmask 255.255.255.0 gateway 192.168.0.254 # This is an autoconfigured IPv6 interface iface eno1 inet6 auto
sudo /etc/init.d/networking restart