Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have 1 set of 30 public IP's with a netmask of 255.255.255.0 and another set of 30 IP's with a netmask of 255.255.255.128. Both sets of IP's also have different gateways. How can I virtually assign the IP's to the machine?

I have tried creating ifcfg-eth0:0 ifcfg-eth0:1 ifcfg-eth0:X ect for each IP. Below is my ifcfg file with. I have this for each IP with the correct gateway IP and netmask for each of my 60 IP's. If I do ip addr show it does show all of the 60 addresses with the correct broadcast IP and netmask.

However I can only use 30 of my IP's that are from the same netmask. Am I doing this correctly? If the IP's show up with ip addr show does that mean I have correctly assigned them to the machine virtually? I want to check before I blame my hosting company for not routing the IP's correctly.

DEVICE="eth0:1"
BOOTPROTO="static"
DNS1="**.**.**.**"
DNS2="**.**.**.**"
GATEWAY="2**.**.***.126"
HOSTNAME="localhost.localdomain"
HWADDR="0*:19:**:**:**:**"
IPADDR="2**.*.**.**"
IPV6INIT="no"
MTU="1500"
NETMASK="255.255.255.128"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"

Also is there a better way to do this? I have used ifcfg-eth0:0-range1 before to assign a range of IP's from the same netmask. Is it possible to do this with ranges with different netmask?

Thanks!

share|improve this question
    
Are you sure about those netmasks? If I got a /27 from my ISP I would expect a netmask of 255.255.255.224. –  Michael Hampton Sep 5 '12 at 1:59
    
30 usable ip addresses would imply a subnet mask of 255.255.255.224 (or /27) as Michael points out in his comment. The subnet would encompass 32 ip addresses, the first being the subnet network address and the last being the subnet broadcast address. –  joeqwerty Sep 5 '12 at 2:28

1 Answer 1

Assuming each range is contiguous, you should be able to get this going with one configuration file per network range. Substitute your provided IP values, as these ranges are provided merely as an example:

/etc/sysconfig/network-scripts/ifcfg-eth0-range0:

IPADDR_START=10.10.10.10
IPADDR_END=10.10.10.39
CLONENUM_START=0
NETMASK=255.255.255.0
BROADCAST=10.10.10.255
GATEWAY=10.10.10.1

/etc/sysconfig/network-scripts/ifcfg-eth0-range1:

IPADDR_START=10.20.20.10
IPADDR_END=10.20.20.39
CLONENUM_START=30
NETMASK=255.255.255.128
BROADCAST=10.20.20.127
GATEWAY=10.20.20.1

At which point you should be able to bring the ranges up with the ifup-aliases script at /etc/sysconfig/network-scripts/ifup-aliases with the argument of the relevant network adapter, in this case eth0:

/etc/sysconfig/network-scripts/ifup-aliases eth0

Alternatively you can restart networking via the init script.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.