Valid for Dedicated Servers and Bare Metal Servers managed in the Cloud Panel.

This article explains how to add further public IPv4 and IPv6 addresses to a Dedicated Server or Bare Metal Server running Debian 12, Debian 13, Ubuntu 22.04, Ubuntu 24.04, or Ubuntu 26.04.

In the images for these operating systems, the network configuration is carried out in the /etc/network/interfaces file. Additional configurations can be stored in separate files in the /etc/network/interfaces.d/ directory. These are included by the line source /etc/network/interfaces.d/* at the beginning of the /etc/network/interfaces file.

Note

The following articles explain how to establish an encrypted network connection to your server using Secure Shell (SSH):

Establishing an SSH connection to your Linux server from a Microsoft Windows computer

Establishing an SSH connection to your Linux server from a Linux computer

How to configure further public IPv4 and IPv6 addresses in Debian 12, Debian 13, Ubuntu 22.04, Ubuntu 24.04, and Ubuntu 26.04:

Requirements

  • You have assigned one or more additional public IPv4 and/or IPv6 addresses to your server in the Cloud Panel.
  • You have logged in to the server as an administrator (root).
  • You have made a note of the server's IPv4 and IPv6 addresses.

Determining the network interface

Determine the name of the network interface. To do this, enter the following command:

root@localhost:~# ip addr

In this example, the name of the network interface is eth0:

root@localhost:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:50:56:08:a5:c6 brd ff:ff:ff:ff:ff:ff
altname enp11s0
inet 217.160.141.60/32 metric 100 scope global dynamic eth0
inet6 2001:8d8:1801:5d2::1/64 scope global dynamic noprefixroute
valid_lft 3443sec preferred_lft 3443sec
inet6 fe80::250:56ff:fe08:a5c6/64 scope link
valid_lft forever preferred_lft forever

Make a note of the interface name. You need it for the configuration.

Displaying the default DNS servers

  • To display the DNS servers in use, enter the following commands:

    root@localhost:~# curl http://169.254.169.254/latest/meta_data/dns/nameservers -Lv

    root@localhost:~# curl http://169.254.169.254/latest/meta_data/dns/nameservers6 -Lv

    The DNS servers in use are then shown at the end of the output. Example:

    root@localhost:~# curl http://169.254.169.254/latest/meta_data/dns/nameservers -Lv
    * Trying 169.254.169.254...
    * TCP_NODELAY set
    * Connected to 169.254.169.254 (169.254.169.254) port 80 (#0)
    > GET /latest/meta_data/dns/nameservers HTTP/1.1
    > Host: 169.254.169.254
    > User-Agent: curl/7.61.1
    > Accept: */*
    >
    < HTTP/1.1 200 OK
    < Date: Thu, 10 Sep 2026 12:19:36 GMT
    < Server: Apache
    < Strict-Transport-Security: max-age=63072000; includeSubDomains
    < Vary: Accept-Encoding
    < Access-Control-Allow-Origin: *
    < Access-Control-Allow-Headers: X-TOKEN, X-HASH, X-MICROTIME, X-USER, Content-Type, X-API-TOKEN, Authorization
    < Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS
    < Access-Control-Expose-Headers: Error-Msg
    < Cache-control: no-cache, no-store, max-age=0
    < Transfer-Encoding: chunked
    < Content-Type: text/plain;charset=UTF-8
    <
    212.227.123.16,212.227.123.17
    * Connection #0 to host 169.254.169.254 left intact

  • Make a note of the DNS servers. In the example above, the DNS servers are shown above the line * Connection #0 to host 169.254.169.254 left intact.
  • If the DNS servers for IPv6 are not displayed, enter the following command:

    root@localhost:~# resolvectl --no-pager | grep Server

    Example:

    root@localhost:~# resolvectl --no-pager | grep Server
    Current DNS Server: 212.227.123.16
    DNS Servers: 212.227.123.16 212.227.123.17 2001:8d8:fe:53:72ec::1

Displaying the gateway for IPv4 and IPv6

  • To display the default gateway of the active interface, enter the following commands:

    IPv4:

    root@localhost:~# ip route show | grep 'default'

    IPv6:

    root@localhost:~# ip -6 route show | grep 'default'

  • Make a note of the gateway IP addresses. These are listed immediately after the default via part. Examples:

    IPv4 gateway

    root@localhost:~# ip route show default
    default via 10.255.255.1 dev eth0 proto dhcp src 217.160.141.60 metric 100

    IPv6 gateway

    root@localhost:~# ip -6 route show | grep 'default'
    default via fe80::1 dev eth0 proto ra metric 100 expires 4sec pref high

    In this example, fe80::1 is the IPv6 gateway.

Adding IPv4 and IPv6 addresses

  • Open the /etc/network/interfaces file with the vi editor.

    root@localhost:~# vi /etc/network/interfaces

Note

  • The vi editor has an insert mode and a command mode. You can switch to insert mode by pressing the i key. In this mode, the characters you type are inserted into the text immediately. To switch to command mode, press the ESC key. When you use command mode, your keyboard input is interpreted as a command.
  • To exit vi and save the file, enter the command :wq and then press Enter.
  • Adapt your /etc/network/interfaces configuration file. Replace the placeholders as you do so, and add the blocks for the additional IP address.

    auto lo NETWORK_INTERFACE
    iface lo inet loopback

    iface NETWORK_INTERFACE inet static
        address MAIN_IPv4_ADDRESS
        netmask 255.255.255.255
        gateway 10.255.255.1

    auto NETWORK_INTERFACE:0
    allow-hotplug NETWORK_INTERFACE:0
    iface NETWORK_INTERFACE:0 inet static
        address ADDITIONAL_IPv4_ADDRESS

    iface NETWORK_INTERFACE inet6 static
        address MAIN_IPv6_ADDRESS
        netmask 64

    iface NETWORK_INTERFACE inet6 static
        address ADDITIONAL_IPv6_ADDRESS
        netmask 64

    Example:

    auto lo eth0
    iface lo inet loopback

    iface eth0 inet static
        address 85.215.105.86
        netmask 255.255.255.255
        gateway 10.255.255.1

    auto eth0:0
    allow-hotplug eth0:0
    iface eth0:0 inet static
        address 85.215.109.181

    iface eth0 inet6 static
        address 2a01:239:0:805d::1
        netmask 64

    iface eth0 inet6 static
        address 2a01:239:0:805d::2
        netmask 64

  • To exit vi and save the file, enter the command :wq and then press Enter.
  • Restart the server so that the changes are applied permanently. To do this, enter the following command:

    root@localhost:~# systemctl reboot

  • To check whether the additional public IPv4 address has been added, enter the following command:

    root@localhost:~# ip addr

    The additional public IPv4 address is then displayed. Example:

    root@localhost:~# ip addr
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
    valid_lft forever preferred_lft forever
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether ac:1f:6b:9b:22:44 brd ff:ff:ff:ff:ff:ff
    inet 217.160.244.147/32 scope global dynamic eth0
    valid_lft 42230sec preferred_lft 42230sec
    inet 82.165.248.54/32 brd 82.165.248.255 scope global eth0:0
    valid_lft forever preferred_lft forever
    inet6 2001:8d8:1800:1a1::1/128 scope global
    valid_lft forever preferred_lft forever
    inet6 fe80::ae1f:6bff:fe9b:2244/64 scope link
    valid_lft forever preferred_lft forever
    3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether ac:1f:6b:9b:22:45 brd ff:ff:ff:ff:ff:ff