systemctl 重新启动网络后桥接配置重置

systemctl 重新启动网络后桥接配置重置

我目前有一台 Centos 7 KVM 主机,其网络配置如下:

[root@workhorse1 log]# ip add
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: em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master vb2 state UP group default qlen 1000
    link/ether 00:21:9b:9d:75:07 brd ff:ff:ff:ff:ff:ff
3: em2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq master vb1 state DOWN group default qlen 1000
    link/ether 00:21:9b:9d:75:09 brd ff:ff:ff:ff:ff:ff
4: em3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 00:21:9b:9d:75:0b brd ff:ff:ff:ff:ff:ff
5: em4: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 00:21:9b:9d:75:0d brd ff:ff:ff:ff:ff:ff
10: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:bf:c6:48 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
11: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
    link/ether 52:54:00:bf:c6:48 brd ff:ff:ff:ff:ff:ff
16: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vb1 state UNKNOWN group default qlen 1000
    link/ether fe:54:00:f8:58:d1 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fc54:ff:fef8:58d1/64 scope link
       valid_lft forever preferred_lft forever
17: vnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vb2 state UNKNOWN group default qlen 1000
    link/ether fe:54:00:16:6f:bc brd ff:ff:ff:ff:ff:ff
18: vnet2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vb3 state UNKNOWN group default qlen 1000
    link/ether fe:54:00:de:07:95 brd ff:ff:ff:ff:ff:ff
19: vnet3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vb4 state UNKNOWN group default qlen 1000
    link/ether fe:54:00:7e:d9:ac brd ff:ff:ff:ff:ff:ff
20: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 62:30:db:db:51:bd brd ff:ff:ff:ff:ff:ff
27: vi2@vi1: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop master vb3 state DOWN group default qlen 1000
    link/ether 72:82:e9:ed:08:e8 brd ff:ff:ff:ff:ff:ff
28: vi1@vi2: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether de:3c:55:e8:61:2e brd ff:ff:ff:ff:ff:ff
    inet 172.16.0.3/24 scope global vi1
       valid_lft forever preferred_lft forever
29: vi4@vi3: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop master vb4 state DOWN group default qlen 1000
    link/ether 3e:7c:e9:96:b9:a5 brd ff:ff:ff:ff:ff:ff
30: vi3@vi4: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 9a:6d:01:d6:70:ea brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.3/24 scope global vi3
       valid_lft forever preferred_lft forever
31: vb2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:21:9b:9d:75:07 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.16/24 brd 192.168.1.255 scope global noprefixroute vb2
       valid_lft forever preferred_lft forever
    inet6 fe80::221:9bff:fe9d:7507/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
32: vb1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:21:9b:9d:75:09 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::221:9bff:fe9d:7509/64 scope link
       valid_lft forever preferred_lft forever
33: vb3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 72:82:e9:ed:08:e8 brd ff:ff:ff:ff:ff:ff
    inet 172.16.0.2/24 brd 172.16.0.255 scope global noprefixroute vb3
       valid_lft forever preferred_lft forever
    inet6 fe80::7082:e9ff:feed:8e8/64 scope link
       valid_lft forever preferred_lft forever
34: vb4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 3e:7c:e9:96:b9:a5 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.2/24 brd 10.0.0.255 scope global noprefixroute vb4
       valid_lft forever preferred_lft forever
    inet6 fe80::3c7c:e9ff:fe96:b9a5/64 scope link
       valid_lft forever preferred_lft forever

[root@workhorse1 log]# brctl show
bridge name     bridge id               STP enabled     interfaces
vb1             8000.00219b9d7509       yes             em2
                                                        vnet0
vb2             8000.00219b9d7507       no              em1
                                                        vnet1
vb3             8000.7282e9ed08e8       yes             vi2
                                                        vnet2
vb4             8000.3e7ce996b9a5       yes             vi4
                                                        vnet3
virbr0          8000.525400bfc648       yes             virbr0-nic

 <interface type='bridge'>
      <mac address='52:54:00:f8:58:d1'/>
      <source bridge='vb1'/>
      <target dev='vnet0'/>
      <model type='e1000'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='bridge'>
      <mac address='52:54:00:16:6f:bc'/>
      <source bridge='vb2'/>
      <target dev='vnet1'/>
      <model type='e1000'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </interface>
    <interface type='bridge'>
      <mac address='52:54:00:de:07:95'/>
      <source bridge='vb3'/>
      <target dev='vnet2'/>
      <model type='e1000'/>
      <alias name='net2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </interface>
    <interface type='bridge'>
      <mac address='52:54:00:7e:d9:ac'/>
      <source bridge='vb4'/>
      <target dev='vnet3'/>
      <model type='e1000'/>
      <alias name='net3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </interface>

当我 时systemctl restart network,虚拟接口(vi1、vi2、vnet0-vnet3)的网桥奴役不会持续存在,我必须重新奴役每个虚拟接口。我用 来奴役虚拟接口ip link set vnet3 master vb4

如何使虚拟接口网桥奴役在服务和计算机重新启动之间持续存在?

答案1

当您执行此操作时systemctl restart network,它会清除您的所有网络配置。此操作导致您创建的所有桥梁全部关闭并重新启动。

要知道,启动虚拟机后,libvirtd不要监控网络。

因此,您被迫重新关联一些网络接口。

您必须测试所有虚拟机的重新启动,如果没有问题,则可以重新启动服务器。

相关内容