Cart

    Sorry, we could not find any results for your search querry.

    Adding an IPv4 or IPv6 address in Debian 10

    When you order an extra IPv4 address or add an extra IPv6 address to your IP addresses via the TransIP control panel, these cannot be automatically added to your VPS via DHCP. Additional IP addresses are added manually to the network interfaces.

    In this article, we explain how you can statically add an extra IPv4 or IPv6 address to your Debain 9 VPS. For this, an extra IPv4 and/or IPv6 address is required (depending on which you'd like to add / configure). Don't have an extra address yet? The following articles explain how you can get one:

     

    Click here for a complete overview of all our tutorials for adding an extra or static IPv4 or IPv6 address to various Linux distros. For adding an IPv4 or IPv6 address to a Windows VPS, see this article.

    • This manual is about public IP addresses. In this manual, you will find more information about setting up internal addresses (for your private network).

    A VPS includes 1 IPv4 address by default, but you can expand this to a maximum of 10 IPv4 addresses via the control panel. A maximum limit of 20 IPv4 addresses applies to the VPSs of the PRO series.

    Each VPS has a /64 IPv6 range at its disposal by default, where IP addresses can be added as desired. A /64 IPv6 range contains a total of 18,446,744,073,709,551,616 IP addresses, so the likeliness that you will not have enough is quite small! The default gateway falls outside of the /64 range so as netmask you always use a /48 range.


    Adding an IPv4 address in Debian 10

     

    Step 1 

    Connect to the VPS via the VPS console or via SSH.


     

    Step 2 

    Once logged in you see the current network interfaces and the set IPs by means of the command:

    ip a

    For the next steps, it is especially important that you are aware of the correct adapter name. Which is ens3 in this example.    

    debian 9 ip a output


     

    Step 3 

    Now add the extra IPv4 address in the network interfaces. First, open the network configuration file:

    sudo nano /etc/network/interfaces

    Please note that if you have already set an extra IP address to ens3:0, that you use the next interface (i.e. ens3:1). A configuration file opens with only the loopback interface set. You add your existing and new IP address statically with the following code: 

    auto ens3
    allow-hotplug ens3
    iface ens3 inet static
        address 136.144.210.124
        netmask 255.255.255.0
        gateway 136.144.210.1
    
    auto ens3:0
    allow-hotplug ens3:0
    iface ens3:0 inet static
        address 136.144.210.181
        netmask 255.255.255.0
        gateway 136.144.210.1
    
    • The IP that you use is the IP address that you added in your control panel. The gateway for your IP address can be found in the control panel. You need to leave the (sub) NETMASK at 255.255.255.0. 
    • Optionally you can let your primarie IP be obtained via DHCP by using iface ens3 inet dhcp instead (only for ens3).
    • For additional IP adresses you don't configure a gateway, unless the IPv4 address falls outside of the /24 range of the primairy IPv4 address.

    Please note: Did you use our fast installs feature for VPS and selected installation via SSH-keys, one time password, or cloud-config user data? Cloud Init will then overwrite your netwerk configuration. To make sure this does not happen, comment out the last line in the opened file, so that it reads as follows:

    #source /etc/network/interfaces.d/*

    Save the changes and exit nano (ctrl + x > y > enter). For additional IPv4 addresses, add ens3:1, ens3:2, and so on. 


     

    Step 4 

    Reset your network (this disconnects SSH) and bring the new interface down and back up (replace ens3:0 by the interface you made):

    sudo systemctl restart networking 
    sudo ifdown ens3:0 && ifup ens3:0

     

    Step 5

    If you run ip a again you will see the newly added IPv4 address. You can test this IP address by performing a ping test from another computer / IP. 


    Adding an IPv6 address in Debian 10

     

    Step 1 

    Connect to the VPS via the VPS console or via SSH.


     

    Step 2 

    Once logged in you see the current network interfaces and the set IPs by means of the command:

    ip a

    For the next steps, it is especially important that you are aware of the correct adapter name. Which is ens3 in this example.    

    debian 9 ip a


     

    Step 3 

    Now add the extra IPv6 address in the network interfaces. First, open the network configuration file:

    sudo nano /etc/network/interfaces

    You add your IPv6 addresses statically in the opened configuration file (in this example a primary IPv6 address is included first, followed by a secondary IPv6 address): 

    iface ens3 inet6 static
        address 2a01:7c8:d001:61::1
        netmask 48
        gateway 2a01:7c8:d001::1
    
    iface ens3 inet6 static
        address 2a01:7c8:d001:61::1337
        netmask 48
    

    Please note: Did you use our fast installs feature for VPS and selected installation via SSH-keys, one time password, or cloud-config user data? Cloud Init will then overwrite your netwerk configuration. To make sure this does not happen, comment out the last line in the opened file, so that it reads as follows:

    #source /etc/network/interfaces.d/*

    Save the changes and exit nano (ctrl + x > y > enter). 


     

    Step 4 

    Reset your network (this disconnects SSH) and bring the new interface down and back up (replace ens3:0 by the interface you made):

    sudo systemctl restart networking 
    sudo ifdown ens3:0 && ifup ens3:0

     

    Step 5 

    If you run ip a again you will see the newly added IPv6 address. You can test this IP address by performing a ping test from another computer / IP. Should you want to add more IP addresses then add the following piece again, replacing the IPv6 address in the example with your new IPv6 address: 

    iface ens3 inet6 static
    address 2a01:7c8:d001:61::1337 netmask 48

     

    Should you have any questions left regarding this article, do not hesitate to contact our support department. You can reach them via the ‘Contact Us’ button at the bottom of this page.

    Need help?

    Receive personal support from our supporters

    Contact us