Centos – Bridge networking static IP’s to virtualbox VM’s

bridgecentosroutingstatic-ipvirtualbox

Ok, so I have a dedicated server with the static primary IP address 89.200.xx.xx, it's running 3 VM's in virtualbox (all Centos 6 as is the server) and I have 3 other IP's that I want to assign to the VM's (numbers omitted for obvious reasons):

  • 33.xxx.xxx.155
  • 33.xxx.xxx.160
  • 33.xxx.xxx.161

So I setup a bridge connection on the Centos 6 host and configured it to listen on eth0 and I assigned it the IP address 33.xxx.xxx.155. I then started the guest OS and configured it's static IP address to be 33.xxx.xxx.155 (this is after pointing the VB config at the bridge). I then tried to run "ifup eth0" and it returned "Error, some other host already uses address 33.xxx.xxx.155". OK. So I went back to the host and removed the bridges IP address. I then restarted the bridge and the virtual machine and assigned eth0 on the guest the IP address 33.xxx.xxx.155. Sure enough eth0 came up with that IP address, great! Except I can't access it. I have HTTPD running on the server and port 80 is correctly allowed in the IPtables but I can't see the server. I can't even ping it.

Any help would be appreciated, this is my first bridge network configuration.

Best Answer

Most probably this happens because the IPs 33.xxx.xxx.xxx are not being routed into the network where the 89.xxx.xxx.xxx IP is located

Saying it in another way: you are placing 33.x.x.x IPs in a network which is prepared for 89.x.x.x IPs. The internet routers will not know that 33.x.x.x is inside the 89.x.x.x network, and so they cannot route packets into the 33.x.x.x IPs

To properly use the 33.x.x.x IPs, you must use them inside the ISP that gave you those IPs, because that ISP will have correctly setup the network 33.x.x.x where you can configure the 33.x.x.x IPs

Well, you can try to configure the VB-GUEST servers with "Host-only networking" and running services in different ports across the servers, and then goto the VB_HOST and configure it with PAT (port address tranlation), mapping each GUEST service into a different port on the public IP, so that the VB_HOST acts like a firewall for the VB_GUESTs.

Do notice that there would only be 1 public IP, the one of the VB_HOST, for all the services of the VB_GUESTs, and it's the PAT which will allow you to use the one public IP to access all the VB_GUESTs services.

Tell us how it went - cheers