For Dedicated Server

This article explains how to add an additional public IPv4 address on a Dedicated Server where Debian 10 is installed.

To configure an additional public IPv4 address in Debian 10, please proceed as follows:

Requirements
  • In the Cloud Panel, you have assigned an additional public IPv4 address to your server.

  • You have logged on to the server as an administrator.

  • Check which network interface is in use and enter the following command:

    [root@localhost ~]# ip addr

  • Open the /etc/network/interfaces file in the vi Editor. 

    [root@localhost ~]# vi /etc/network/interfaces

Notes
  • The vi Editor has a command mode and an insert mode. To switch to input mode, press [i] on your keyboard. You can now insert the required content or make the required changes. Press the [ESC] key on your keyboard to exit the input mode.

  • To exit vi and save the file, type the command :wq, then press Enter.

  • Replace the information with the following:

    auto lo eth0
    iface lo inet loopback

    allow-hotplug eth0
    iface eth0 inet static
     address Main IPv4 ADDRESS/32
    netmask 255.255.255.255
    gateway 10.255.255.1

    auto eth0:0
    allow-hotplug eth0:0
    iface eth0:0 inet static
     address Additional IPv4 ADDRESS/32

    iface eth0 inet6 manual
        up dhclient -6 -nw -v eth0
    eth0
        down dhclient -6 -r -v eth0

    Example:

    auto lo eth0
    iface lo inet loopback

    allow-hotplug eth0
    iface eth0 inet static
     address 217.160.244.147/32
    netmask 255.255.255.255
    gateway 10.255.255.1

    auto eth0:0
    allow-hotplug eth0:0
    iface eth0:0 inet static
     address 82.165.248.54/32

    iface eth0 inet6 manual
        up dhclient -6 -nw -v eth0
    eth0
        down dhclient -6 -r -v eth0

  • Save the file.

  • Restart your server.

  • To check if the additional public IPv4 address has been added, type the following command:

    [root@localhost ~]# ip addr

    The additional public IPv4 address will now be displayed. Example:

    root@A34C022:~# 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