1

I just bought 10 extra IPs from my host. How do I point these at my CentOS 5 server?

1
  • I assume that is is a question about how to configure the host, not how to route the addresses.
    – pehrs
    Apr 11, 2010 at 9:09

3 Answers 3

8

On CentOS you can use a ifcfg-eth?-range? file to assign multiple IP adresses. For example; you want to assign additional IP adresses to your eth0 interface and you don't have any additional addresses assigned yet. Create the file /etc/sysconfig/network-scripts/ifcfg-eth0-range0:

IPADDR_START=10.0.0.10
IPADDR_END=10.0.0.19
CLONENUM_START=0

When you already have assigned additional IP addresses the CLONENUM_START value should match the next available eth0:x number.

If the IP addresses aren't in order you have to create an ifcfg-eth0:x file for each of the addresses. The content should look like this:

DEVICE=eth0:0
IPADDR=10.0.0.10
NETMASK=255.255.255.0
ONBOOT=yes

Change the DEVICE value to the corresponding filename and run ifup eth0:0 to bring the interface online.

1
  • the IPs are all over the range though, not in order.
    – ace
    Apr 11, 2010 at 23:00
6

Use IP aliasing on the host.

ifconfig eth0:1 192.168.0.100 netmask 255.255.255.0
ifconfig eth0:2 192.168.0.101 netmask 255.255.255.0

To do it permanently you will have to use the files in /etc/sysconfig/network-scripts/ifcfg-<interface>

And so on. But why do you need multiple IPs for a single host? SSL/TLS?

2
  • Check the answer from PowerSp00n for how to setup the ifcfg files.
    – pehrs
    Apr 11, 2010 at 12:41
  • multiple IPs for SEO benefit. Hosting a lot of sites that link together on the same server, but want the benefit of the search engine thinking they are on different servers.
    – ace
    Apr 11, 2010 at 23:01
0

This method worked for me.

If you are on Centos Web panel then you can add the multiple ip address using this method:

  1. Create a file as: /etc/sysconfig/network-scripts/ifcfg-eth0:0

  2. Add the following line on the created file:

    DEVICE="eth0:0"
    BOOTPROTO=static
    ONBOOT=yes
    TYPE="Ethernet"
    IPADDR=80.80.25.25
    HWADDR=00:0C:29:28:4C:4C
    GATEWAY=80.80.25.1
    NETMASK=255.255.255.0
    
  3. Restart the network

    service network restart
    
  4. Check the network for any success

    ifconfig
    

Source: http://wiki.centos-webpanel.com/add-additional-ip-address

You must log in to answer this question.