Add Static IPv4 and IPv6 addresses to OpenBSD on IONOS

Note: This article has since been made into official IONOS documentation at https://www.ionos.com/help?id=5277

This article details the process of configuring a static IPv4 and IPv6 address on OpenBSD machines hosted with IONOS. It is assumed that the IP addresses you wish to use have already been assigned to your server via the Cloud Panel or IONOS Control Panel, and that you can access the command-line.

This configuration will work for both Cloud Servers and Dedicated Servers (both BMC and legacy).

Steps

  1. Determine the name of your network interface. You can run ifconfig to find it, or look through dmesg.
  2. Create /etc/hostname.INTERFACE with the contents below, replacing the parts in red with your IPs and interface, respectively. You may use vi, or your preferred editor.

    You will need to replace INTERFACE with the exact name of your network interface. (Ex. for vmx0, the file would be /etc/hostname.vmx0)

    The IPv6 section may be omitted, if you do not wish to use IPv6.
#IPv4
inet IPV4 255.255.255.255
!route add -inet 10.255.255.1 -llinfo -link -static -iface INTERFACE
!route add -inet default 10.255.255.1

#IPv6
inet6 alias IPV6/128
!route add -net ::/0 fe80::1%INTERFACE
  1. Reboot the system. You may run reboot from the command-line, or select the reboot option in your Cloud Panel or IONOS Control Panel.
  2. Your server should now have the addresses you have set. You can confirm this by checking the output of ifconfig

Troubleshooting

If you are not able to connect to your server after performing these changes, there are alternate ways to access your server. For Cloud Servers and dedicated servers (BMC), you may use the KVM/VNC console from your Cloud Panel.

For Legacy Dedicated servers, you may use the serial console, also known as SerCon, to log into your server for troubleshooting.

Mohammed has written 29 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>