Simple step by step guide how to assign multiple ip addresses to single NIC in RHEL/CentOS/Oracle (5/6/7):IP Aliasing
In this
article we learn how to assign multiple ip addresses to single NIC in the linux
system. Assigning multiple ip addresses to single NIC is called IP Aliasing. It
is very important when we talk about IP based hosing. In the IP based hosting
the requirement is multiple ip address ,we can do it using IP Aliasing. This is
very cost effective solution.
Assigning multiple Ip addresses to single NIC step by step guide
The
interface configuration file located to “/etc/sysconfig/network-scripts”. In
this file you can find the interface name like ifcfg-ethY .Here Y is the
interface no.in my case I have one interface ifcfg-eth0 and going to assign
multiple ip addresses on this interface.ifcfg-eth0 interface is already assign
a ip address(192.168.137.3).now we create a sub interface under ifcfg-eth0 and
assign the ip address(192.168.137.5).
To assign
multiple ip addresses first we create sub interface to execute the below
command.
#cd
/etc/sysconfig/network-scripts
#cp
ifcfg-eth0 ifcfgeth0:1
Now open the
ifcfg-eth0:1 file and change the device name and ip address like this.
[root@localhost
network-scripts]# cat ifcfg-eth0:1
DEVICE=eth0:1
HWADDR=08:00:27:B2:1C:2E
TYPE=Ethernet
UUID=7ad94a19-502b-4b87-8511-2293efc21cdb
ONBOOT=yes
IPADDR=192.168.137.5
PREFIX=24
GATEWAY=192.168.137.1
NM_CONTROLLED=yes
BOOTPROTO=static
After doing the above steps to take affect the
changing we need to restart the network service to execute the below command
#systemctl
restart network
We can verify the
configuration is properly configured or not using the below command.
[root@localhost
~]# ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:B2:1C:2E
inet addr:192.168.137.3 Bcast:192.168.137.255 Mask:255.255.255.0
inet6 addr:
fe80::a00:27ff:feb2:1c2e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500
Metric:1
RX packets:404 errors:0 dropped:0
overruns:0 frame:0
TX packets:221 errors:0 dropped:0
overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:39650 (38.7 KiB) TX bytes:30867 (30.1 KiB)
eth0:1 Link encap:Ethernet HWaddr 08:00:27:B2:1C:2E
inet addr:192.168.137.5 Bcast:192.168.137.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500
Metric:1
Simple step by step guide how to assign multiple ip addresses to single NIC in RHEL/CentOS/Oracle (5/6/7)- IP Aliasing
That’s all if this
article is helpful please share this article!!!!!
0 comments:
Post a Comment