6.1.9 Working with Additional IP Addresses in Linux and Windows Server

Host Banner

In many administrative tasks, it is necessary to assign multiple IP addresses to a server—whether for proxy services, virtual hosting, or dedicated applications.
This article will guide you through correctly configuring additional IP addresses on Linux (Ubuntu, Debian, CentOS, RHEL, AlmaLinux, RockyLinux) and Windows Server 2022.

Use Cases

  • Isolation of projects by IP
  • One server hosting multiple SSL sites
  • Services restricted by IP (e.g., mail, VPN)
  • Virtualization or containerization

System Requirements

  • Virtual or Dedicated server
  • OS: Linux or Windows
  • Root access on Linux or Administrator privileges on Windows

Variables to replace

  • `ADDITIONAL_IP — additional IPv4 address for the server
  • ADDITIONAL_IPV6 — additional IPv6 address for the server
  • INTERFACE — network interface name in Linux (eth0, ens3, ens160, etc.)
  • INTERFACE_ALIAS — network adapter alias in Windows (value from Get-NetAdapter)
  • YOUR_MAIN_IP / MAIN_IP — primary IPv4 address of the server
  • YOUR_IPV6 — primary IPv6 address of the server
  • NETMASK — subnet mask for IPv4 (e.g., 255.255.252.0)
  • /128 — IPv6 subnet prefix (keep 128 unless your provider specifies otherwise)
  • GATEWAY — default IPv4 gateway
  • IPV6_GATEWAY — default IPv6 gateway
  • GATEWAY_IP — gateway specified when adding an IP in Windows PowerShell
  • DNS_1 / <DNS_2> — DNS server addresses for IPv4
  • DNS6_1 / <DNS6_2> — DNS server addresses for IPv6

Temporary IP Assignment in Linux

To assign an IP address temporarily on Linux, run the following command:

IPv4

sudo ip addr add ADDITIONAL_IP dev INTERFACE

Note: replace ADDITIONAL_IP with the additional IP address and INTERFACE with the name of your network interface.

IPv6

sudo ip -6 addr add ADDITIONAL_IPV6/112 dev INTERFACE

Note: substitute ADDITIONAL_IPV6/112 and INTERFACE with your actual values.

Ubuntu/Debian

First, determine whether the old ifupdown system is in use:

dpkg -l | grep ii | awk '{print $2}' | grep ifupdown | wc -l

Returns 1 if ifupdown is installed, or 0 if not.

Check current network interfaces:

ip addr show

Output will list interfaces such as eth0, ens3, ens160.

ipaddrshow

Permanent Add via ifupdown

Open the configuration file:

sudo nano /etc/network/interfaces

Example configuration with an alias:

/etc/network/interfaces
# Primary interface IPv4 + IPv6
auto eth0
iface eth0 inet static
    address YOUR_MAIN_IP
    netmask NETMASK
    gateway GATEWAY
    dns-nameservers DNS_1 DNS_2

iface eth0 inet6 static
    address YOUR_IPV6
    netmask 112
    gateway IPV6_GATEWAY
    dns-nameservers DNS6_1 DNS6_2

# Additional IPv4 (alias)
auto eth0:0
iface eth0:0 inet static
    address ADDITIONAL_IP
    netmask NETMASK

# Additional IPv6 (alias)
auto eth0:0
iface eth0:0 inet6 static
    address ADDITIONAL_IPV6
    netmask NETMASK
  • eth0 — primary interface
  • eth0:0 — alias interface for the extra IP

Note: For address, netmask, gateway, and dns-nameservers values, contact Support.

Apply changes:

sudo systemctl restart networking

Now the extra IP will persist after reboot.

Using Netplan

Netplan configs live in /etc/netplan/. Files must have a .yaml extension. List all desired addresses under your interface:

network:
    version: 2
    renderer: networkd
    ethernets:
        ens9:
            dhcp4: false
            addresses:
              - MAIN_IP       # Your primary IP
              - ADDITIONAL_IP # Additional IP

Test the new config (allows automatic rollback if you don’t confirm within 120s):

sudo netplan try

Or apply immediately (no rollback):

sudo netplan apply

CentOS/RHEL/AlmaLinux/RockyLinux

Determine which IP configuration method is active:

systemctl status NetworkManager

If it shows Active: active (running), NetworkManager is in use. Check its devices:

nmcli device status

To see if legacy scripts are used:

systemctl status network

NetworkManager

Permanent IPv4 add:

nmcli con mod INTERFACE +ipv4.addresses ADDITIONAL_IP
nmcli con up INTERFACE

nmclicon

Verify:

ip a

Network Scripts

cd /etc/sysconfig/network-scripts/
cp ifcfg-eth0 ifcfg-eth0:0

Edit ifcfg-eth0:0:

ifcfg-eth0:0
DEVICE=eth0:0
BOOTPROTO=static
ONBOOT=yes
IPADDR=ADDITIONAL_IP
NETMASK=NETMASK

Note: Replace ADDITIONAL_IP and NETMASK with your values.

Warning: Restart the network stack:

systemctl restart network

or

ifdown eth0:0 ; ifup eth0:0

Windows Server

List IPv4 addresses in PowerShell:

Get-NetIPAddress | Where-Object {$_.AddressFamily -eq "IPv4"}

psget-net

List adapters:

Get-NetAdapter

get-netAdapter

PowerShell Add

New-NetIPAddress -InterfaceAlias "INTERFACE_ALIAS" -IPAddress "ADDITIONAL_IP" -PrefixLength 32 -DefaultGateway "GATEWAY_IP"

Note: Use your INTERFACE_ALIAS, ADDITIONAL_IP, and GATEWAY_IP.

Verify:

Get-NetIPAddress -InterfaceAlias "INTERFACE_ALIAS"

get-Net

GUI Method

  1. Open StartSettingsNetwork & Internet windowsinterface1

  2. Under Status, click Change adapter options windowsinterface2

  3. Right-click the adapter → Properties windowsinterface3

  4. Select IPv4PropertiesAdvanced… windowsinterface4

  5. Click Add… windowsinterface5

  6. Enter the extra IP and subnet mask → Add windowsinterface6

Verification

Note: Run ping tests from a different machine than the one you’re configuring.

Linux:

ping -c 4 ADDITIONAL_IP

Windows:

ping ADDITIONAL_IP

If the IP responds to ping, the configuration is correct.

Common Issues
Issue Cause Solution
IP disappears after reboot Added only temporarily Add via Netplan (Linux) or save with PowerShell (Windows)
No traffic on extra IP Firewall blocking traffic Configure UFW or Windows Firewall to allow required ports and IPs
Incorrect routing Wrong gateway or prefix length Verify gateway, netmask, and prefix length