现在新一些 Debian 都不把 network config 放在 /etc/network/interfaces。
现在需要用 nmcli
.
nmcli connection show
# Set the IP address and gateway
sudo nmcli connection modify "Wired connection 1" ipv4.addresses 192.168.1.100/24 gw4 192.168.1.1
# Set the DNS servers
sudo nmcli connection modify "Wired connection 1" ipv4.dns "8.8.8.8 8.8.4.4"
# Change from DHCP to manual
sudo nmcli connection modify "Wired connection 1" ipv4.method manual
Apply if you have physical access to the machine
sudo nmcli connection down "Wired connection 1"
sudo nmcli connection up "Wired connection 1"