默认情况下,从 ISO 映像安装 Linux Debian 11 时,可使用一个字段为网络接口分配 1 个 IP 地址。 如果您需要向该网络接口添加多个 IP 地址,请使用以下配置:
vi /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 ens3
iface ens3 inet static
address 89.111.186.200
netmask 255.255.255.0
broadcast +
up route -A inet add 89.111.186.1 dev ens3
up route -A inet add default gw 89.111.186.1 dev ens3
auto ens3:1
iface ens3:1 inet static
address 89.111.186.201
netmask 255.255.255.0
broadcast +
auto ens3:2
iface ens3:2 inet static
address 89.111.186.202
netmask 255.255.255.0
broadcast +
auto ens3:3
iface ens3:3 inet static
address 89.111.186.203
netmask 255.255.255.0
broadcast +
iface ens3 inet6 manual
pre-down ip -6 addr flush dev ens3 scope global || :
更改后,必须重新启动网络服务:
/etc/init.d/networking restart
文件中指定了 DNS 服务器:
vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
暂时没有评论