IP Aliasing : Create Multiple IP Addresses to One Single Network Interface
The concept of configuring multiple IP addresses on a single network interface is called IP aliasing.
In this , we can create multiple or many virtual interfaces (aliases) to a single physical card, so no need of diff network cards.
Example : IP aliasing for setting up multiple virtual sites on Apache using one single network interface with different IP addresses on a single subnet network.
Note :-Please note that all additional network IP address must be in same subnet. For example if your eth0 using 192.168.1.20 IP address then alias must be setup using 192.168.1.0/24 subnet.
Lets say we have two IP address as below :-
IPADDR 1 = 192.168.1.10 which is assigned to interface eth0
IPADDR 2 = 192.168.1.11 which needs to use by IP Aliasing.
We have an interface called “ifcfg-eth0“, the default interface for the Ethernet device. If you’ve attached second Ethernet device, then there would be an “ifcfg-eth1” device and so on. These device network files are located in “/etc/sysconfig/network-scripts/” directory.
Copy /etc/sysconfig/network-scripts/ifcfg-eth0 file as /etc/sysconfig/network-scripts/ifcfg-eth0:0
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
eth:X : Where “:X” is the device (interface) number to create the aliases for interface eth0. For each alias you must assign a number sequentially.
Open file /etc/sysconfig/network-scripts/ifcfg-eth0:0 using vi text editor:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0:0
Find entry for DEVICE:
DEVICE=eth0
& Replace it with:
DEVICE=eth0:0
Find entry for IPADDR:
IPADDR=192.168.1.10 <<--IP add of eth0
& Replace it with:
IPADDR=192.168.1.11 <<--Additional IP add to setup
Now save the file. take a reboot of the system or run below commands :-
# ifup eth0:0
OR
# service network restart
Now try ifconfig command to list the new IP alias with older setup IP :
#ifconfig
Also we can test by pinging the new IP from different machine.
That`s it , we are done with IP aliasing.
Cheers !!
AJ
In this , we can create multiple or many virtual interfaces (aliases) to a single physical card, so no need of diff network cards.
Example : IP aliasing for setting up multiple virtual sites on Apache using one single network interface with different IP addresses on a single subnet network.
Note :-Please note that all additional network IP address must be in same subnet. For example if your eth0 using 192.168.1.20 IP address then alias must be setup using 192.168.1.0/24 subnet.
Lets say we have two IP address as below :-
IPADDR 1 = 192.168.1.10 which is assigned to interface eth0
IPADDR 2 = 192.168.1.11 which needs to use by IP Aliasing.
We have an interface called “ifcfg-eth0“, the default interface for the Ethernet device. If you’ve attached second Ethernet device, then there would be an “ifcfg-eth1” device and so on. These device network files are located in “/etc/sysconfig/network-scripts/” directory.
Copy /etc/sysconfig/network-scripts/ifcfg-eth0 file as /etc/sysconfig/network-scripts/ifcfg-eth0:0
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
eth:X : Where “:X” is the device (interface) number to create the aliases for interface eth0. For each alias you must assign a number sequentially.
Open file /etc/sysconfig/network-scripts/ifcfg-eth0:0 using vi text editor:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0:0
Find entry for DEVICE:
DEVICE=eth0
& Replace it with:
DEVICE=eth0:0
Find entry for IPADDR:
IPADDR=192.168.1.10 <<--IP add of eth0
& Replace it with:
IPADDR=192.168.1.11 <<--Additional IP add to setup
Now save the file. take a reboot of the system or run below commands :-
# ifup eth0:0
OR
# service network restart
Now try ifconfig command to list the new IP alias with older setup IP :
#ifconfig
Also we can test by pinging the new IP from different machine.
That`s it , we are done with IP aliasing.
Cheers !!
AJ
Comments
Post a Comment