Adding IP addresses to a RedHat based system

The first step is to see what ranges are configured. To find the currently configured IP addresses run the following:
# cd /etc/sysconfig/network-scripts/
# ls ifcfg-eth0*

To find the configured IP address ranges perform the following command:
# ls ifcfg-eth0-range*

The default Ethernet device on the server is eth0. To find all of the aliases for eth0 perform the following:
# ifconfig | grep eth0

You should see something that resembles this:

eth0 Link encap:Ethernet HWaddr 00:15:C5:F6:FF:F8
eth0:0 Link encap:Ethernet HWaddr 00:15:C5:F6:FF:F8
eth0:1 Link encap:Ethernet HWaddr 00:15:C5:F6:FF:F8

The main Ethernet adapter (eth0) has two aliases (eth0:0 and eth0:1). Notice that the highest (alias) for eth0 is eth0:1. This is important to note since, this will be used below to calculate your CLONENUME_START value.

Using the main Ethernet adapter create a range file:
# vi ifcfg-eth0-range0

In this file you need to enter values for the new IP range. You will need the interface number and the IP ranges for the server. The content of the IP range file should be similar to this:

IPADDR_START='1.3.3.7'
IPADDR_END='1.3.3.13'
CLONENUM_START='2'

You should replace the CLONENUM_START value with the starting interface number, based on the last value for the alias for eth0. Once all the information is entered, you can save the file. All that is left to do now is restart the networking service. Use the following command:
# /etc/init.d/network restart

After running:
# ifconfig
You will now see the following:
]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:15:C5:F6:FF:F8
inet addr:1.3.3.2 Bcast:1.3.3.14 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:46315484 errors:0 dropped:0 overruns:0 frame:0
TX packets:23354624 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1936029247 (1.8 GiB) TX bytes:208515543 (198.8 MiB)

eth0:0 Link encap:Ethernet HWaddr 00:15:C5:F6:FF:F8
inet addr:1.3.3.7 Bcast:1.255.255.255 Mask:255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0:1 Link encap:Ethernet HWaddr 00:15:C5:F6:FF:F8
inet addr:1.3.3.8 Bcast:1.255.255.255 Mask:255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0:2 Link encap:Ethernet HWaddr 00:15:C5:F6:FF:F8
inet addr:1.3.3.9 Bcast:1.255.255.255 Mask:255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0:3 Link encap:Ethernet HWaddr 00:15:C5:F6:FF:F8
inet addr:1.3.3.10 Bcast:1.255.255.255 Mask:255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0:4 Link encap:Ethernet HWaddr 00:15:C5:F6:FF:F8
inet addr:1.3.3.11 Bcast:1.255.255.255 Mask:255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0:5 Link encap:Ethernet HWaddr 00:15:C5:F6:FF:F8
inet addr:1.3.3.12 Bcast:1.255.255.255 Mask:255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0:6 Link encap:Ethernet HWaddr 00:15:C5:F6:FF:F8
inet addr:1.3.3.13 Bcast:1.255.255.255 Mask:255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

The results above show you have now a properly configured IP range file for your system. Your new IP's are ready to use. Enjoy!

Your rating: None Average: 2.5 (2 votes)