Linux

How to setup IP aliases

Configure IP Aliases in Red Hat / CentOS


IP aliasing is a term for assigning multiple IP addresses to a single network interface. It is quite useful in a shared web hosting for instance, particularly if the domains have SSL certificates. You can setup each domain to resolve to different IP address, even if they are all sharing the same network interface.

You have to be root to perform this tasks.

1. Disable Network Manager


# service NetworkManager stop

# chkconfig NetworkManager off

2. Add IP alias from cli


# ip addr addr add 192.168.0.11/24 dev eth0 label eth0:1

# ip addr show eth0

3. Persistently add lias

Create the file /etc/sysconfig/network-scripts/ifcfg-eth0:1

# cat /etc/sysconfig/network-scripts/ifcfg-eth0:1
DEVICE=eth0:1
IPADDR=192.168.0.11
PREFIX=24
ONPARENT=yes


4. Restart network service

# service network restart
# ip addr show eth0

 

daniel

Share
Published by
daniel
Tags: ip alias

Recent Posts

GCP for Linux System administrators

Linux System Admins Journey to Google Cloud Platform As a Linux system administrator, you have…

2 months ago

Top 5 Troubleshooting Tools for Network Professionals in Linux

As a network professional, troubleshooting is a crucial part of your daily routine. To streamline…

2 months ago

netstat equivalent tool

The net-tools set of packages had been deprecated years back, although the commands are still…

2 years ago

GCP GKE – run kubectl through bastion host

Re-posting my answer to a Google cloud platform's Google Kubernetes Engine (GKE) related question in…

4 years ago

Spoof User Agent in http calls

Recently I was trying to download numerous files from a certain website using a shell…

4 years ago

Terraform – show logging

Enabling logging in terraform for debugging

4 years ago