Adding Static IPv4 and IPv6 Addresses to OpenBSD at IONOS
For IONOS Cloud Servers and Dedicated Servers
In this article, we'll show you the process for configuring a static IPv4 and IPv6 address on OpenBSD machines hosted with IONOS.
- You have already assigned the IP addresses you wish to use to your server via the Cloud Panel or IONOS Control Panel.
- You have command line access.
- Determine the name of your network interface. You can run ifconfig to find it, or look through dmesg.
- Create /etc/hostname.INTERFACE with the contents below, replacing the parts in red with your IP addresses and interface, respectively. You can use vi or your preferred editor for this step.
You will need to replace INTERFACE with the exact name of your network interface. For example, with the interface vmx0, the file would then become /etc/hostname.vmx0.
The #IPv6 section below can be omitted if you do not wish to use IPv6.
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
inet6 alias IPV6/128
!route add -net ::/0 fe80::1%INTERFACE
- Reboot the system by either running reboot from the command line or by restarting it in your Cloud Panel or IONOS Control Panel.
- Your server should now have the addresses you entered previously. You can confirm this by checking the output of the ifconfig command.
If you are not able to connect to your server after performing the changes above, there are alternate ways to access your server. For Cloud Servers and Dedicated Servers (BMC) managed in the Cloud Panel, you can use the KVM console or the VNC console to gain access.
For legacy Dedicated Servers that are not managed in the Cloud Panel, you can use the serial console, also known as SerCon, to log in to your server for troubleshooting.