Last Updated: February 25, 2016
· finwë

Setting up OpenBSD custom route at startup

I'm actually setting up an ESXi server with 2 network :

  • One facing the Internet, where I have an OpenBSD VM which will act as a router
  • One fully virtual, where all my VM will be

My default IP address is used for the Management of ESXi.

My ISP ( provide me one IP FailOver (it's an additional IP) which I'll use for my OpenBSD router, but, there's not on the same network.

So I'll have to add a route on my OpenBSD Box to reach the Internet.

Here is how you can do this :

my Internet interface is "em0".

Edit /etc/hostname.em0 and add the following line (with em0 replaced with your Internet interface) :

!route add -inet my:ga:te:way/32 -link -iface myinterface (em0 here)

restart your network (sh /etc/netstart as root) or reboot your server and then, you'll have a functional OpenBSD router (at least for the Internet part).

Don't forget to add your gateway to /etc/mygate too.