IP Alias


Redhat 7.2 & Fedora


IP aliasing is a special configuration of your dedicated server network, which enables you to associate several IP addresses to only one network interface card.



The aim is to create a virtual interface above eth0, which will be named eth0:0 and will attach the additional IP or Fail over to your network interface. Here are the explanations for the addition via SSH. You can also do it directly via your webmin, ‘others’ section, then files management



In SSH /Putty



1. We copy the file of eth0 interface and we rename it eth0:0. This will enable you to edit the file in peace:

cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0




2. We can now edit the file eth0:0 to replace the IP. You can either use pico or vi:

pico /etc/sysconfig/network-scripts/ifcfg-eth0:0


First of all, replace the device name, then the existing IP by the failover/ additional one that you have received by email:



DEVICE="eth0:0"

ONBOOT="yes"

BOOTPROTO="none"

IPADDR="IP.FAIL.OVER"

NETMASK="255.255.255.255"

BROADCAST="IP.FAIL.OVER"




3. Now you just have to assemble the new interface that we have just added:

ifup eth0:0


At the time of reboot, the interface will automatically be assembled.



4. IP test

If operations 1 to 3 have been correctly carried out, the IP shown in eth0:0 file must be pingable from another machine and answer to the requests.

If you have several additional IPs; you can renew the operation by using eth0:1, eth0:2 and so on.



If after handling, your IP doesn’t answer to the pings, please contact our support.



Centos


The setup on Centos is quite similar to the Redhat one.

In SSH /Putty


1. We copy the file of eth0 interface and we rename it: eth0:0. This will enable us to edit the file:

cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0




2. We can now edit the eth0:0 file to replace the IP. You can either use nano or vi:

nano /etc/sysconfig/network-scripts/ifcfg-eth0:0


First of all, replace the device name, then the existing IP by the fail over/ additional one that you have received by email:



DEVICE="eth0:0"

BOOTPROTO="static"

IPADDR="IP.FAIL.OVER"

NETMASK="255.255.255.255"

ONBOOT="yes"

BROADCAST="IP.FAIL.OVER"



3. Now you just have to assemble the new interface that we have just added:

ifup eth0:0


At the time of reboot, the interface will automatically be assembled.



4. IP test

If operations 1 to 3 have been correctly carried out, the IP shown in eth0:0 file must be pingable from another machine and answer to the requests.

If you have several additional IPs; you can renew the operation by using eth0:1, eth0:2 and so on.



If after handling, your IP doesn’t answer to the pings, please contact our support.



Gentoo VHSCLOUD


The aim is to create a virtual interface above eth0, which will be named eth0:0 and will attach the additional IP or Failover to your network interface.



In SSH /Putty



1. First of all, we copy the root file to be able to go backward at any time

cp /etc/conf.d/net /etc/conf.d/net.save



2. We can now edit the file to add the ip

You can either use nano or vi. Under Gentoo, an alias is directly added in eth0. We don’t create any eth0:0 interface (as under Redhat for example)



Important: default IP of the server must remain config_eth= on the same line. In order to make sure that some specific handlings in VHSCLOUD work correctly



After netmask 255.255.255.0, Press Enter and add your IP (XXXXXXXX have of course to be replaced by your Ips)



nano /etc/conf.d/net


You must add:



config_eth0=( " xxx.xxx.xxx.xxx netmask 255.255.255.0"
"ip.fail.over.here netmask 255.255.255.255 brd ip.fail.over.here" )

Your /etc/conf.d/net file must contain the following:



#This blank configuration will automatically use DHCP for any net.

# scripts in /etc/init.d. To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

config_eth0=( "xxx.xxx.xxx.xxx netmask 255.255.255.0"

"xxx.xxx.xxx.xxx netmask 255.255.255.255 brd ip.fail.ov.er" )

routes_eth0=( "default gw xxx.xxx.xxx.254" )




3. Start the network interface again

In order to ping your IP-failover, you just have to start the network interface again



/etc/init.d/net.eth0 restart



4. IP test

If operations 1 to 3 have been correctly carried out, the IP shown in eth0:0 file must be pingable from another machine and answer to the requests.

You can therefore insert an additional IP line by line. However, it is important that the default IP remains on the same line as config_eth0



