最近给vps多加了一个ip地址,系统是Debian10,原来只有1个网卡1个ip地址
网卡的名字是:eno1
ip地址是:192.168.100.123/24
新增加的ip地址是:192.168.103.125/24
Debian10的配置文件是/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 eno1 iface eno1 inet static address 192.168.100.123/24 gateway 192.168.100.1 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 127.0.0.1 auto eno1:1 iface eno1:1 inet static address 192.168.103.125 netmask 255.255.255.0
其中新添加的是后面4行
auto eno1:1 iface eno1:1 inet static address 192.168.103.125 netmask 255.255.255.0
PS:新添加的网卡不需要添加网关
添加完成后,如果没有vnc,最好重启VPS,如果使用/etc/init.d/network restart则会可能造成网络断开,而SSH连接不上:
重启完成后就可以了。。