Hi there,
I have 2 OVH hosted servers that are in a vRack.
The first one is Debian machine with a database (only eth0 is linked).
The second one is Debian / Proxmox with several VM (only eth2 is linked).
Both olds public and private IP.
The idea is for the VM to communicate with the database through a private network within the vrack.
I can't manage to get the setup right to achive this requirement.
Here are the configuration:
- 1st server, interface config:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address <public IP>
netmask 255.255.255.0
broadcast <BCaddress>
gateway <GW>
I am adding a new private IP to the interface:
addr add 172.16.0.2/12 dev eth0
And set the default route:
ip rule add from <public IP>/24 table 10
ip route add default via <GW> dev eth0 table 10
- 2nd server, interface config:
auto lo
iface lo inet loopback
# vmbr0: Bridging. Make sure to use only MAC adresses that were assigned to you.
auto vmbr0
iface vmbr0 inet static
address <public IP>
netmask 255.255.255.0
broadcast <BCaddress>
gateway <GW>
bridge_ports eth2
bridge_stp off
bridge_fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
# Virtual interface - Private IP configuration
auto vmbr2
iface vmbr2 inet static
address 172.16.0.1
netmask 255.240.0.0
bridge_ports none
bridge_stp off
bridge_fd 0
I am adding a NAT for the VM to be able to go on the internet:
iptables -t nat -A POSTROUTING -s '172.16.0.0/12' -o vmbr0 -j MASQUERADE
I am adding the route for the private IP:
route add -net 172.16.0.0 gw 172.16.0.1 netmask 255.240.0.0
- Virtual machine on the 2nd server:
Here is the routing table:
Destination Gateway Flags Netif Expire
default 172.16.0.1 UGS em0
127.0.0.1 link#2 UH lo0
172.16.0.0/12 link#1 U em0
172.16.0.3 link#1 UHS lo0
The 2 servers connot bing themselves, so neither can the VM and the DataBase...
I would really appreciate any help
Thank you.
I have 2 OVH hosted servers that are in a vRack.
The first one is Debian machine with a database (only eth0 is linked).
The second one is Debian / Proxmox with several VM (only eth2 is linked).
Both olds public and private IP.
The idea is for the VM to communicate with the database through a private network within the vrack.
I can't manage to get the setup right to achive this requirement.
Here are the configuration:
- 1st server, interface config:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address <public IP>
netmask 255.255.255.0
broadcast <BCaddress>
gateway <GW>
I am adding a new private IP to the interface:
addr add 172.16.0.2/12 dev eth0
And set the default route:
ip rule add from <public IP>/24 table 10
ip route add default via <GW> dev eth0 table 10
- 2nd server, interface config:
auto lo
iface lo inet loopback
# vmbr0: Bridging. Make sure to use only MAC adresses that were assigned to you.
auto vmbr0
iface vmbr0 inet static
address <public IP>
netmask 255.255.255.0
broadcast <BCaddress>
gateway <GW>
bridge_ports eth2
bridge_stp off
bridge_fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
# Virtual interface - Private IP configuration
auto vmbr2
iface vmbr2 inet static
address 172.16.0.1
netmask 255.240.0.0
bridge_ports none
bridge_stp off
bridge_fd 0
I am adding a NAT for the VM to be able to go on the internet:
iptables -t nat -A POSTROUTING -s '172.16.0.0/12' -o vmbr0 -j MASQUERADE
I am adding the route for the private IP:
route add -net 172.16.0.0 gw 172.16.0.1 netmask 255.240.0.0
- Virtual machine on the 2nd server:
Here is the routing table:
Destination Gateway Flags Netif Expire
default 172.16.0.1 UGS em0
127.0.0.1 link#2 UH lo0
172.16.0.0/12 link#1 U em0
172.16.0.3 link#1 UHS lo0
The 2 servers connot bing themselves, so neither can the VM and the DataBase...
I would really appreciate any help
Thank you.
Last edited: