Dec 10, 2012
185 Views
Comments Off on Add IP Range to Centos / RHEL

Add IP Range to Centos / RHEL

Written by

If you want to quickly fill a subnet with ip addresses for a host, instead of manually adding interface aliases to the rc.local you can achieve the same thing with core networking support by doing the following in RHEL / Centosquickly add ip address range in linux

in /etc/sysconfig/network-scripts

add a file called

ifcfg-ethX-range0

here ethX is the network interface ID you want to have the alias range on, so for eth0 you could use

ifcfg-eth0-range0

Using your favorite text editor, vi, pico, gedit, in our case, vi add the following

IPADDR_START=
IPADDR_END=
CLONENUM_START=
NETMASK=

Now you will need to fill this out, so for example

IPADDR_START=192.168.1.10
IPADDR_END=192.168.1.100
CLONENUM_START=0
NETMASK=255.255.255.0

The “CLONENUM_START” value is equal to the alias interface number you would start with this range. In this case, the first IP  will be binded to “eth0:0″. While you can start with any value for simplicity its best you start with a single digit number

 

If you do not have CENTOS/ RHEL or are using something other than these , you can always edit the rc.local and add interface aliases manually

For Example

/sbin/ifconfig eth0:0 192.168.1.10 netmask 255.255.255.0

will work with most distrobutions, including RHEL, CENTOS. Slackware, SuSe, for Ubuntu you may need to make the line

sudo /sbin/ifconfig eth0:0 192.168.1.10 netmask 255.255.255.0

‘The easiest way to check is at the root rompt # type the command

which ifconfig

on most RPM distros this comes back as /sbin/ifconfig, if your path is different than above, then change the ifconfig path to suite your needs.

Leave your vote

0 points
Upvote Downvote

Comments

0 comments

Article Tags:
· · · ·
Article Categories:
Linux

Log In

Forgot password?

Forgot password?

Enter your account data and we will send you a link to reset your password.

Your password reset link appears to be invalid or expired.

Log in

Privacy Policy

Add to Collection

No Collections

Here you'll find all collections you've created before.