Single Network Interface with Multiple IPs: How to Configure in Linux

Abstract: Configure multiple IP addresses on a single Linux network interface using Netplan or systemd-networkd for hosting multiple services.

Created: 2026-09-22 by
Configuring a single network interface with multiple IP addresses in Linux allows you to host several services on one physical connection. This technique, often called IP aliasing or secondary addressing, is essential for web servers hosting multiple domains and VPN gateways managing diverse client subnets. By assigning distinct IPs to one NIC, you simplify routing logic while maintaining strict separation of network traffic flows.

Understanding Network Interfaces and Aliases

In Linux, a network interface like eth0 or ens33 typically holds one primary IP address. However, the kernel supports adding additional logical interfaces, often referred to as aliases (e.g., eth0:1), which share the same physical hardware but operate independently at the IP layer. This approach avoids the complexity of managing multiple physical cards or VLANs when simple IP separation suffices. You can achieve this configuration using several methods depending on your distribution and init system. The two most common modern approaches are using netplan on Ubuntu-based systems and systemd-networkd on RHEL/Fedora/CentOS systems. Legacy systems might still use the /etc/network/interfaces file or ifcfg scripts in Red Hat environments. Understanding your current network stack is crucial before applying changes. For users coming from Windows backgrounds, this concept is similar to binding multiple IP addresses to a single network adapter in the TCP/IP properties. In Linux, these addresses are managed by the networking daemon rather than a static GUI setting. If you are already familiar with how Ubuntu server network interfaces work, you will find that modern declarative configuration files make this process even more straightforward. You can read more about the underlying mechanics in our guide on How do Ubuntu-server network interfaces work?.

Configuring Multiple IPs with Netplan

Netplan is the default network configuration utility for Ubuntu 18.04 and later. It uses YAML files located in /etc/netplan/ to define network settings. To add a secondary IP to an existing interface, you must edit the appropriate YAML file, such as 01-netcfg.yaml. First, identify your interface name using ip a. Let us assume your primary interface is eth0 with an existing DHCP or static configuration. You need to add a addresses list under the addresses key for that specific interface. Each additional IP must be specified in CIDR notation (e.g., 192.168.1.50/24). Here is an example configuration for a static setup:
network:
  version: 2
  ethernets:
    eth0:
      dhcp4: no
      addresses:
        - 192.168.1.10/24
        - 192.168.1.50/24
        - 192.168.1.51/24
      routes:
        - to: default
          via: 192.168.1.1
      nameservers:
        addresses:
          - 8.8.8.8
          - 8.8.4.4
After saving the file, apply the changes using sudo netplan apply. If there are syntax errors, Netplan will report them immediately. Verify the new addresses are active by running ip addr show eth0. You should see all three IP addresses listed under the same interface.

Configuring Multiple IPs with systemd-networkd

For distributions using systemd-networkd, configuration is handled through unit files in /etc/systemd/network/. Create a new file named after your interface, such as eth0.network. This method is highly portable across various Linux distributions that support systemd. The configuration requires defining the [Network] section correctly. A common error is placing the Address directive outside this section or using incorrect indentation. Ensure that all IP addresses are listed under the Addresses key within the [Network] block. Here is the correct structure for a static configuration with multiple IPs:
[Match]
Name=eth0

[Network]
Address=192.168.1.10/24
Address=192.168.1.50/24
Address=192.168.1.51/24
Gateway=192.168.1.1
DNS=8.8.8.8
DNS=8.8.4.4
Once the file is saved, restart the network service using sudo systemctl restart systemd-networkd. Check the status with systemctl status systemd-networkd to ensure there are no startup failures. Use journalctl -u systemd-networkd if you suspect issues during initialization.

Verification and Troubleshooting

Regardless of the method used, verification is the final critical step. Use ip addr show to confirm that all assigned IPs appear on the target interface. You can also test connectivity by pinging each IP from another machine on the same subnet. If packets are not reaching a specific IP, check your firewall rules using ufw or iptables to ensure they allow traffic on the new addresses. If you are using this setup for a VPN gateway, ensuring proper routing for each IP is vital. Misconfigured routes can lead to asymmetric routing issues where return traffic takes a different path. For advanced scenarios involving encrypted tunnels, you may need to consider PMTU discovery to avoid fragmentation issues. Learn more about optimizing UDP connections in Implement PMTU Discovery on UDP Connection for VPN Tunnel. Additionally, if you plan to route traffic between different peers or clients, understanding how to manage peer traffic is essential. Improper routing tables can cause connectivity drops for specific IPs. Review best practices for Routing Internet-Bound Traffic Between Two WireGuard Peers to complement your multi-IP setup.

Frequently Asked Questions

Can I assign IPv6 addresses alongside IPv4 on the same interface?

Yes, you can specify both IPv4 and IPv6 addresses in the same configuration file. Simply add the IPv6 addresses to the addresses list in Netplan or the Addresses key in systemd-networkd. The kernel handles both protocol stacks independently on the same physical interface.

Do I need to modify firewall rules for the new IP addresses?

Typically, yes. Firewalls like UFW or iptables often bind to specific IPs or subnets. If your rules only allow traffic to the primary IP, the new secondary IPs will drop incoming connections. Update your firewall configurations to explicitly permit traffic on the new addresses or the entire subnet.

What happens to the secondary IPs if the interface goes down?

All IP addresses assigned to a single interface are lost if that interface is brought down or disconnects. They are not persistent across reboots unless defined in the configuration files. Upon reboot, the network manager reads the config files and re-applies all defined addresses automatically.

Is there a limit to how many IPs I can add to one interface?

The limit is generally determined by the kernel and available memory, but practically, you can add dozens or even hundreds of IPs. However, performance may degrade if you have thousands of entries due to increased ARP table size and routing lookups. For massive scale, consider using virtual interfaces or VLANs instead.

How do I remove a secondary IP without affecting the primary one?

You can remove a secondary IP temporarily using the ip addr del command followed by the IP and interface name. To remove it permanently, edit the configuration file (Netplan or systemd-networkd) and delete the specific line corresponding to that IP, then apply the changes again.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More