/etc/network/interfaces
里:
# https://unix.stackexchange.com/a/128662/453838
allow-hotplug enp0s2
iface enp0s2 inet static
address 10.249.44.127
netmask 255.255.248.0
gateway 10.249.40.1
dns-nameserver 10.248.98.30
# https://askubuntu.com/questions/616856/how-do-i-add-an-additional-ipv6-address-to-etc-network-interfaces
iface end1 inet6 static
address fd00:1::1
netmask 64
网卡名字和当前子网掩码可以通过ip addr
看。
当前网关可以通过route -n
查看。
当前dns服务器的IP在/etc/resolv.conf
里。
重启网络:
sudo systemctl restart networking