NEWS CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
Home / News / Linux / Other Tips, Tricks and Tutorials

Other Tips, Tricks and Tutorials


How to Bind a Range of IPs

Quickly add a range of IPs on Redhat-based systems.

By Mihai Marinof, Linux Editor

20th of December 2006, 08:35 GMT

Adjust text size:


Together with the Internet growth, service providers also evolved, being able to offer larger bandwidth and higher quality connections to their subscribers. Nowadays, almost anyone can get a high bandwidth connection and a class of IPs for a very low price compared to the costs from a few years ago. If you're one of the many people that turned their personal PCs into small servers that provide various services as a small company, then you know how important it is to have a few classes of IPs available. But then again, you should know how to bind a range of IPs to a Linux server so this guide is more for people that want to start a small business using their Linux systems but don't know which way to go. For instance, if you decide you want to turn your Linux system into a server and offer webhosting, mail, dns, ftp etc services, you'll need to know that each domain that will be hosted on your server will need its own unique IP. Not to mention the subdomains and any eventual custom services your clients will require. So before you start anything, you'll have to get a high bandwidth connection and a class of IPs. An IP address class can either be a Class C (245 addresses), a Class B (65,532 addresses) or a Class A (16,777,214 addresses). You decide what you need.

For a small range of IPs, you can manually add each IP to a file called ifcfg-eth0:x, which resides in /etc/sysconfig/network-scripts/. For instance, if you want to add 10 IP addresses, you'll have to create 10 files in that directory, starting with ifcfg-eth0:0 and ending with ifcfg-eth0:10. Each file will contain:

CODE
DEVICE=eth0:0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.2
NETMASK=255.255.255.0
NETWORK=192.168.0.0
BROADCAST=192.168.0.255
TYPE=Ethernet

The IPADDR will increase from 192.168.0.2 to 192.168.0.12.

But what if you have to add 100 IP addresses? It could be physically possible to manually add a file for each of them. But how about 1000 IP addresses? Or 10,000? Fortunately, RedHat based systems offer a quick and easy way to bind a range of IPs, eliminating the need to create a lot of files and saving a lot of your time.

Create a file called ifcfg-eth0-range0 in the /etc/sysconfig/network-scripts directory. This file must contain the following strings:

CODE
IPADDR_START=192.168.0.10
IPADDR_END=192.168.0.110
CLONENUM_START=0

Let's see what each of them does:

IPADDR_START: This is the first IP from the address range you want to bind to your ethernet device.
IPADDR_END: This is, of course, the last IP from that address range.
CLONENUM_START: This is the number that will be assigned to the first IP alias interface. For instance, if your Internet interface is eth0 and CLONENUM_START is 0, then this config file will create 100 interfaces starting with eth0:0 (eth0:0, eth0:1, eth0:2 etc) and ending with eth0:100.

NOTE! Be careful if you need to add more ranges of IPs. You'll have to use a proper value for CLONENUM_START. For instance, if you need to add a second range with 100 IPs besides the one above, create a new file called ifcfg-eth0-range1 and set the CLONENUM_START to 101 so an overwrite will be avoided.

After making any changes to any of the files created in the network-scripts directory, you have to run the following command so the changes are applied and the address range is activated:

# service network restart

Good luck!
Read by 6,989 user(s) | Add comment | Link to this article TWEET THIS


Article rating:
Good (3.0/5) 7 vote(s)    

Subscribe to news | Print article | Send to friend

© Copyright 2001-2009 Softpedia
Contact:

 

 

SEARCH THE NEWS ARCHIVE :




Today's News
| Yesterday's News | News Archive


MORE RELATED ARTICLES:


Screencast Guide: Capure Your Linux Desktop on Video!

How to Setup an Encrypted Filesystem

FreeNX Installation Guide for Fedora 6

Grant Root Privileges to Regular Users

Installing NTFS Write Support on Fedora/Ubuntu

Setting Up a SHOUTcast Server + DSP Plug-In

Resetting a Forgotten Root Password

User opinions:


Comment #1 by: kronenmix on 16 Jan 2009, 16:56 GMT reply to this comment

Thanks for the info ;)

What about exclusions? sometimes a range have reserved IPs in the middle, how to exclude them ?


Comment #2 by: Scott on 27 May 2009, 19:09 GMT reply to this comment

What about combining the two methods? Is it possible to have a few ifcfg-eth0:x files and combine it with ifcfg-eth0-range0?

Share your opinion:

Your Name:
Your Email Address:
(will not be used for commercial purposes)
Solve this to prove you're not a bot: =
Your review/opinion:

 




Windows tabGames tabDrivers tabMac tabLinux tabScripts tabMobile tabHandheld tabGadgets tabNews tab

SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   ENTER NEWS SITE   |   ENGLISH BOARD   |   ROMANIAN FORUM