centos – 为KVM团队建立桥梁

前端之家收集整理的这篇文章主要介绍了centos – 为KVM团队建立桥梁前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有问题在团队合作上创建vlan桥.
为什么我这样做?
– Kvm需要桥梁
– Vlans因为我需要不同子网中的vm
– 在选项主动备份(小型HA)中进行组合

我使用NetworkManager在centos 7 x64上完成.
两个物理接口:

TYPE=Ethernet
DEFROUTE=no
PEERDNS=no
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6_DEFROUTE=no
IPV6_PEERDNS=no
IPV6_PEERROUTES=no
IPV6_FAILURE_FATAL=no
NAME=enp8s0f0
UUID=311d4881-f3f1-45af-b01f-b48872b00b0f
ONBOOT=yes

TYPE=Ethernet
DEFROUTE=no
PEERDNS=no
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6_DEFROUTE=no
IPV6_PEERDNS=no
IPV6_PEERROUTES=no
IPV6_FAILURE_FATAL=no
NAME=enp8s0f1
UUID=eb43a315-b9e7-42fb-ab52-97e09a162825
ONBOOT=yes

我的步骤:

nmcli con add con-name team0 ifname team0 type team config '{"runner": {"name": "activebackup"}}'
nmcli con add con-name team0-port1 ifname enp8s0f0 type team-slave master team0
nmcli con add con-name team0-port2 ifname enp8s0f1 type team-slave master team0
nmcli con up team0-port2
nmcli con up team0-port1

之后我有:

NAME         UUID                                  TYPE            DEVICE
virbr0       f8b30bd2-0d92-43af-9b3d-f68c63d6822b  bridge          virbr0
team0        19542d40-dce1-4328-9b64-f44f2fd7f1fb  team            team0
team0-port2  301b2003-18d0-4186-992a-fbc758bb1c7a  802-3-ethernet  enp8s0f1
team0-port1  cafb8b30-60fc-475f-890d-0dc1191bc583  802-3-ethernet  enp8s0f0

当我为team0分配IP时,我可以从这个接口网关ping.
接下来我创建vlan和bridge:

nmcli con add con-name vlan24-team0 type vlan id 24 dev team0
nmcli con add con-name br24 type bridge ifname vibr24 stp yes
nmcli con add con-name br24-vlan24 type bridge-slave ifname team0.24 master vibr24

nmcli con show:

NAME          UUID                                  TYPE            DEVICE
virbr0        f8b30bd2-0d92-43af-9b3d-f68c63d6822b  bridge          virbr0
team0         19542d40-dce1-4328-9b64-f44f2fd7f1fb  team            team0
enp8s0f0      311d4881-f3f1-45af-b01f-b48872b00b0f  802-3-ethernet  --
enp8s0f1      eb43a315-b9e7-42fb-ab52-97e09a162825  802-3-ethernet  --
br24-vlan24   16fd96b7-10b0-42b6-88e6-38749b33f816  802-3-ethernet  --
br24          667cc267-3726-42cb-a5aa-0a2011167021  bridge          vibr24
vlan24-team0  8ec83969-254b-4f75-8bad-983bac7e1af0  vlan            team0.24
team0-port2   301b2003-18d0-4186-992a-fbc758bb1c7a  802-3-ethernet  enp8s0f1
team0-port1   cafb8b30-60fc-475f-890d-0dc1191bc583  802-3-ethernet  enp8s0f0

ip a:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    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
6: enp8s0f0: <BROADCAST,MULTICAST,LOWER_UP> mtu 1500 qdisc mq master team0 state UP qlen 1000
    link/ether 00:1b:21:79:55:4f brd ff:ff:ff:ff:ff:ff
7: enp8s0f1: <BROADCAST,LOWER_UP> mtu 1500 qdisc mq master team0 state UP qlen 1000
    link/ether 00:1b:21:79:55:4f brd ff:ff:ff:ff:ff:ff
8: team0: <BROADCAST,LOWER_UP> mtu 1500 qdisc noqueue state UP
    link/ether 00:1b:21:79:55:4f brd ff:ff:ff:ff:ff:ff
    inet6 fe80::21b:21ff:fe79:554f/64 scope link
       valid_lft forever preferred_lft forever
9: virbr0: <NO-CARRIER,BROADCAST,UP> mtu 1500 qdisc noqueue state DOWN
    link/ether 66:0e:c8:c8:9c:37 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
