IP configuration on OpenBSD online.net (aka Dedibox)
Posted on April 3, 2011
Dedicated servers providers like Online.net are now proposing to address Virtual Machines by using static mac, but the configuration is not 100% “clean” on quite a few OS (see my upcoming post on how it works).
Hopefully, it’s pretty straightforward on OpenBSD, let’s assume $if is the interface connected to the Public Network , 88.190.xxx.xxx is the IP address (also called FailOver IP) given by your provider and 88.190.17.1 is the gateway.
When installing OpenBSD you can configure the IP of the device as a /32 without any problems, but when it comes to configuring the gateway it won’t work. Why? Because OpenBSD is (rightly) expecting to have the gateway on the same subnet so we have to work our way around that.
In the installation process, after configuring the network you have an option to make extra configs at the shell prompt, that’s our way out!
First of all configure the IP address of the interface:
ifconfig em0 inet 88.190.xxx.xxx netmask 255.255.255.255
If you try to ping the gateway it will fail as it’s not on the same subnet, so we need to tell OpenBSD how to reach this IP, to do this we’ll configure OpenBSD so that it will ARP for that IP on it’s external interface:
route add -inet 88.190.17.1/32 -link -iface $if
Lets try to ping the gateway …
# ping 88.190.17.1 PING 88.190.17.1 (88.190.17.1): 56 data bytes 64 bytes from 88.190.17.1: icmp_seq=0 ttl=255 time=0.551 ms 64 bytes from 88.190.17.1: icmp_seq=1 ttl=255 time=0.418 ms 64 bytes from 88.190.17.1: icmp_seq=2 ttl=255 time=0.463 ms 64 bytes from 88.190.17.1: icmp_seq=3 ttl=255 time=0.483 ms --- 88.190.17.1 ping statistics --- 4 packets transmitted, 4 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.418/0.478/0.551/0.054 ms
… and it works!
We just need to setup the gateway and finish our setup.
Now we want to make sure the interface starts at boot time, to do this we’re just going to create the file /etc/hostname.$if
with the following content:
inet 88.190.xxx.xxx 255.255.255.255 !route add -inet 88.190.17.1/32 -link -iface $if
and populate the file /etc/mygate with the IP of the gateway
88.190.17.1
Here we are, OpenBSD is running in the virtual world but connected to the real world!
Lee
August 4, 2011 (22:00)
THANK YOU for providing me with the head start I needed to solving this problem (except with provider OVH) for the last 2 days.
For anyone who stumbles across your blog as I did looking for the answer to the “OVH failover IP vmbr0 problem” (catchy…) the answer is alarmingly simple:
ifconfig $if inet 178.32.xx.xx netmask 255.255.255.255
route add -inet 0/0 -link -iface $if
And it allll magically starts working. Set up the Virtual MAC, use that as your container Mac address, ignore the confusing nonsense about adding a route on the host machine, run those commands (reboot your VM without any networking set up at all for simplicity), and voila!
Tomas
September 13, 2011 (00:51)
Hi, I’ve tried your way for openBSD network setup but with no success. Without this it’s working, so the problem is somewhere in config.
I have OpenBSD4.9 running on ESXi 4.1
Did you triend it also on ESXi? What can I send to you to help me resolve this issue? I’m not BSD expert, I’m begginer.
Tomas
Renaud
June 14, 2012 (10:51)
See my answer for the same thing at OVH: http://forum.ovh.com/showpost.php?p=495364&po…