Static IP addresses are assigned to devices directly. Such an as­sign­ment can be done under the Unix de­riv­at­ive OpenBSD by means of a con­fig­ur­a­tion file. Only a few steps are required for this.

What do I need to consider when con­fig­ur­ing a static IP address?

Having a static IP address for your server is be­ne­fi­cial in that it enables customers to locate you more easily through the Domain Name System (DNS). That’s because your IP doesn’t change and has the notable advantage of making the DNS setup easier too. Given the scarcity of IPv4 addresses, it’s re­com­men­ded that when con­fig­ur­ing your IP addresses, you take advantage of the benefits of IPv6 by also storing an IPv6 address.

To configure a static IP address on the OpenBSD operating system, you need to associate the IP addresses you intend to use with your server. If you’re using an IONOS server, you can link these addresses con­veni­ently through the IONOS Cloud Panel. However, to set up a static IPv4 or IPv6 address on OpenBSD, you must have access to the system’s internal terminal. After identi­fy­ing your network’s name, you can create a file that specifies the server’s IP addresses.

How to assign a static IP address to IONOS servers: A step-by-step guide

After you’ve as­so­ci­ated the IP addresses of your choice with your server in the Cloud Panel, you can adjust the settings on the server in just a few steps so that the server can be found at the desired static address.

Step 1: Find out the name of your network interface

To assign IP addresses, you must first identify the name of your network interface. This can be ac­com­plished easily using the ifconfig command built into OpenBSD. Simply open a command line and enter the command to display a list of available network in­ter­faces. Ethernet in­ter­faces typically start with the prefix ‘en’.

Step 2: Create the file

Next, you’ll need to create a file for assigning the static IPv4 or IPv6 address in OpenBSD at the path /etc/hostname.INTERFACE, replacing INTERFACE with the name of your network interface. To ac­com­plish this, you can use the terminal and any editor of your choice, such as vim.

Step 3: Add file content

Once you’ve created the file, you can configure your IP addresses:

#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

Make sure to sub­sti­tute INTERFACE with the name of your network interface and IPV4 or IPV6 with the desired IP addresses. If you only want to set up an IPv4 address in OpenBSD, you can skip the con­fig­ur­a­tion for IPv6.

Step 4: Restart the system

To activate the changes, a system reboot is necessary. You can do this by using either the Cloud Panel or the terminal command reboot.

Step 5: Check if con­fig­ur­a­tion was suc­cess­ful

To verify that the static IP address change was suc­cess­ful, open the terminal and use the ifconfig command to display in­form­a­tion about your network in­ter­faces and their cor­res­pond­ing IP addresses.

Tip

If you don’t have your own server yet, consider checking out IONOS’ af­ford­able Dedicated Server. You can apply the in­struc­tions here directly to our dedicated servers.

Go to Main Menu