From PrgmrWiki
Revision as of 17:04, 16 July 2018 by Adp (talk | contribs) (Adp moved page OpenBSD as a DomU to OpenBSD)


In order to install OpenBSD on a VPS, your VPS must already use HVM virtualization. If you do not know what type of virtualization you have, you can discover it via the management console. Guests on legacy systems are all PV (paravirtualized). If the management console for your VPS does not have a menu option named "system details", then you are on a legacy system, and thus your VPS is PV. For customers not on legacy hosts, use the system details option to determine your guest's virtualization type. The management console for an HVM VPS will display something similar the following on the "system details" screen:

Command result: 
    Virtualization mode: HVM
    Memory: 1280 MiB
    VCPUs: 1
    Total disk: 15 GiB
    IPs: 2605:2700:0:3:a800:ff:fe00::1234
    Last installed OS: Ubuntu Bionic 18.04 - 64 bit
    Boot option: Linux Live Rescue, 64 bit
    Boot arguments: root=LABEL=RESCUE console=ttyS0 ro rootflags=barrier=0 fastboot aufs=tmpfs

If your VPS uses PV instead of HVM, please write, and ask us to convert it to HVM.

You should also write down your static IP addresses. These are also on the system details screen.

Getting Started

First, shut down your VPS with option 3 ("shutdown") from the management console. Next, use the option named "set bootloader or rescue mode"; this is presently menu option 6. This option also allows you to access our various netboot installers. The menu you get contains an item named "BSD installers"; choose it. A new menu will appear; choose "OpenBSD". Once the boot image is set, use option 0 several times to back up to the main menu. Start the VPS; it should boot using an OpenBSD ISO.


OpenBSD's installation procedure is mostly straightforward. If you've never been through it before, it is a series of question-answer interactions, where the installer displays a question and prompts for a response. End the response by pressing enter. Here, I'll just discuss the sections which require answers specific to a VPS.

You'll be asked which interface to configure. Choose xnf0. For the install process, choose dhcp when asked for the IPV4 address, and none when asked for the IPv6 address. You could set your static addresses here, but due to special configuration necessary for IPv6, it is better to set them by editing configuration files after you have booted into the newly installed system. For the hostname, use the VPS hostname (label) you selected when signing up. The domain can be left blank.

One of the questions the installer asks is whether the default console should be set to com0, and the answer is yes. HVM guests use the first serial port as the console device. The default speed of 9600 would work, but I always use 115200.

You are also prompted to select your disk layout. Just type w (for "whole disk MBR") here. OpenBSD will automatically install the code necessary to bootstrap the system.

Once you've selected sets, the installer downloads them and performs the rest of the installation procedure with no further questions. When you get to the reboot prompt, do not reboot the VPS, because it will reboot into the CD image. Instead, select h for "halt". After some seconds, you'll be told to press any key to reboot the system. At this point, back out of the out-of-band console with ^] (ctrl + right-bracket), without pressing any other key. Select "shutdown" from the main menu, and wait. It will take a while (minutes) for the system to shut down, because OpenBSD has some kind of issue where it does not accept the shutdown signal delivered by Xen. Once the system has shut down, go back to the "set bootloader or rescue mode" menu, and choose the option to boot from disk. At the main menu, select "start". Shortly, your VPS should boot into a brand new installation of OpenBSD, and you will eventually be greeted by a login prompt.

Post-installation Network Configuration

This step is optional, but highly recommended. You've just booted into a fresh installation. It is using dhcp for IPv4 and no IPv6 address. Let's add both a static IPv4 and static IPv6 address. With your favorite text editor, open the file /etc/hostname.xnf0. Right now, it likely contains just one line:


Remove that, and replace it with the following, where MY_IPV4_ADDRESS and MY_IPV6_ADDRESS are the addresses you got from the system details screen of the management console:

inet MY_IPV4_ADDRESS prefixlen 24
inet6 MY_IPV6_ADDRESS prefixlen 64

The last two lines prevent OpenBSD from using randomized link-local addresses. Without them, IPv6 will either completely fail to work or performance will be negatively impacted.

Save the file.

Now, we're going to determine your IPv4 and IPv6 gateways. Unfortunately, they aren't given on the system details screen of the management console. The easiest way to find your IPv4 gateway would be with the command route get default. There's not a similarly easy method for IPv6, because it hasn't been configured yet. So I'll show how to determine both of them given your addresses and prefix lengths. This procedure only works for Prgmr. Other organizations aren't going to have the same network layout that we do.

Let's say that your IPv4 address is Your prefix length is 24. Take the first three groups in the dotted quad, and concatenate them with .1. That's your gateway. In our example, the gateway would be

The procedure is somewhat similar for IPv6. Suppose your IPv6 address is 2605:2700:0:3:a800:ff:fe00::1234. If you've never seen an IPv6 address, they're groups of hex digits separated by colons. Take the leftmost four groups from your address, and concatenate ::1 to get the gateway. In our example, that gives 2605:2700:0:3::1.

Now that you've computed your gateways, open the file /etc/mygate in a text editor. Right now, it is empty. Add the following lines, where MY_IPV4_GATEWAY and MY_IPV6_GATEWAY are the IPv4 and IPv6 gateway addresses you just computed.


Have a look at the file /etc/resolv.conf. It should already contain some lines starting with nameserver with nameserver addresses. Those were fetched from DHCP, before you wrote the static configuration. You shouldn't need to edit this file. Just for reference, it should probably contain the following:

lookup file bind

Finally, you should take the interface down and bring it back up, so that your new static configuration will be used.

ifconfig xnf0 down
ifconfig xnf0 up

At this point, I'd usually do a test with ping:

ping4 -c1
ping6 -c1


Following this procedure, you should have a fresh OpenBSD install, and both IPv4 and IPv6 networking should be fully configured. We hope you enjoy it.