We can configure multiple IP addresses on a particular network interface and the process is called IP aliasing. IP aliasing is useful when you set up multiple sites single interface or you want to install SSL Certificate, or maintain multiple connections to a network each of which serves a different purpose. You can assign multiple IP addresses to one network interface from a single subnet or completely different ones.
All Linux distributions supports IP aliasing, To assign the IP or additional in centOS follow the steps below
SSH server
cd /etc/sysconfig/network-scripts/
ll | grep ifcfg
output of the command will be like
-rw-r--r-- 3 root root 220 jan 26 00:15 ifcfg-eth0
Create copy of file ifcfg-eth0
then run the command
ll | grep ifcfg-eth
output will be like
-rw-r--r-- 3 root root 220 jan 26 00:15 ifcfg-eth0
-rw-r--r-- 1 root root 183 jan 26 16:17 ifcfg-eth0:1
-rw-r--r-- 1 root root 183 jan 26 16:18 ifcfg-eth0:2
use an editor to view file in which you want to assign IP
vi ifcfg-eth0:1
in the editor it will look something like this.
===============================
DEVICE=eth0:1
BOOTPROTO=static
IPADDR=198.121.111.111
NETMASK=255.255.255.255
ONBOOT=yes
GATEWAY=198.123.41.598
BROADCAST="198.121.111.111"
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6ADDR=2607:5300:60:0442::1/64
===============================
We need to take care of below details only.
Save and Exit
Run the command
service network restart
or
/etc/init.d/network restart
*Note Similarly you can assign more IP to the server buy following the steps above
do not forget to check IP's are pinging or not by below command.
ping IP-Address
Your new ips should now be visible by running the below command
======
ifconfig
======
All Linux distributions supports IP aliasing, To assign the IP or additional in centOS follow the steps below
SSH server
cd /etc/sysconfig/network-scripts/
ll | grep ifcfg
output of the command will be like
-rw-r--r-- 3 root root 220 jan 26 00:15 ifcfg-eth0
Create copy of file ifcfg-eth0
- cp ifcfg-eth0 ifcfg-eth0:1
- cp ifcfg-eth0 ifcfg-eth0:2
ll | grep ifcfg-eth
output will be like
-rw-r--r-- 3 root root 220 jan 26 00:15 ifcfg-eth0
-rw-r--r-- 1 root root 183 jan 26 16:17 ifcfg-eth0:1
-rw-r--r-- 1 root root 183 jan 26 16:18 ifcfg-eth0:2
use an editor to view file in which you want to assign IP
vi ifcfg-eth0:1
in the editor it will look something like this.
===============================
DEVICE=eth0:1
BOOTPROTO=static
IPADDR=198.121.111.111
NETMASK=255.255.255.255
ONBOOT=yes
GATEWAY=198.123.41.598
BROADCAST="198.121.111.111"
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6ADDR=2607:5300:60:0442::1/64
===============================
We need to take care of below details only.
- DEVICE=eth0:1 Must be the file name in which you are making entries.
- NETMASK=255.255.255.255 Use same NETMASK value as i have.
- IPADDR=198.121.111.111 It should be the Additional IP you want to assign to the server.
- BROADCAST="198.121.111.111" BROADCAST and IPADDR will be same i.e Additional IP you want to assign.
Save and Exit
Run the command
service network restart
or
/etc/init.d/network restart
*Note Similarly you can assign more IP to the server buy following the steps above
do not forget to check IP's are pinging or not by below command.
ping IP-Address
Your new ips should now be visible by running the below command
======
ifconfig
======
No comments:
Post a Comment
Do Write about the Blog and Welcome to the world where open source is every thing :-)