用于KVM的Ubuntu 12.04 LTS中的桥接适配器

全新安装Ubuntu 12.04 LTS,安装libvert / KVM。 我有两台虚拟机,需要与主机位于同一个局域网中。 主机有两个物理接口eth0和eth1。 eth1没有被使用。 我希望eth0有一个静态分配的IP,并作为我的虚拟机的桥梁。

在设置网桥之前,我的/ etc / network / interfaces如下所示:

# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 10.0.5.5 netmask 255.255.255.0 gateway 10.0.5.254 dns-nameservers 10.0.5.1 

一切工作如预期在这个configuration下。 但是,当我应用下面的标题configuration时:

 # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto br0 iface br0 inet static address 10.0.5.5 netmask 255.255.255.0 gateway 10.0.5.254 dns-nameservers 10.0.5.1 bridge_ports eth0 bridge_stp off bridge_maxwait 0 bridge_fd 0 

在此configuration下,我可以通过IP和名称来ping内部主机。 名称parsing按预期工作。 尝试ping外部主机产生“没有路由到主机”。

这是应用桥configuration后的ifconfig -a。

 br0 Link encap:Ethernet HWaddr 00:25:90:da:29:8f inet addr:10.0.5.5 Bcast:10.0.5.255 Mask:255.255.255.0 inet6 addr: fe80::225:90ff:feda:298f/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:11569 errors:0 dropped:0 overruns:0 frame:0 TX packets:586 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1433248 (1.4 MB) TX bytes:63079 (63.0 KB) eth0 Link encap:Ethernet HWaddr 00:25:90:da:29:8f inet addr:10.0.5.107 Bcast:10.0.5.255 Mask:255.255.255.0 inet6 addr: fe80::225:90ff:feda:298f/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:13632 errors:0 dropped:122 overruns:0 frame:0 TX packets:1240 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2008747 (2.0 MB) TX bytes:119540 (119.5 KB) Interrupt:20 Memory:dfa00000-dfa20000 eth1 Link encap:Ethernet HWaddr 00:25:90:da:29:8e UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:16 Memory:df900000-df920000 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:65536 Metric:1 RX packets:745 errors:0 dropped:0 overruns:0 frame:0 TX packets:745 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:66095 (66.0 KB) TX bytes:66095 (66.0 KB) virbr0 Link encap:Ethernet HWaddr c2:dd:f8:44:eb:2d inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) 

最终,我希望eth0具有静态10.0.5.5,并将这两个虚拟机的静态分配给10.0.5.6-7。 我的configuration有什么问题?