IPv4 routing on Hetzner server

rys

New Member


Messages: 4

Hi all,

I have a dedicated server at Hetzner running FreeBSD 11. Hetzner give you a single IPv4 address with their servers, but you can apply for more, so I also have a /28 on a different subnet, and Hetzner route that /28 through the original single IPv4 address.

What I'm trying to do is use the addresses in the /28 for (primarily Linux!) VMs I'm running with bhyve, but I can't seem to figure out an interface/network topology on the host that works.

I've tried the simplest (to me!) thing of assigning the addresses from the /28 as aliases to the main Ethernet interface so that anything bridged to it can use them. I've tried every combination of bridging (with and without the addresses assigned to the bridges, individually or the whole /28) that I can think of. bhyve uses bridge taps (and so does vm-bhyve, a really nice bhyve wrapper that I've tried), and I've tried a bridge per IP in the /28 with a tap per VM, and a bridge with just one of the addresses with a single tap for one VM, and nothing works.

I've also tried not assigning the addresses in the /28 to anything and just configuring interfaces manually in my VMs to use them, with the original single IPv4 as the gateway. Nothing I do sees the VMs get Internet connectivity.

Here's my /etc/sysctl.conf:

Code:
net.link.tap.up_on_open=1
net.inet.ip.forwarding=1
net.link.ether.inet.proxyall=1

Here's all the interface and networking bits of my /etc/rc.conf:

Code:
ifconfig_em0="net <Hetzner supplied single IPv4 address>/32"
gateway_if="em0"
gateway_ip="<Hetzner supplied IPv4 gateway address>"
static_routes="gateway default"
route_gateway="-host $gateway_ip -interface $gateway_if"
route_default="default $gateway_ip"
gateway_enable="YES"

And I have the following in my /boot/loader.conf:

Code:
if_bridge_load="YES"
if_tap_load="YES"

Any help gratefully received. Would love to know how to get the /28 usable by my bhyve VMs, many thanks in advance.

https://wiki.hetzner.de/index.php/FreeBSD_installieren/en#IPv4 is where I started.

Cheers,

Rys
 
OP
rys

rys

New Member


Messages: 4

I should add that I've also tried having vm-bhyve manage the bridge and tap interfaces for me, and while that works from a VMs can see the interfaces point of view, using the addresses in the /28 in the VMs and getting Internet access still doesn't work.
 
OP
rys

rys

New Member


Messages: 4

As with all of these things, the act of writing it all down made me think about what I was doing in more detail. I was missing host-side routes for the IP address in the /28 to the main IPv4 address. I don't know how to make rc.conf bring them up automatically, but I can always just add that in an rc.d script somewhere.
 
Top