Support > About cloud server > A Complete Tutorial on Assigning Multiple IP Addresses to a Single Network Interface in Linux
A Complete Tutorial on Assigning Multiple IP Addresses to a Single Network Interface in Linux
Time : 2026-11-05 13:52:32
Edit : Jtti

In the daily operation and maintenance of Linux servers, assigning multiple IP addresses to a single physical or virtual network interface—a practice commonly referred to as "IP aliasing" or "multi-IP binding"—is a frequent and highly practical requirement.

Whether you need to host multiple HTTPS websites—each requiring its own unique IP—on a single server, implement complex network isolation, or conceal an origin server behind a protected (anti-DDoS) IP, mastering the configuration of multiple IPs on one interface allows for a more flexible network architecture without incurring additional hardware costs.

Implementation methods vary depending on the Linux distribution and the network management tools in use. This article provides a systematic overview of both temporary and persistent configuration methods, while also highlighting common pitfalls to avoid during the process.

Temporary Configuration: Ideal for Quick Testing (Takes effect immediately; lost upon reboot)

If you are performing a temporary test or verifying whether an IP address is available, the `ip` command is the fastest approach. Modern Linux systems recommend using `ip` instead of the legacy `ifconfig` utility.

Assuming your primary network interface is `eth0` (you can verify the actual name using `ip addr`) and you wish to add an additional IP address, `192.168.1.100`, run the following:

sudo ip addr add 192.168.1.100/24 ​​dev eth0

After executing this command, run `ip addr show eth0` again; you will see an additional `inet 192.168.1.100` entry under the interface. You can then test the connectivity of this IP using the `ping` command.

Note: IP addresses added in this manner will be lost if the server is rebooted or the network service is restarted. This method is intended solely for temporary troubleshooting or testing purposes.

Persistent Configuration: Methods for Various Distributions

To ensure that a configuration remains in effect after a reboot, the IP address must be written into the network configuration files. Due to the fragmented nature of the Linux ecosystem, configuration methods generally fall into three main categories.

1. Ubuntu 17.10 and Later (Netplan)

Modern versions of Ubuntu use Netplan by default for network management. Configuration files are typically located in the `/etc/netplan/` directory (e.g., `01-netcfg.yaml` or `50-cloud-init.yaml`).

Edit the file and append the new IP address(es) under the `addresses` list for the corresponding network interface:

yaml

network:

version: 2

ethernets:

eth0:

addresses:

- 192.168.1.10/24       # Existing primary IP

- 192.168.1.100/24 ​​     # New alias IP

- 192.168.1.101/24      # You can continue to add more

After saving, run `sudo netplan apply` to apply the configuration immediately. The advantage of using Netplan is its intuitive syntax and native support for binding multiple IP addresses simultaneously.

2. RHEL / CentOS / Rocky Linux (NetworkManager)

For RHEL 8 and later versions, it is recommended to use the `nmcli` command for configuration. Assuming the connection name is `eth0`:

# Append a new IPv4 address (note that the '+' sign indicates an addition)

sudo nmcli connection modify eth0 +ipv4.addresses "192.168.1.100/24"

# Reload the connection to apply the changes

sudo nmcli connection up eth0

If you are still using the traditional `network-scripts` (such as on CentOS 7), you will need to create a configuration file for the network interface alias. For example, create `/etc/sysconfig/network-scripts/ifcfg-eth0:0` with the following content:

ini

DEVICE=eth0:0

BOOTPROTO=static

IPADDR=192.168.1.100

NETMASK=255.255.255.0

ONBOOT=yes

Then, run `systemctl restart network` to apply the changes. Interface aliases (e.g., `eth0:0`, `eth0:1`) represent a classic implementation method used in traditional systems. 3. Debian and Older Versions of Ubuntu

For Debian systems using `ifupdown`, edit the `/etc/network/interfaces` file and append the alias configuration below the existing settings:

ini

auto eth0:1

iface eth0:1 inet static

address 192.168.1.100

netmask 255.255.255.0

Restart the network service (`systemctl restart networking`) to apply the changes.

Advanced: Three "Hidden Pitfalls" in Multi-IP Configuration

Many beginners find that after configuring multiple IPs, they can ping the new IP from the local machine, but it remains unreachable from the outside—or that outgoing traffic originates from the wrong IP. The following three details often determine whether the configuration succeeds or fails.

Pitfall 1: Overlooking Cloud Platform Security Groups

On a cloud server, configuring an IP on a network interface does not automatically mean it is permitted at the network layer. You must explicitly allow the new IP within your cloud provider's security group or firewall settings. If the new IP is a public IP, you must also ensure it is correctly bound to your instance (some cloud platforms require you to purchase or allocate an IP before binding it via the console).

Pitfall 2: Ignoring Default Routing and Source Address Selection

If you add an IP from a different subnet (e.g., your primary IP is 10.0.0.10, while the new IP is 192.168.2.100) and your application needs to initiate outgoing traffic from this new IP, you may need to configure Policy Routing. Otherwise, the kernel will default to using the primary IP as the source address for outgoing packets. If the IP is intended solely for receiving incoming connections (such as for hosting a website), additional routing configuration is generally not required.

Pitfall 3: ARP Conflicts (LAN Environments)

In a local area network (LAN) environment—such as within a physical data center—configuring an IP address that has not been assigned by a network administrator can easily lead to IP conflicts (ARP conflicts). In a cloud environment, if you manually assign an IP address that is already in use by another device within the same subnet, the network switch may experience "MAC address flapping"—a state where the MAC address table becomes unstable. It is essential to ensure that every IP address used is both unique and valid.

The quality of the underlying network determines the value of a multi-IP architecture.

Binding multiple IP addresses to a single server typically implies that you are running several independent services or providing high-density service offerings. In such an architecture, the quality and "cleanliness" (reliability and integrity) of the underlying network are critical to the success—or even the survival—of your services.

While configuring multiple IPs on a single network interface is a standard operational task, the stable performance of these IPs ultimately relies on the service provider’s underlying network infrastructure. Whether you use Netplan or `nmcli`, pairing your configuration—along with properly set security groups and routing—with a Jtti server (known for its stable network paths and ample resources) will allow your multi-IP architecture to reach its full potential. Visit the official Jtti website to explore cloud server plans that support multi-IP binding and to view test IP addresses.

Relevant contents

How to Manage Linux Updates Across Multiple Distributions: A Practical Guide to Automation and Standardization in Operations Say Goodbye to Resource Black Holes: 7 Advanced Docker Compose Tips for Thoroughly Cleaning Up Multi-Container Stacks How to Optimize CPU Utilization on Singapore-Based Servers: A Comprehensive Tuning Guide—From Diagnosis to Architecture 12 Free Linux Commands for Checking Memory Usage: From Global Overview to Granular Detail A Practical Guide to Installing Kubernetes Gateway API: From CRDs to Traffic Shifting—The Next-Generation Gateway Replacing Ingress How to Disable IPv6 and Use Only IPv4 on CentOS: A Guide to Layered Configuration and Verification Is your Linux server’s average load too high? Keep this guide handy—it covers everything from troubleshooting to resolution. How to Troubleshoot Linux Memory Leaks? A Comprehensive Practical Guide: From Monitoring to Pinpointing the Issue Why Do Small Packets with High PPS Cripple a VPS More Than High Bandwidth Does? — Soft IRQs, RPS, and Network Interface Packet Reception Optimization Why Do Cloud Servers Receive "Unexpected" UDP Broadcasts? A Guide to Identifying and Troubleshooting Layer 2 Leaks
Go back

24/7/365 support.We work when you work

Support