Cart

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

    Adding an IPv4 or IPv6 address in CentOS Stream 9, AlmaLinux 9 of RockyLinux 9

    When you order an additional IPv4 address or add an extra IPv6 address to your IP addresses via the control panel, these are not automatically added to your VPS via DHCP. You also need to manually add extra IP addresses to the network interfaces.

    In this article, we explain how to add or statically configure an IPv4 and IPv6 address to your CentOS Stream 9, AlmaLinux 9, or Rocky Linux 9 VPS. For this, you need an extra IPv4 and/or IPv6 address. If you do not have them yet, first consult one of the following articles:

    See this article for an overview of all our guides on adding an extra or static IPv4 and IPv6 address to various Linux distros, or here for Windows.

    • This tutorial is about public IP addresses. In this guide you can find more information about setting up internal addresses for your private network.
       
    • Note: your VPS may have a different network adapter name than eth0. You can check this with the command ip a.
       
    • A BladeVPS includes one IPv4 address by default, but you can expand this to a maximum of ten IPv4 addresses via the control panel. For BladeVPS from the PRO series and for PerformanceVPS, a limit of up to 20 IPv4 addresses applies.
       
    • Each VPS has a /64 IPv6 range available by default, from which 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 chances are quite small that you won't have enough! The gateway falls outside this range, so you always set the netmask to 48.
     


    Adding an IPv4 address in CentOS Stream 9, AlmaLinux 9, or RockyLinux 9

     

    Step 1

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


     

    Step 2

    Once logged in, you can see the current network interfaces and the configured IPs with the command:

    ip a

    For the following steps, it is especially important that you are aware of the correct adapter name. In this example, it is eth0.

    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 pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:f6:ae:54 brd ff:ff:ff:ff:ff:ff
    inet 149.210.111.222/24 brd 149.210.111.255 scope global noprefixroute eth0
    valid_lft forever preferred_lft forever
    inet6 2a01:7c8:aabb:111::1/48 scope global noprefixroute
    valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fef6:ae54/64 scope link noprefixroute
    valid_lft forever preferred_lft forever

     

    Step 3

    Note: If you are using the fast installs feature for VPS and chose installation via SSH keys, one-time password, or cloud-config user data, disable the underlying CloudInit and optionally remove the existing configuration:

    sudo touch /etc/cloud/cloud-init.disabled
    sudo rm /etc/sysconfig/network-scripts/ifcfg-eth0

    CentOS 9, AlmaLinux 9, and Rocky Linux 9 use a 'keyfile' system instead of the NetworkManager configuration files you may be familiar with. You manage these in a different way, namely via a graphical command-line tool called 'nmtui'. Start it with the command:

    sudo nmtui

     

    Step 4

    You will see the menu below. The option 'Edit a connection' is selected by default. Press 'Enter' to continue.

    nmtui edit connection


     

    Step 5

    Then select the name of the adapter from step 2 (you usually see only one adapter here), use the arrow keys to select 'Edit' and press 'Enter'.

    nmtui edit eth0


     

    Step 6

    Select 'IPv4 CONFIGURATION' and choose 'Automatic'. Press 'Enter', then select 'Manual' and press 'Enter' again.

    nmtui ipv4 manual

    Now select 'Show' with the arrow keys and press 'Enter'. Adjust the configuration as in the example below with the following modifications:

    • Replace 136.144.131.92/24 with the primary IPv4 address of your VPS. Don't forget to add the subnet /24.
    • Want to add more IP addresses? Select 'Add' and add the other IP addresses.
    • Set the Gateway to the IPv4 gateway address of your primary IPv4 address. You can find this in the control panel under 'Manage' > 'Network Information'.
    • Set the DNS servers to the available IPv4 addresses of the DNS servers, which you can also find in your control panel under 'Network Information'.
    • Don't forget to check the options 'Ignore automatically obtained routes' and 'Ignore automatically obtained DNS parameters'.

    nmtui ipv4 manual show

    Finally, select the 'OK' option at the bottom and press 'Enter' to process the changes.


     

    Step 7

    You will return to the screen from step 5. Press 'Esc' to go back one screen, select 'Quit' and press 'Enter' to exit nmtui.

    nmtui quit


     

    Step 8

    Finally, process the changes with the command:

    sudo nmcli networking off && sudo nmcli networking on


    Adding an IPv6 address in CentOS Stream 9, AlmaLinux 9, or Rocky Linux 9

     

    Step 1

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


     

    Step 2

    Once logged in, you can see the current network interfaces and the configured IPs with the command:

    ip a

    For the following steps, it is especially important that you are aware of the correct adapter name. In this example, it is eth0.

    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 pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:f6:ae:54 brd ff:ff:ff:ff:ff:ff
    inet 149.210.111.222/24 brd 149.210.111.255 scope global noprefixroute eth0
    valid_lft forever preferred_lft forever
    inet6 2a01:7c8:aabb:111::1/48 scope global noprefixroute
    valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fef6:ae54/64 scope link noprefixroute
    valid_lft forever preferred_lft forever

     

    Step 3

    Anchor

    Note: If you are using the fast installs feature for VPS and chose installation via SSH keys, one-time password, or cloud-config user data, disable the underlying CloudInit and optionally remove the existing configuration:

    sudo touch /etc/cloud/cloud-init.disabled
    sudo rm /etc/sysconfig/network-scripts/ifcfg-eth0

    CentOS 9, AlmaLinux 9, and Rocky Linux 9 use a 'keyfile' system instead of the NetworkManager configuration files you may be familiar with. You manage these in a different way, namely via a graphical command-line tool called 'nmtui'. Start it with the command:

    sudo nmtui

     

    Step 4

    You will see the menu below. The option 'Edit a connection' is selected by default. Press 'Enter' to continue.

    nmtui edit connection


     

    Step 5

    Then select the name of the adapter from step 2 (you usually see only one adapter here), use the arrow keys to select 'Edit' and press 'Enter'.

    nmtui edit eth0
     


     

    Step 6

    Select 'IPv6 CONFIGURATION' and choose 'Automatic'. Press 'Enter', then select 'Manual' and press 'Enter' again.

    nmtui ipv6 manual

    Now select 'Show' with the arrow keys and press 'Enter'. Adjust the configuration as in the example below with the following modifications:

    • Replace 2a01:7c8:fff9:34c::/48 with the primary IPv6 address of your VPS. Don't forget to add the subnet /48.
    • Want to add more IP addresses? Select 'Add' and add the other IP addresses.
    • Set the Gateway to the IPv6 gateway address of your primary IPv6 address. You can find this in the control panel under 'Manage' > 'Network Information'.
    • Set the DNS servers to the available IPv6 addresses of the DNS servers, which you can also find in your control panel under 'Network Information'.
    • Don't forget to check the options 'Ignore automatically obtained routes' and 'Ignore automatically obtained DNS parameters'.

    nmtui ipv6 manual show

    Finally, select the 'OK' option at the bottom and press 'Enter' to process the changes.


     

    Step 7

    You will return to the screen from step 5. Press 'Esc' to go back one screen, select 'Quit' and press 'Enter' to exit nmtui.

    nmtui quit


     

    Step 8

    Finally, process the changes with the command:

    sudo nmcli networking off && sudo nmcli networking on

     

    If you have any questions based on 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