10: team0.24@team0: <BROADCAST,LOWER_UP> mtu 1500 qdisc noqueue state UP
    link/ether 00:1b:21:79:55:4f brd ff:ff:ff:ff:ff:ff
    inet6 fe80::21b:21ff:fe79:554f/64 scope link
       valid_lft forever preferred_lft forever
11: vibr24: <NO-CARRIER,UP> mtu 1500 qdisc noqueue state DOWN
    link/ether ca:88:56:46:e5:18 brd ff:ff:ff:ff:ff:ff

nmcli con up br24-vlan24
Error: no device found for connection 'br24-vlan24'.

nmcli con up br24
Error: Device 'vibr24' is waiting for slaves before proceeding with activation.

团队工作正常,我认为将网桥映射到vlan存在问题,因为接口vibr24已关闭,而br24-vlan24未映射到设备vlan24-team0.但我第一次这样做,也许我想念一些东西

VLAN=yes
TYPE=Vlan
PHYSDEV=team0
VLAN_ID=24
REORDER_HDR=0
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=vlan24-team0
UUID=8ec83969-254b-4f75-8bad-983bac7e1af0
ONBOOT=yes

TYPE=Ethernet
NAME=br24-vlan24
UUID=16fd96b7-10b0-42b6-88e6-38749b33f816
DEVICE=team0.24
ONBOOT=yes
BRIDGE=vibr24

DEVICE=vibr24
STP=yes
BRIDGING_OPTS=priority=32768
TYPE=Bridge
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=br24
UUID=667cc267-3726-42cb-a5aa-0a2011167021
ONBOOT=yes

在另一个链接站点上,我有cisco交换机和配置了trunk的端口通道.这是我所做的所有步骤,任何人都可以帮助我吗?

我不熟悉NetworkManager.我个人更喜欢使用iproute2 / brctl / vconfig工具的“老式”直接方法.但是我发现了这个错误报告&勘误表: https://bugzilla.redhat.com/show_bug.cgi?id=1183420与您的问题非常相关.您只是遇到将VLAN添加到桥而不是像那里的绑定接口一样的问题.但是该错误报告的解决方法也可以使用.

而不是添加br24-vlan24(因为你已经将team0.24设备与vlan24-team连接相关联而失败!),你必须编辑vlan24-team0属性以使其成为virb24的从属.

我试图重现类似于你的配置.但是没有团队合作,因为你似乎没有问题,因为你可以从team0 ping.我在我的网卡enp2s0上创建了一个桥接器br24和vlan id 24.上面的链接建议修改绑定(在我们的例子中为VLAN)连接,如下所示:

# nmcli c mod bond-bond0 connection.master br0
# nmcli c mod bond-bond0 connection.slave-type bridge

但是在Linux Mint上我失败了以下错误

$nmcli c mod vlan24-enp2s0 connection.master vibr24
    Error: Failed to modify connection 'vlan24-enp2s0': connection.slave-type: Cannot set 'master' without 'slave-type'
$nmcli c mod vlan24-enp2s0 connection.slave-type bridge
    Error: Failed to modify connection 'vlan24-enp2s0': connection.master: Slave connections need a valid 'master' property

但是在同一命令中设置两个属性有效:

$nmcli c mod vlan24-enp2s0 connection.slave-type bridge connection.master vibr24
$nmcli con up br24
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/50)
$nmcli con show
NAME                    UUID                                  TYPE            DEVICE    
br24                    502643a8-1fbd-4881-9251-7bf1599bf05f  bridge          vibr24    
vlan24-enp2s0           70cb4491-0cfb-4f5c-a0b2-9cee71eb115a  vlan            enp2s0.24 
Connection 1  1e65cdef-c819-3c30-8fc8-23f4d13f7fe1  802-3-ethernet  enp2s0

使用brctl检查以确认VLAN已启用&必然会桥接:

$brctl show
bridge name     bridge id               STP enabled     interfaces
vibr24          8000.cafedefaced0       yes             enp2s0.24

因此,根据您的配置进行调整,这个应该适合您:

nmcli con add con-name vlan24-team0 type vlan id 24 dev team0
nmcli con add con-name br24 type bridge ifname vibr24 stp yes
nmcli con mod vlan24-team0 connection.slave-type bridge connection.master vibr24

PS:刚刚注意到这个问题实际上是从2015年开始,并且由于其他用户的赏金而受到冲击.仍然我的答案解决了这个问题,因为我确实重现了这种情况并且具有相同的“找不到适合此连接的设备”.在我尝试这个解决方案之前发布OP.

猜你在找的CentOS相关文章