There was a problem loading the comments.

Adding multiple IP addresses on our VPS platform

Support Portal  »  Knowledgebase  »  Viewing Article

  Print
When you add additional IP addresses on our hosting platform, you'll notice that multiple virtual NIC interfaces are attached to your VM, each with a different IP.

Unfortunately, having multiple IP addresses in the same network range on different NICs can cause routing issues in Linux. To properly setup multiple IP addresses, please follow these steps:

Before proceeding: Please ensureĀ all your interfaces on your VPS are configured forĀ DHCP. OpenStack assigns a new interface for every IP in the system, all of which have to be setup to obtain DHCP.

First, create a new rt_tables entry for each IP that you have on your system. In the following examples, we're configuring a system with 2 IPs assigned to it. You'll need to create a unique name and ID for each entry. These entries can be titled and numbered any way you want.

echo '100 TeraSwitch1' >> /etc/iproute2/rt_tables
echo '101 TeraSwitch2' >> /etc/iproute2/rt_tables

Next, we need to setup the correct routes for your VM. For this step, you'll need to take note of which IP address is assigned to which interface. (In the below example, 74.118.141.84 is assigned to eth0, and 74.118.141.143 is assigned to eth1).

ip route add 74.118.141.0/24 dev eth0 src 74.118.141.84 table TeraSwitch1
ip route add table TeraSwitch1 default via 74.118.141.1 dev eth0
ip route add 74.118.141.0/24 dev eth1 src 74.118.141.143 table TeraSwitch2
ip route add table TeraSwitch2 default via 74.118.141.1 dev eth1

Next, assign your unique routing table rule to each IP:

ip rule add table TeraSwitch1 from 74.118.141.84
ip rule add table TeraSwitch2 from 74.118.141.143

Lastly, you'll need to add all those lines to a single bash script that runs on boot, so your route settings are preserved.

#!/bin/bash/
echo '100 TeraSwitch1' >> /etc/iproute2/rt_tables
echo '101 TeraSwitch2' >> /etc/iproute2/rt_tables

ip route add 74.118.141.0/24 dev eth0 src 74.118.141.84 table TeraSwitch1
ip route add table TeraSwitch1 default via 74.118.141.1 dev eth0

ip route add 74.118.141.0/24 dev eth1 src 74.118.141.143 table TeraSwitch2
ip route add table TeraSwitch2 default via 74.118.141.1 dev eth1

ip rule add table TeraSwitch1 from 74.118.141.84
ip rule add table TeraSwitch2 from 74.118.141.143

Configuring your script to run on boot is different for every operating system. You will have to use the method that works for your selected OS.

If you run into any issues, or would prefer for us to customize these commands for your system, please open a ticket with our support team.

We're working on making this process automated. We appreciate your patience.

Share via
Thank you for your feedback on this article.

Related Articles

© TeraSwitch Inc.