Further to a previous post regarding combining public and private IPs that I was not very lucky with, I've managed to have a working setup for OpenVZ containers sharing either public or private IPs as follows:
I can now setup either public or private IPs or even combine them on machines with standart venet network without major hassle. Local IPs seems to reach each other well.
My problem has now appeared when trying to optimize roots on the host machine.
I was hoping a VM with a public IP 46.XXX.XXX.001 and a secondary local 10.0.0.100 could access another local IP VM 10.0.0.200 directly as a local IP. I mean if 10.0.0.200 hosts a MySQL I would like to setup permissions to allow traffic only from any 10.0.0.XXX ip but it keeps reporting as the public venet address.
I understand this should be a simple ip route rules on the host system, but so far I have not managed to get it to work. Any help, reference or alternative setup would be mostly appreciated.
Code:
# network interface settings
auto lo vmbr0 vmbr1 vmbr10
iface lo inet loopback
iface eth0 inet manual
iface vmbr0 inet static
address 46.xxx.xxx.184
netmask 255.255.255.0
gateway 46.xxx.xxx.254
broadcast 46.xxx.xxx.255
bridge_ports eth0
bridge_stp off
bridge_fd 0
network 46.xxx.xxx.0
iface vmbr1 inet manual
bridge_ports dummy0
bridge_stp off
bridge_fd 0
post-up /etc/pve/kvm-networking.sh
iface vmbr10 inet static
address 10.0.0.1
netmask 255.255.255.0
broadcast 10.0.0.255
network 10.0.0.0
bridge_ports none
bridge_stp off
bridge_fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j MASQUERADE
I can now setup either public or private IPs or even combine them on machines with standart venet network without major hassle. Local IPs seems to reach each other well.
My problem has now appeared when trying to optimize roots on the host machine.
I was hoping a VM with a public IP 46.XXX.XXX.001 and a secondary local 10.0.0.100 could access another local IP VM 10.0.0.200 directly as a local IP. I mean if 10.0.0.200 hosts a MySQL I would like to setup permissions to allow traffic only from any 10.0.0.XXX ip but it keeps reporting as the public venet address.
I understand this should be a simple ip route rules on the host system, but so far I have not managed to get it to work. Any help, reference or alternative setup would be mostly appreciated.