Debian


The aim is to create a virtual interface above eth0, which will be named eth0:0 and will attach the additional IP or Failover to your network interface.



In SSH /Putty




1. First of all, we copy the root file to be able to go backward at any time


cp /etc/network/interfaces /etc/network/interfaces.save




2. We can now edit the file to add the ip

You can either use nano or vi. Under Gentoo, an alias is directly added in eth0. We don’t create any eth0:0 interface (as under Redhat for example)



pico /etc/network/interfaces


For Debian 3, 4 and 5, we must add:

auto eth0:0
iface eth0:0 inet static
address IP.OF.FAIL.OVER
netmask 255.255.255.255
broadcast IP.OF.FAIL.OVER



The /etc/network/interfaces files should contain the following:


auto eth0
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask 255.255.255.0
broadcast xxx.xxx.xxx.255
network xxx.xxx.xxx.0
gateway xxx.xxx.xxx.254

auto eth0:0
iface eth0:0 inet static
address IP.DE.FAIL.OVER
netmask 255.255.255.255
broadcast IP.DE.FAIL.OVER


For Debian 6, we must add one line per ip (eth0 is incremented X: X):


post-up /sbin/ifconfig eth0:X IP.OF.FAIL.OVER netmask 255.255.255.255 broadcast IP.OF.FAIL.OVER
post-down /sbin/ifconfig eth0:X down


The /etc/network/interfaces file should contain the following:


auto eth0
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask 255.255.255.0
broadcast xxx.xxx.xxx.255
network xxx.xxx.xxx.0
gateway xxx.xxx.xxx.254
post-up /sbin/ifconfig eth0:0 IP.OF.FAIL.OVER netmask 255.255.255.255 broadcast IP.OF.FAIL.OVER
post-down /sbin/ifconfig eth0:0 down
post-up /sbin/ifconfig eth0:1 IP.OF.FAIL.OVER1 netmask 255.255.255.255 broadcast IP.OF.FAIL.OVER1
post-down /sbin/ifconfig eth0:1 down


3. Start the network interface again

In order to ping your IP-failover, you just have to start the network interface again



/etc/init.d/networking restart





4. IP test

If steps 1 through 3 were carried out correctly, the IP shown in the file must be pingable from the outside and answer the queries.

If after handling your IP does not respond to pings, please contact support.

cPanel


1. We edit the file /etc/ips :




nano /etc/ips


2. We add the ip to the file:




IP.FAIL.OVER:255.255.255.255:IP.FAIL.OVER


3. We add the ip in /etc/ipaddrpool



IP.FAIL.OVER


4. We restart the service managing failover ips :




/etc/init.d/ipaliases restart



HG Server


For HG servers which are delivered with 2 Ip addresses and 2 network cards, it's necessary to add the fail-over Ip in the routing rules:



postup()

{

/sbin/ip route add default via IP.INITIAL.2eme.CARTE dev eth1 table 223

/sbin/ip rule add from INITIAL.IP.OF.SERVER/32 table 223

/sbin/ip rule add from IP.FAILOVER.OF.SERVER/32 table 223

}


A example file on a HG server with Gentoo distribution gives:



This blank configuration will automatically use DHCP for any net.*

scripts in /etc/init.d. To create a more complete configuration,

please review /etc/conf.d/net.example and save your configuration

in /etc/conf.d/net (this file :]!).



config_eth0=( "xxx.xxx.xxx.xxx netmask 255.255.255.0"

"xxx.xxx.xxx.xxx netmask 255.255.255.255 brd xxx.xxx.xxx.255"

)

routes_eth0=( "default gw xxx.xxx.xxx.254" )



config_eth1=( "xxx.xxx.xxx.xxx netmask 255.255.255.0"

"xxx.xxx.xxx.xxx netmask 255.255.255.255 brd xxx.xxx.xxx.255"

)



postup()

{

/sbin/ip route add default via xxx.xxx.xxx.xxx dev eth1 table 223

/sbin/ip rule add from xxx.xxx.xxx.xxx/32 table 223

/sbin/ip rule add from IP.FAIL.OVER.HERE/32 table 223

}
  • 1 Users Found This Useful
Was this answer helpful?