What is an IP Alias?

An IP alias is an additional IP address assigned to an existing network interface. This allows a single network card to respond to multiple IP addresses.

Prerequisites

  • Root access or sudo permissions
  • Know your network interface name (eth0, enp0s3, etc.)
  • The additional IP address you want to configure

Configuration File

Edit the network configuration file:

/etc/network/interfaces

Configuration Example

Add the alias configuration after your primary interface:

# Primary interface
auto eth0
iface eth0 inet static
    address 192.168.1.10
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameservers 8.8.8.8

# IP Alias
auto eth0:0
iface eth0:0 inet static
    address 192.168.1.100
    netmask 255.255.255.0

Applying Configuration

After editing the configuration file, restart the networking service or reboot the system to apply changes.

Removing an IP Alias

To remove the alias, delete the eth0:0 section from /etc/network/interfaces and restart the networking service.

Important Notes

  • Ensure the alias IP doesn't conflict with other IPs on the network
  • Only configure address and netmask for the alias
  • Do not add gateway or DNS settings to the alias interface
  • The gateway is configured only on the primary interface
  • The alias shares the same physical interface and MAC address