今天收了一台leaseweb服务器，上面有两个IP range，主IP是/29, 第二个IP range是/24.
第二个/24 IP range, 没有自己的gateway IP 和 broadcast IP，是因为直接把这个IP range static route 到服务器的主IP，这样做的好处是省了两个IP. 但是对于虚拟化来说，这却是个不好的消息. 因为没有gateway，需要自己设置一个gateway，比较麻烦. 下面是搜索到的解决方案:
1) Secondary IP blocks are delivered as a static route towards the main IP of the server. I f you are binding these IPs directly to your machine, you should use a 255.255.255.255 netmask for each IP to allow all IPs to be usable. If you are performing virtualization with anything other than OpenVZ, then you would need to establish a gateway in the secondary block and subnet accordingly on your side. --- 2) Secondary ranges are statically routed towards the main IP of the server itself and there is no defined gateway on our side. If you are using these directly on the machine or with OpenVZ, then no special configuration is needed and all IPs within the secondary subnet may be utilized without waste for a network, gateway, or broadcast. If you are configuring with Xen, KVM, or other similar methods of virtualization, you would need to setup a routed bridge to create a gateway for your VMs.
3) 来自于iweb.com, 在他们的knowledgebase 直接写了几个example, 如果用hyper-v 或者proxmox 的话会非常舒服，用esxi 的话也基本上是一个原理.
Additional IPs at iWeb are not provided with an additional gateway so customers using VMWare or other virtualization tools might be wondering how they can use the additional IPs to create new Guest OS or Virtual Machines. It can be done by configuring VMWare to bridge connection to eth0.
Here is the specific way to make it work
Configure your first additional IP as a secondary IP on eth0:0
IP configuration is done in /etc/sysconfig/network-scripts/ifcfg-eth0:0
Enable IP forwarding to route VM traffic
IP forwarding can be enabled by adding net.ipv4.ip_forward = 1 to /etc/sysctl.conf
In VMWare make sure that your VM uses the bridge connection to eth0.
Configure your VM with one of your remaining 5 additional IPs.
The netmask is 255.255.255.248 (If you have been provided with 6 IPs). You can calculate the netmask via a website such as http://www.ipcalc.net/
Use XX.XX.XX.1 as the gateway
Example with actual IPs:
If you have been assigned the following additional IPs:
You would :
Configure the ip 126.96.36.199 as a secondary IP on eth0:0
Enable IP forwarding to route VM traffic
Make sure that your VM uses the bridge connection to eth0
Configure your VM with one of the available IPs (.170, .171, .172, .173 or .174)
Use 255.255.255.248 as the Netmask.
Use 188.8.131.52 as gateway.
Your VM’s network should now be properly configured!
This document takes in consideration that the host server network interface is configured with the following network configuration
Primary IP: <your primary ip address>
Gateway: <your primary ip address gateway>
Secondary IP: <your secondary ip address>
Gateway: <your primary ip address gateway>:
The secondary IP is crucial since it acts as a gateway for the virtual machine, in this case we used the first IP of the range.
Step 1. Enable bridged network configuration on virtual network interfaces
Open Start->Program Files->Vmware->Vmware server->Manage Virtual network
Open the Automatic bridging tab
Uncheck the automatic bridging
Open the Host Virtual Network Mapping tab
In the vmnet0 drop down menu select the interfaces which is configured with your primary address
Close the virtual network manager
Open Start->Program Files->Vmware->Vmware server-> Vmware server
Within the summary of the vm set the network interface for each vm to bridged
Step 2. Configure vm virtual network interfaces
Open the vm you wish to configure
Open Start->Network Connections (within the vm)
Configure the network interface with one of your secondary ip address (except the secondary ip you are using on the main host):
IP: <another secondary ip address>
Gateway: <the main host secondary ip address>
Step 3. Enable routing and remote access
Mare sure the windows firewall is disabled.
Routing and Remote access must be enabled on the main host as well as the vm’s
Open Start->Administrative Tools->Routing and Remote access
Right-click on the server
Select Configure and Enable Routing and Remote access
Select Custom configuration, click next
Select LAN Routing, click next
Make sure the service is started
Update: Since September 2012, iWeb provides a /28 range of primary IP. It allows you to use the same gateway for the VM as well as the host itself in bridge mode.