How to add/bind additional IP’s in Fedora

If  you have a  single NIC (Network  Interface Card)  card  on  your  server  and you want to  add or bind few new  IP’s on the same server  using the same NIC  card  then you need to  create  the  aliases for eth0 .

For example if you want to  add the below two IP’s  on  the server :

10.10.10.02

10.10.10.03

Assuming that the eth0 has IP 10.10.10.01

then  you need to  create the aliases  as :

eth0:1  for  10.10.10.02

eth0:2 for  10.10.10.03

Follow the belows  steps to find out  how you can  add/bind the above two IP’s on  the server :

The network scripts are located in /etc/sysconfig/network-scripts/. Go into that directory.

root@server[#] cd /etc/sysconfig/network-scripts/

Then list the files in the network-scripts directory

[root@server network-scripts]# ls
ifcfg-eth0 ifcfg-lo ifdown-ippp ifdown-post ifdown-sl ifup-bnep ifup-ipv6 ifup-plusb ifup-sit init.ipv6-global route6-eth0
ifcfg-eth0:1 ifdown ifdown-ipsec ifdown-ppp ifdown-tunnel ifup-eth ifup-ipx ifup-post ifup-sl net.hotplug
ifcfg-eth0:2 ifdown-bnep ifdown-ipv6 ifdown-routes ifup ifup-ippp ifup-isdn ifup-ppp ifup-tunnel network-functions
ifcfg-eth1 ifdown-eth ifdown-isdn ifdown-sit ifup-aliases ifup-ipsec ifup-plip ifup-routes ifup-wireless network-functions-ipv6

And then create the two aliases for eth0 as etho:1 and etho:2 by runnning the below commands :

[root@server network-scripts]# cp ifcfg-eth0 ifcfg-eth0:1
[root@server network-scripts]# cp ifcfg-eth0 ifcfg-eth0:2

Then, take a look inside ifcfg-eth0 and review it’s contents

[root@server network-scripts]# cat ifcfg-eth0

It will show the output as :


DEVICE=eth0
BOOTPROTO=static
BROADCAST=x.x.x.x
IPADDR=10.10.10.01
NETMASK=x.x.x.x
NETWORK=x.x.x.x
ONBOOT=yes

Then just change the IP address for ifcfg-eth0:1 to 10.10.10.02

[root@server network-scripts]# vi ifcfg-eth0:1

DEVICE=eth0:1
BOOTPROTO=static
BROADCAST=x.x.x.x
IPADDR=10.10.10.02
NETMASK=x.x.x.x
NETWORK=x.x.x.x
ONBOOT=yes

Save and Quit.
Restart the Network Service

root@server[#] /etc/init.d/network restart
or
root@server[#] service network restart

Repeat the same steps for eth0:2 .

That’s all you are done.