KVM – 用于主接口的DHCP桥接接口

我正在设置Ubuntu 10.04服务器来运行KVM。 我需要虚拟机具有桥接networking,因为它们将成为我的主要局域网的一部分。 此外, eth0 (服务器上的主要networking接口)使用DHCP从DHCP服务器获得静态IP(这样,我有一个中心点来更改我的服务器的IP)。

当试图添加br0接口时(如http://wiki.libvirt.org/page/Networking#Bridged_networking_.28aka_.22shared_physical_device.22.29所述 ),我按如下所示更改了我的/etc/network/interfaces

 # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp # The bridge network interface, used by kvm auto br0 iface br0 inet manual bridge_ports eth0 bridge_stp yes bridge_fd 0 bridge_maxwait 0 

我还在sysctl.conf添加了以下几行:

 net.bridge.bridge-nf-call-ip6tables = 0 net.bridge.bridge-nf-call-iptables = 0 net.bridge.bridge-nf-call-arptables = 0 

一旦我重新启动服务器,我断开连接到eth0(传出和ingoing)。

这个configuration有什么问题? 什么是推荐的设置?

我看到的主要区别是,我的configuration(也在Ubuntu 10.04上) – 幸运的是,它不直接将IP等分配给eth0接口,而是分配给br0接口。

请注意,在我的configuration中,guest虚拟机被configuration为使用DHCP,并且与/ etc / network / interfaces一起使用,如下所示:

 # The primary network interface auto eth0 iface eth0 inet manual # bridge interface for kvm auto br0 iface br0 inet static address 192.168.1.254 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 4.2.2.1 8.8.8.8 dns-search mycompany.com bridge_ports eth0 bridge_fd 9 bridge_hello 2 bridge_maxage 12 bridge_stp off 

我敢肯定,你可以把“iface br0 inet static”的部分改为dhcp,并删除地址,networking掩码,networking,网关等等。

我至less还没有弄乱sysctl.conf的设置。