虚拟机有 2 台
» virsh list --title --all
Id Name State Title
--------------------------------------------------
5 vm-01 running 192.168.2.110
6 vm-02 running 192.168.2.111
虚拟网络 2 个
» virsh net-list
Name State Autostart Persistent
--------------------------------------------------
default active yes yes
host-bridge active yes yes
default 虚拟网络信息
» virsh net-info default
Name default
UUID 96b5a0a2-fc58-4ffb-9ba3-220ce954cdd5
Active: yes
Persistent: yes
Autostart: yes
Bridge: virbr0
虚拟网络链接情况
» brctl show virbr0
bridge name bridge id STP enabled interfaces
virbr0 8000.525400319e05 yes virbr0-nic
vnet0
vnet2
» virsh domiflist vm-01
Interface Type Source Model MAC
-------------------------------------------------------
vnet0 network default virtio 52:54:00:d1:74:83
vnet1 network host-bridge virtio 52:54:00:36:70:c2
» virsh domiflist vm-02
Interface Type Source Model MAC
-------------------------------------------------------
vnet2 network default virtio 52:54:00:d3:78:cc
vnet3 network host-bridge virtio 52:54:00:23:0f:27
重启 default 虚拟网络
» virsh net-destroy default && virsh net-start default
Network default destroyed
Network default started
虚拟网络重启之后, virsh domiflist
看到信息和虚拟网络重启之前一样,但是虚拟网络使用的网桥的配置不同。
网桥状态,虚拟机的虚拟网卡不会自动重连的网桥上
» brctl show virbr0
bridge name bridge id STP enabled interfaces
virbr0 8000.525400319e05 yes virbr0-nic
需要手动添加,Guest 的网络才正常
» brctl addif virbr0 vnet0; brctl addif virbr0 vnet2