ネットワーク再起動後に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ネットワークを監視しないでください。

したがって、一部のネットワークインターフェイスを再接続する必要があります。

すべての仮想マシンの再起動をテストする必要があり、問題がなければサーバーを再起動できます。

関連情報