Route OVH IP block to Hetzner to be used by virtual machines?

harmonyp

Member
Nov 26, 2020
196
4
23
46
Public IPv4 server 1 (OVH bare metal) : 141.94.199.xxx
Public IPv4 server 2 (Hetzner bare metal) : 5.9.105.xxx
IP block I want to use on server 2: 164.132.xxx.xxx/28 (OVH IP Block)

Can someone please assist me on how I can do this via GRE tunnel? Both have Proxmox installed.

Also what would the downsides be to this? (other than extra latency) I know there can be some issues with running a VPN for example due to MTU not being 1500
 
Last edited:
I have tried the following which gets 164.132.xxx.1 pinging on the OVH node but not publicly.

Code:
Public IPv4 (OVH) server 1: 141.94.176.xxx
Public IPv4 server 2 (Hetzner) : 5.9.105.xxx
IP block I want to use on server 2 (OVH IP Block): 164.132.xxx.0/28
Bridge interface server2: vmbr0

Run this on server 1:

ip tunnel add gre1 mode gre remote 5.9.105.xxx local 141.94.176.xxx ttl 255
ip link set gre1 up

Run this on server 2:

ip tunnel add gre1 mode gre remote 141.94.176.xxx local 5.9.105.xxx ttl 255
ip link set gre1 up

Then we need to create a route on server 1 that will route the IP traffic over the GRE tunnel

Run this on server 1:

ip route add 164.132.xxx.0/28 dev gre1

The next step is to route data from the GRE tunnel to the bridge and back.

Run this on server 2:

ip rule add from 164.132.xxx.0/28 table 666
ip route add default dev gre1 table 666
ip route add 164.132.xxx.0/28 dev vmbr0 table 666

Last thing to do is to add the a IP the to bridge. This is gonna be the gateway for you VM's!
Use the second IP of the range!

Run this on server 2:

ip addr add 164.132.xxx.1/28 dev vmbr0

OVH Node:

Code:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 02:00:00:c5:bc:6f brd ff:ff:ff:ff:ff:ff
    inet 141.94.176.xxx/32 brd 141.94.176.xxx scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::ff:fec5:bc6f/64 scope link
       valid_lft forever preferred_lft forever
3: gre0@NONE: <NOARP> mtu 1476 qdisc noop state DOWN group default qlen 1000
    link/gre 0.0.0.0 brd 0.0.0.0
4: gretap0@NONE: <BROADCAST,MULTICAST> mtu 1462 qdisc noop state DOWN group default qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
5: gre1@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1476 qdisc noqueue state UNKNOWN group default qlen 1000
    link/gre 141.94.176.xxx peer 5.9.105.xxx
    inet6 fe80::200:5efe:8d5e:b0a0/64 scope link
       valid_lft forever preferred_lft forever

Hetzner Node:

Code:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp7s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 50:eb:f6:22:f4:72 brd ff:ff:ff:ff:ff:ff
    inet 5.9.105.xxx/27 scope global enp7s0
       valid_lft forever preferred_lft forever
    inet6 2a01:4f8:162:4202::2/64 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::52eb:f6ff:fe22:f472/64 scope link
       valid_lft forever preferred_lft forever
3: vmbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether a2:2a:09:2a:f3:36 brd ff:ff:ff:ff:ff:ff
    inet 164.132.xxx.1/32 scope global vmbr0
       valid_lft forever preferred_lft forever
    inet6 fe80::a02a:9ff:fe2a:f336/64 scope link
       valid_lft forever preferred_lft forever
4: vmbr1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether e2:b3:f0:04:70:50 brd ff:ff:ff:ff:ff:ff
5: gre0@NONE: <NOARP> mtu 1476 qdisc noop state DOWN group default qlen 1000
    link/gre 0.0.0.0 brd 0.0.0.0
6: gretap0@NONE: <BROADCAST,MULTICAST> mtu 1462 qdisc noop state DOWN group default qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
7: erspan0@NONE: <BROADCAST,MULTICAST> mtu 1450 qdisc noop state DOWN group default qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
8: gre1@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1476 qdisc noqueue state UNKNOWN group default qlen 1000
    link/gre 5.9.105.xxx peer 141.94.176.xxx
    inet6 fe80::200:5efe:509:69cc/64 scope link
       valid_lft forever preferred_lft forever
18: tap100i0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vmbr0 state UNKNOWN group default qlen 1000
    link/ether ae:50:31:a7:74:60 brd ff:ff:ff:ff:ff:ff

I tried creating a virtual machine with 164.132.xxx.2/28 and 164.132.xxx.1 as the GW but no luck either (does not ping from OVH or publicly)
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!