9月 042013
 

libvirt的default虚拟网络不使用任何物理接口,仅使用NAT和IP包转发实现与外部网络通信

查看可用的虚拟网络

[root@localhost ~]# virsh net-list
 Name State Autostart Persistent
 --------------------------------------------------
 default active yes yes

停止一个虚拟网络

[root@localhost ~]# virsh net-destroy default
 Network default destroyed

[root@localhost ~]# virsh net-list
Name State Autostart Persistent
--------------------------------------------------

取消default网络定义

[root@localhost ~]# virsh net-undefine default
 Network default has been undefined

[root@localhost ~]#

查看default虚拟网络的定义文件

[root@localhost ~]# cat /usr/share/libvirt/networks/default.xml
<network>
<name>default</name>
<bridge name="virbr0" />
<forward/>
  <ip address="192.168.122.1" netmask="255.255.255.0">
    <dhcp>
      <range start="192.168.122.2" end="192.168.122.254" />
    </dhcp>
  </ip>
</network>
[root@localhost ~]#

重新定义default(NAT模式)网络

[root@localhost ~]# virsh net-define /usr/share/libvirt/networks/default.xml
Network default defined from /usr/share/libvirt/networks/default.xml

[root@localhost ~]#

设置default网络为自动启动

[root@localhost ~]# virsh net-autostart default
 Network default marked as autostarted

[root@localhost ~]#

启用default网络

[root@localhost ~]# virsh net-start default
 Network default started

[root@localhost ~]# virsh net-list
 Name State Autostart Persistent
 --------------------------------------------------
 default active yes yes

[root@localhost ~]#

查看桥接设备列表信息

[root@localhost ~]# brctl show
 bridge name bridge id STP enabled interfaces
 virbr0 8000.525400102ed2 yes virbr0-nic
 [root@localhost ~]#

启用桥接接口br0并安装一个虚拟机后查看桥接设备列表信息

[root@localhost ~]# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000b2f82148e no eth0
                         vnet0
virbr0 8000.525400102ed2 yes virbr0-nic
[root@localhost ~]#

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据