我正在尝试配置网络上的几个接口。我为 VBox VM 创建了 tap0,并将 enp6s0(我的以太网连接)设置为手动。我希望我的主机通过 br0 连接,这就是我将 inet 设置为 dhcp 而不是 manuel 的原因。然而,我的主机似乎随机地通过 tap0 接口连接到网络(即我必须从 tap0 ip 地址 ssh 进入机器)。我如何将我的主机设置为仅通过 br0 连接?
网络接口:
#cat /etc/network/interfaces
auto enp6s0
iface enp6s0 inet manual
up ip link set enp6s0 up
auto tap0
iface tap0 inet manual
up ip tuntap add mode tap tap0
up ip link set tap0 up
auto br0
iface br0 inet dhcp
bridge-ifaces enp6s0 tap0
bridge-ports enp6s0 tap0
post-up ip link set br0 address 88:d7:f6:ae:7a:06
IP 链接:
#ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp6s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP mode DEFAULT group default qlen 1000
link/ether 88:d7:f6:ae:7a:06 brd ff:ff:ff:ff:ff:ff
3: enp7s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 88:d7:f6:ae:7a:07 brd ff:ff:ff:ff:ff:ff
4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 88:d7:f6:ae:7a:06 brd ff:ff:ff:ff:ff:ff
5: tap0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel master br0 state DOWN mode DEFAULT group default qlen 1000
link/ether 76:7b:48:57:39:13 brd ff:ff:ff:ff:ff:ff
7: vethM7FNJI@if6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP mode DEFAULT group default qlen 1000
link/ether fe:4a:c9:02:70:13 brd ff:ff:ff:ff:ff:ff link-netnsid 0
9: vethTJ3ADT@if8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP mode DEFAULT group default qlen 1000
link/ether fe:e6:ff:66:ef:75 brd ff:ff:ff:ff:ff:ff link-netnsid 1
11: vethJ5N8T3@if10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP mode DEFAULT group default qlen 1000
link/ether fe:bf:10:b5:0b:27 brd ff:ff:ff:ff:ff:ff link-netnsid 2
我是网络新手,此配置是从几个来源拼凑起来的,所以如果您发现任何奇怪的东西,请告诉我。我很惊讶 tap0 接口状态为 DOWN:
5: tap0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel master br0 state DOWN mode DEFAULT group default qlen 1000
link/ether 76:7b:48:57:39:13 brd ff:ff:ff:ff:ff:ff
给定 /etc/network/interfaces 设置:
up ip link set tap0 up
尤其是考虑到此接口正在用于连接。我如何才能让主机优先使用 br0 而不是 tap0?
谢谢 :)