我正在位于其他地方的数据中心的远程主机上全新安装 Debian Buster。
我有一个脚本可以复制工作标准 /etc/network/interfaces 到原处并重新启动在命令输入应该会出现问题,改变网络配置。
当我将桥接器 br0 条目添加到 /etc/network/interfaces 并调用 ifup br0 时,桥接器接口显示如下:
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet xx.xxx.62.204 netmask 255.255.255.0 broadcast xx.xxx.62.255
inet6 xxxx::7a2b:cbff:fe71:b0b0 prefixlen 64 scopeid 0x20<link>
ether 78:xx:xx:xx:b0:b0 txqueuelen 1000 (Ethernet)
RX packets 1722 bytes 80621 (78.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5 bytes 426 (426.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet xx.xxx.62.204 netmask 255.255.255.0 broadcast xx.xxx.62.255
ether 78:xx:xx:xx:b0:b0 txqueuelen 1000 (Ethernet)
RX packets 27871902 bytes 1784816339 (1.6 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 10682 bytes 1326822 (1.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Lokale Schleife)
RX packets 26 bytes 3455 (3.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 26 bytes 3455 (3.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
使用这个 /etc/network/interfaces 条目:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eno1
iface eno1 inet static
address xx.xxx.62.204
netmask 255.255.255.0
network xx.xxx.62.0
broadcast xx.xxx.62.255
gateway xx.xxx.62.254
iface eno1 inet6 static
address xxxx:198:ff0d:e800::/40
pre-up echo 0 > /proc/sys/net/ipv6/conf/eno1/accept_dad
post-up ip -6 route add default via xxxx:198:ff00::1
up ip -6 addr add xxxx:198:ff0d:e800::1/40 dev $IFACE
down ip -6 addr del xxxx:198:ff0d:e800::1/40 dev $IFACE
auto br0
iface br0 inet static
address xx.xxx.62.204
netmask 255.255.255.0
gateway xx.xxx.62.254
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0
但几秒钟后,ssh 连接冻结,ping 数据包不再到达,我不得不等待紧急脚本修复/重新启动。
整个尝试是在主机上提供一个 kvm 虚拟机,该虚拟机具有桥接接口,以便通过单独的 IP4 地址访问外界。
添加的桥条目是根据此 serverfault 帖子