Tutorials

Adding Secondary Virtual IP Addresses

Adding additional IP addresses can be done one of two ways.

  • Add IP addresses to the same network adapter as secondary IP addresses (the normal way)
  • Add an IP address to each, seperate network adapters.

To say the least, the second option is not the most desirable as you would have a limited number of network adapters available, even on a physical machine. For additional, seperate network adapters, the goal is to connect to a private or other network.

On ProfitBricks, you can perform either one of these but option 1 will be the most chosen.

Note: This will require at least one (1) dedicated reserved IP address


1) Reserve your IP addresses using the IP Manager at the top menu bar.

http://iaas.me/screenshots/2015-02-10_1149.png

http://iaas.me/screenshots/2015-02-10_1149_001.png

2) Add the IP address you reserved to the "Additional IPs" section of your servers Network properties:

http://iaas.me/screenshots/2015-02-10_1151.png http://iaas.me/screenshots/2015-02-10_1152.png

3) Provision Changes

4) All public IP spaces that are assigned to servers will be part of a /24 network (Netmask 255.255.255.0).


RedHat EL / CentOS

5) Navigate to /etc/sysconfig/network-scripts/.

6) Here, you will see the configurations for the current public adapter which is most likely eth0.

# cat ifcfg-eth0
DEVICE="eth0"
BOOTPROTO=none
HWADDR=02:01:A2:3E:94:97
IPADDR=162.254.25.235
NETMASK=255.255.255.0
GATEWAY=162.254.25.1
ONBOOT="yes"

7) Create a copy if ifcfg-eth0 and name it ifcfg-eth0:1.

# cd /etc/sysconfig/network-scripts/

cp ifcfg-eth0 ifcfg-eth0:1

8) Edit this new configuration to be the configuration for your second IP address. As this is a secondary IP address, it should not be necessary to leave in the default gateway or hardware MAC address:

# cp ifcfg-eth0 ifcfg-eth0:1

vim ifcfg-eth0:1

DEVICE="eth0:1" BOOTPROTO=none IPADDR=162.254.27.226 NETMASK=255.255.255.0 ONBOOT="yes"

9) Bring up eth0:1:

# ifup eth0:1

ifconfig eth0:1

eth0:1 Link encap:Ethernet HWaddr 02:01:A2:3E:94:97 inet addr:162.254.27.226 Bcast:162.254.27.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:64000 Metric:1

10) To test and ensure it is working as expected, ping the IP from a different host:

$ ping -c 4 162.254.27.226
PING 162.254.27.226 (162.254.27.226) 56(84) bytes of data.
64 bytes from 162.254.27.226: icmp_seq=1 ttl=62 time=0.609 ms
64 bytes from 162.254.27.226: icmp_seq=2 ttl=62 time=2.15 ms
64 bytes from 162.254.27.226: icmp_seq=3 ttl=62 time=0.950 ms
64 bytes from 162.254.27.226: icmp_seq=4 ttl=62 time=0.975 ms

--- 162.254.27.226 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3003ms rtt min/avg/max/mdev = 0.609/1.172/2.157/0.587 ms

Note: Each subsequent adapter would be named eth0:2, eth0:3, accordingly.


Debian / Ubuntu

5) Navigate to /etc/network/interfaces

6) Current contents should look something like:

auto eth0
iface eth0 inet static
address 192.168.0.2
gateway 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255

7) Append the following and be sure to alter the configuration depending on your secondary IP address:

auto eth0:1
iface eth0:1 inet static
address 10.10.10.2
netmask 255.255.255.0


Windows Server 2003/2008/2012

5) Open your network adapters Properties by right clicking the respective adapter in which you wish to add the secondary virtual IP address to.

6) On the Networking tab, scroll down until you see Internet Protocol Version 4 (TCP/IPv4). Highlight this property.

7) After selecting the above property, click the Properties button in the bottom left hand corner.

8) Click the Advanced button.

9) In the IP Settings tab, add your secondary IP addresses and their netmasks to this section.

10) Save all changes by clicking OK or APPLY on your way out.