Debian11设置多网卡IP地址

# 编辑文件
$ vim /etc/network/interfaces

allow-hotplug enp0s3
iface enp0s3 inet dhcp

#auto enp0s3
#iface enp0s3 inet static
#address 10.0.2.20
#netmask 255.255.255.0

#auto enp0s8
#iface enp0s8 inet static
#address 192.168.0.107
#netmask 255.255.255.0

auto enp0s9
iface enp0s9 inet static
address 192.168.56.191
netmask 255.255.255.0

备注

$ ip route show      #查看各网卡当前路由
$ ip a|grep enp0s    #查看配置好的网络情况
$ systemctl restart networking.service #重启网卡