注意: 我仍然无法使这个configuration工作,但只要我想出来就会发布我的解决scheme。
我正在设置一个Ubuntu主机服务器(16.04),其上运行着许多KVM。 主机服务器有4个物理网卡,它们成对连接以访问面向公众的networking和专用networking。 主机具有分配给它的主公有子网(只有一个可用的外部IP)和主私有子网(具有一个可用的内部IP)。 此外,我还获得了另外两个8个IP子网,其中一个是公有的,另一个是私有的,用于这台主机上的虚拟机。 例如这里是我的IP布局:
主持人:
对于VMS
我有很多麻烦让主机有一个单独的子网从我的网桥接口的虚拟机。 当我有指定的网桥时,似乎我不能让主机正确地连接到networking,而只有在绑定接口上的主机区域没有指定networking时,网桥才能工作。 我的接口文件如下。 你在这里看到的是我所期望的结果,而实际上并不工作。 我已经能够通过评论不同的部分和重新启动networking来获得作品。 我还从ISP的每条指令中添加了路由命令(路由添加),但是他们还没有能够帮助桥接方面和虚拟机。
############################################ #For more information, see interfaces(5). ############################################ ##Loopback auto lo iface lo inet loopback ## Setup bond0 interface - INTERNAL CONNECTIONS auto bond0 iface bond0 inet static bond-lacp-rate 1 #pre-up /sbin/ethtool -s bond0 speed 100 duplex full autoneg off post-up ifenslave bond0 eth0 eth2 pre-down ifenslave -d bond0 eth0 eth2 address 10.0.0.138 netmask 255.255.255.192 gateway 10.0.0.129 bond-slaves none bond-mode 4 bond-lacp-rate fast bond-miimon 100 bond-downdelay 0 bond-updelay 0 bond-xmit_hash_policy 1 up route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.0.0.129 auto eth0 iface eth0 inet manual bond-master bond0 #pre-up /sbin/ethtool -s eth0 speed 100 duplex full autoneg off auto eth2 iface eth2 inet manual bond-master bond0 #pre-up /sbin/ethtool -s eth2 speed 100 duplex full autoneg off auto br0 iface br0 inet static address 10.0.1.218 netmask 255.255.255.192 gateway 10.0.1.217 bridge_ports bond0 bridge_stp off bridge_fd 9 bridge_hello 2 bridge_maxage 12 ## Setup bond1 interface - EXTERNAL CONNECTIONS auto bond1 iface bond1 inet static bond-lacp-rate 1 post-up ifenslave bond1 eth1 eth3 pre-down ifenslave -d bond1 eth1 eth3 bond-slaves none bond-mode 4 bond-lacp-rate fast bond-miimon 100 bond-downdelay 0 bond-updelay 0 bond-xmit_hash_policy 1 address 200.0.0.75 netmask 255.255.255.248 gateway 200.0.0.73 up route add -net 0.0.0.0 netmask 0.0.0.0 gw 200.0.0.73 auto eth1 iface eth1 inet manual bond-master bond1 auto eth3 iface eth3 inet manual bond-master bond1 auto br1 iface br1 inet static address 200.0.1.242 netmask 255.255.255.248 gateway 200.0.1.241 #up iptables-restore < /etc/iptables.rules post-up echo 0 > /sys/devices/virtual/net/br1/bridge/multicast_snooping bridge_ports bond1 bridge_stp off bridge_fd 9 bridge_hello 2 bridge_maxage 12
如果我的主机上(在绑定界面上)有一个子网,我在桥接接口上指定一个特定的地址可能是错误的,但是我不知道如何为VMS指定一个单独的子网那。 在此先感谢您对我在这里做错了什么的意见/build议。
以下是我的ISP提供给我的VLAN的子网。 “仅用于未来服务器的主要IP”用于提供给另一个客户/主机的主要IP,并且不可由我访问。 此外,还有两个主要私有IP,一个可以访问我的主机操作系统,另一个是访问控制台的pipe理界面(通过它看起来像的BIOS)。
有两个VLAN,一个是公有的,一个是私有的,每个都有编号并有一个与之相关的路由器。 即公共networking的VLAN号为1200的路由器zzz02a.bbb03,私有的类似。
公共主要子网
200.0.0.72 Reserved Network 200.0.0.73 Reserved Gateway 200.0.0.74 Reserved Primary IP for future server only 200.0.0.75 In Use host.mydomain.com 200.0.0.76 Reserved Primary IP for future server only 200.0.0.77 Reserved Primary IP for future server only 200.0.0.78 Reserved Primary IP for future server only 200.0.0.79 Reserved Broadcast
公共便携式子网
200.0.1.240 Reserved Network 200.0.1.241 Reserved Gateway 200.0.1.242 Available vm1.mydomain.com 200.0.1.243 Available <<available for vm>> 200.0.1.244 Available <<available for vm>> 200.0.1.245 Available <<available for vm>> 200.0.1.246 Available <<available for vm>> 200.0.1.247 Reserved Broadcast
私有主要子网
10.0.0.128 Reserved Network 10.0.0.129 Reserved Gateway 10.0.0.130 Reserved Primary IP for future server only 10.0.0.131 Reserved Primary IP for future server only 10.0.0.132 Reserved Primary IP for future server only 10.0.0.133 Reserved Primary IP for future server only 10.0.0.134 Reserved Primary IP for future server only 10.0.0.135 Reserved Primary IP for future server only 10.0.0.136 Reserved Primary IP for future server only 10.0.0.137 Reserved Primary IP for future server only 10.0.0.138 In Use host.mydomain.com 10.0.0.139 Reserved Primary IP for future server only 10.0.0.140 Reserved Primary IP for future server only 10.0.0.141 Reserved Primary IP for future server only 10.0.0.142 Reserved Primary IP for future server only 10.0.0.143 Reserved Primary IP for future server only 10.0.0.144 Reserved Primary IP for future server only 10.0.0.145 Reserved Primary IP for future server only 10.0.0.146 Reserved Primary IP for future server only 10.0.0.147 Reserved Primary IP for future server only 10.0.0.148 Reserved Primary IP for future server only 10.0.0.149 In Use host.mydomain.com 10.0.0.150 Reserved Primary IP for future server only 10.0.0.151 Reserved Primary IP for future server only 10.0.0.152 Reserved Primary IP for future server only
私人便携子网
10.0.1.216 Reserved Network 10.0.1.217 Reserved Gateway 10.0.1.218 Available vm1.mydomain.com 10.0.1.219 Available <<available for vm>> 10.0.1.220 Available <<available for vm>> 10.0.1.221 Available <<available for vm>> 10.0.1.222 Available <<available for vm>> 10.0.1.223 Reserved Broadcast
我认为没有vlans。 如果你想把所有的4个子网共享给你的虚拟机,你应该把它们分配给这些网桥。 接口文件应该是:
############################################ #For more information, see interfaces(5). ############################################ ##Loopback auto lo iface lo inet loopback ## Setup bond0 interface - INTERNAL CONNECTIONS auto bond0 iface bond0 inet manual bond-slaves eth0 eth2 bond-mode 4 bond-lacp-rate fast bond-miimon 100 bond-downdelay 0 bond-updelay 0 bond-xmit_hash_policy 1 auto eth0 iface eth0 inet manual bond-master bond0 auto eth2 iface eth2 inet manual bond-master bond0 ## Setup VLAN ID 1201 on bond0 interface auto bond0.1201 iface bond0.1201 inet manual vlan_raw_device bond0 auto br0 iface br0 inet static address 10.0.0.138 netmask 255.255.255.192 bridge_ports bond0.1201 bridge_stp off up route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.0.0.129 auto br0:1 iface br0:1 inet static address 10.0.1.218 netmask 255.255.255.192 ## Setup bond1 interface - EXTERNAL CONNECTIONS auto bond1 iface bond1 inet manual bond-slaves eth1 eth3 bond-mode 4 bond-lacp-rate fast bond-miimon 100 bond-downdelay 0 bond-updelay 0 bond-xmit_hash_policy 1 auto eth1 iface eth1 inet manual bond-master bond1 auto eth3 iface eth3 inet manual bond-master bond1 ## Setup VLAN ID 1200 on bond1 interface auto bond1.1200 iface bond1.1200 inet manual vlan_raw_device bond1 auto br1 iface br1 inet static address 200.0.0.75 netmask 255.255.255.248 gateway 200.0.0.73 post-up echo 0 > /sys/devices/virtual/net/br1/bridge/multicast_snooping bridge_ports bond1.1200 bridge_stp off auto br1:1 iface br1:1 inet static address 200.0.1.242 netmask 255.255.255.248