1
I have been assigned a block of /29 ips for a dedicated server I rent. I want to be able to keep one of these IPs for managing the server itself, and forward each of the rest to its own internal subnet, for multiple OpenVZ containers to be able to share public IPs.
For instance, I might have two web servers and two file servers in 4 containers. This is not the actual services that will be running, but for easy of example I will use them. I want one of my public IPs (XX.XX.XX.2) to point to the two containers on the 192.168.2.0/24 subnet, and the other public IP (XX.XX.XX.3) to point to the containers in the 192.158.3.0/24 subnet. Communication between the subnets is not required, but each container must be able to access the web.
I have tried using sourced based routing as described here and NAT as described on the OpenVZ wiki here without success. Host is running Centos 6, and each VM is running Debian 7 if that makes a difference.
Can you pls detail what you mean by without success? What is failing? Error messages? – MariusMatutiae – 2015-06-16T11:50:46.620
No errors per se, but just no internet connection on the VMs - can't ping anything past Host node, address or IP, traceroutes fails at host node. Nameservers are correct - using google public DNS for testing. – Adam Dodman – 2015-06-16T12:41:06.193
Pls post the output of ip addr show and of ip route show, thanks. – MariusMatutiae – 2015-06-16T13:51:18.747
Too long for comment so uploaded to pastebin here
– Adam Dodman – 2015-06-16T14:17:10.713From
ip addr show
output 216.126.193.235 and 216.126.193.236 seem to have incorrect masks – Silvio Massina – 2015-06-16T14:26:20.397I'm presuming the masks have to be changed to /29. How would I go about doing this? – Adam Dodman – 2015-06-16T14:33:38.180
Can you ping any of the containers from the host, right now? – MariusMatutiae – 2015-06-16T15:33:15.657
Yes, the host can ping the containers and the containers can ping the host. – Adam Dodman – 2015-06-16T15:43:38.687
@Adam: I suppose you set them with ifconfig. Use ifconfig eth0:0 216.126.193.235 netmask 255.255.255.248 (anf repeat for eth0:1) – Silvio Massina – 2015-06-17T08:30:37.573