Cent OS ifcfg configuration for ranges of IP's with different netmask

Posted by Aaron Schlegel on Server Fault See other posts from Server Fault or by Aaron Schlegel
Published on 2012-09-05T01:47:01Z Indexed on 2012/09/05 3:40 UTC
Read the original article Hit count: 518

Filed under:
|
|
|

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!

© Server Fault or respective owner

Related posts about linux

Related posts about networking