在我的 CentOS 7.2 中,我安装了以下软件包:
yum install -y epel-release qemu-kvm libvirt virt-install bridge-utils
然后当我展示时ip a
:
[root@localhost ~]# ip a
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 state UP group default qlen 1000
link/ether e8:9a:8f:50:4a:dc brd ff:ff:ff:ff:ff:ff
inet 13.19.241.25/29 brd 13.19.241.31 scope global em1
valid_lft forever preferred_lft forever
inet 13.19.241.26/8 brd 13.255.255.255 scope global em1
valid_lft forever preferred_lft forever
inet6 fe80::ea9a:8fff:fe50:4adc/64 scope link
valid_lft forever preferred_lft forever
3: em2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether e8:9a:8f:50:4a:dd brd ff:ff:ff:ff:ff:ff
inet 103.193.241.25/29 brd 103.193.241.31 scope global em2
valid_lft forever preferred_lft forever
inet6 fe80::ea9a:8fff:fe50:4add/64 scope link
valid_lft forever preferred_lft forever
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:f9:a9:cf 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
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
link/ether 52:54:00:f9:a9:cf brd ff:ff:ff:ff:ff:ff
您会看到添加了两个网络设备:virbr0
和virbr0-nic
。它们是什么,它们的作用是什么?
哪个软件包安装了添加的两个设备?
答案1
当您安装该libvirt
服务时,会virbr0
自动创建一个virtual network switch
.
所有虚拟机都将连接到virbr0
.
默认情况下virbr0
使用NAT模式,可以通过NAT模式提供Internet访问。默认情况下virbr0
分配地址192.168.122.1
,并且可以为连接到它的其他虚拟接口提供 DHCP 服务。
如果你使用,你可以找到一个名为brctl show
的接口:virbr0
virbr0-nic
[root@localhost network-scripts]# brctl show
bridge name bridge id STP enabled interfaces
...
virbr0 8000.5254003caaaa yes virbr0-nic