[root@nfs ~]# virsh net-list
Name State Autostart
-----------------------------------------
default active yes
[root@nfs ~]# brctl show ##显然有两个网桥
bridge name bridge id STP enabled interfaces
br0 8000.00e06f12ac8a no eth0
virbr0 8000.52540011b2f3 yes virbr0-nic
[root@nfs ~]# ifconfig
br0 Link encap:Ethernet HWaddr 00:E0:6F:12:AC:8A
inet addr:192.168.1.62 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:6fff:fe12:ac8a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1052 errors:0 dropped:0 overruns:0 frame:0
TX packets:533 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:117606 (114.8 KiB) TX bytes:66566 (65.0 KiB)
eth0 Link encap:Ethernet HWaddr 00:E0:6F:12:AC:8A
inet6 addr: fe80::2e0:6fff:fe12:ac8a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1410 errors:0 dropped:0 overruns:0 frame:0
TX packets:1155 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:360872 (352.4 KiB) TX bytes:136226 (133.0 KiB)
Interrupt:28 Base address:0xc000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:107 errors:0 dropped:0 overruns:0 frame:0
TX packets:107 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:11824 (11.5 KiB) TX bytes:11824 (11.5 KiB)
virbr0 Link encap:Ethernet HWaddr 52:54:00:11:B2:F3
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:3378 (3.2 KiB)
[root@nfs ~]# virsh
Welcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh # net-autostart --disable default ##设置为开机不启动
Network default unmarked as autostarted
virsh # net-list
Name State Autostart
-----------------------------------------
default active no ###开始Autostart 对应的值为yes
virsh # quit
[root@nfs ~]# /etc/init.d/libvirtd restart
Stopping libvirtd daemon: [ OK ]
Starting libvirtd daemon: [ OK ]
但重启libvirtd服务后, virbr0依然存在!
只好重启机器!
[root@nfs ~]# sync
s[root@nfs ~]# sync
[root@nfs ~]# reboot ##重启机器
Broadcast message from [email protected]
(/dev/pts/0) at 23:03 ...
The system is going down for reboot NOW!
[root@nfs ~]# Last login: Fri Feb 4 22:55:10 2011 from 192.168.1.155
[root@nfs ~]# ifconfig
......
####显示内容省略,已经没有看到virbr0 网桥了
[root@nfs ~]# virsh net-list
Name State Autostart
-----------------------------------------
[root@nfs ~]# virsh net-list --all ##显示了default网桥,但Autostart对应的列为no
Name State Autostart
-----------------------------------------
default inactive no
还有一种方法:先要在上面的基础上
[root@nfs ~]# virsh net-autostart default ##将default网桥恢复为随系统自动启动
Network default marked as autostarted
[root@nfs ~]# /etc/init.d/libvirtd restart
Stopping libvirtd daemon: [ OK ]
Starting libvirtd daemon: [ OK ]
[root@nfs ~]# ifconfig
br0 Link encap:Ethernet HWaddr 00:E0:6F:12:AC:8A
inet addr:192.168.1.62 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:6fff:fe12:ac8a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:473 errors:0 dropped:0 overruns:0 frame:0
TX packets:333 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:59575 (58.1 KiB) TX bytes:38519 (37.6 KiB)
eth0 Link encap:Ethernet HWaddr 00:E0:6F:12:AC:8A
inet6 addr: fe80::2e0:6fff:fe12:ac8a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:889 errors:0 dropped:0 overruns:0 frame:0
TX packets:310 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:208317 (203.4 KiB) TX bytes:34576 (33.7 KiB)
Interrupt:28 Base address:0xc000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:107 errors:0 dropped:0 overruns:0 frame:0
TX packets:107 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:11824 (11.5 KiB) TX bytes:11824 (11.5 KiB)
virbr0 Link encap:Ethernet HWaddr 52:54:00:11:B2:F3
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:1919 (1.8 KiB)
[root@nfs ~]# virsh net-list
Name State Autostart
-----------------------------------------
default active yes
[root@nfs ~]# virsh net-destroy default
Network default destroyed
[root@nfs ~]# virsh net-list
Name State Autostart
-----------------------------------------
[root@nfs ~]# virsh net-undefine default
Network default has been undefined
[root@nfs ~]# ifconfig
br0 Link encap:Ethernet HWaddr 00:E0:6F:12:AC:8A
inet addr:192.168.1.62 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:6fff:fe12:ac8a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:623 errors:0 dropped:0 overruns:0 frame:0
TX packets:411 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:80064 (78.1 KiB) TX bytes:48613 (47.4 KiB)
eth0 Link encap:Ethernet HWaddr 00:E0:6F:12:AC:8A
inet6 addr: fe80::2e0:6fff:fe12:ac8a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1152 errors:0 dropped:0 overruns:0 frame:0
TX packets:387 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:271011 (264.6 KiB) TX bytes:44440 (43.3 KiB)
Interrupt:28 Base address:0xc000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:107 errors:0 dropped:0 overruns:0 frame:0
TX packets:107 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:11824 (11.5 KiB) TX bytes:11824 (11.5 KiB)
显然virbr0已经没有了!
[root@nfs ~]# virsh net-list --all
Name State Autostart
-----------------------------------------
[root@nfs ~]# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.00e06f12ac8a no eth0
显然virbr0 已经不存在了!
##官方文档!
You can remove all libvirt virtual networks on the machine:
Use 'virsh net-list --all' to see a list of all virtual networks
Use 'virsh net-destroy $net-name' to shutdown each running network
Use 'virsh net-undefine $net-name' to permanently remove the network
下面是virbr0 显示不出来了,如何恢复它!
[root@nfs networks]# cd /usr/share/libvirt/networks/
[root@nfs networks]# ls
default.xml
[root@nfs networks]# clear
[root@nfs networks]# ls
default.xml
[root@nfs networks]# virsh net-list --all
Name State Autostart
-----------------------------------------
[root@nfs networks]# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.00e06f12ac8a no eth0
vnet0
[root@nfs networks]# virsh net-define /usr/share/libvirt/networks/default.xml
Network default defined from /usr/share/libvirt/networks/default.xml
[root@nfs networks]# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.00e06f12ac8a no eth0
vnet0
[root@nfs networks]# virsh net-list --all
Name State Autostart
-----------------------------------------
default inactive no
[root@nfs networks]# virsh net-start default
Network default started
[root@nfs networks]# virsh net-autostart default
Network default marked as autostarted
[root@nfs networks]# virsh net-list --all
Name State Autostart
-----------------------------------------
default active yes
[root@nfs networks]# brc
brcm_iscsiuio brctl
[root@nfs networks]# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.00e06f12ac8a no eth0
vnet0
virbr0 8000.5254001e3f67 yes virbr0-nic