最近我遇到了这篇 Ask Ubuntu 帖子关于向 Open vSwitch 桥添加物理接口。Lukas Maerdian 和 Denis 的回答对我帮助很大,但我仍然有一个问题。
当我使用桥接器内部的映射将物理接口添加enp0s3
到内部 Open vSwitch 端口时,我无法在启动期间达到 UP 状态,我必须在机器启动后手动运行。br-ex
interfaces
br-ex
enp0s3
ip link set enp0s3 up
这是我当前的 Netplan 配置:
---
network:
ethernets:
enp0s3: {}
bridges:
br-ex:
openvswitch: {}
addresses:
- 10.2.0.0/8
gateway4: 10.0.0.1
nameservers:
addresses:
- 10.0.0.1
interfaces:
- enp0s3
version: 2
...
这是我的/var/log/syslog
文件只有行systemd-networkd
(整个文件很大)。
以下是stdout
的ip addr
:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master ovs-system state DOWN group default qlen 1000
link/ether 08:00:27:9a:24:d8 brd ff:ff:ff:ff:ff:ff
3: ovs-system: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 7e:46:ed:8f:ae:cd brd ff:ff:ff:ff:ff:ff
4: br-int: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 82:69:1e:06:a2:42 brd ff:ff:ff:ff:ff:ff
5: br-ex: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
link/ether 08:00:27:9a:24:d8 brd ff:ff:ff:ff:ff:ff
inet 10.2.0.0/8 brd 10.255.255.255 scope global br-ex
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fe9a:24d8/64 scope link
valid_lft forever preferred_lft forever
6: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:c3:00:4b brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
7: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
link/ether 52:54:00:c3:00:4b brd ff:ff:ff:ff:ff:ff
ovs-vsctl show
给我:
6a9ff04c-316f-4ee8-82e1-f228c512cf74
Manager "ptcp:6640:127.0.0.1"
is_connected: true
Bridge br-int
fail_mode: secure
Port br-int
Interface br-int
type: internal
Port patch-br-int-to-provnet-8d56ff0f-c67a-4219-8cfc-bcf8aa009f28
Interface patch-br-int-to-provnet-8d56ff0f-c67a-4219-8cfc-bcf8aa009f28
type: patch
options: {peer=patch-provnet-8d56ff0f-c67a-4219-8cfc-bcf8aa009f28-to-br-int}
Bridge br-ex
fail_mode: standalone
Port patch-provnet-8d56ff0f-c67a-4219-8cfc-bcf8aa009f28-to-br-int
Interface patch-provnet-8d56ff0f-c67a-4219-8cfc-bcf8aa009f28-to-br-int
type: patch
options: {peer=patch-br-int-to-provnet-8d56ff0f-c67a-4219-8cfc-bcf8aa009f28}
Port enp0s3
Interface enp0s3
Port br-ex
Interface br-ex
type: internal
ovs_version: "2.13.3"
我需要enp0s3
在机器启动时自动启动,但我不知道该怎么做。如果不将enp0s3
作为接口添加到br-ex
,enp0s3
则在启动过程中正常启动。