SoftLayer Network Tips

We’ve been a softlayer customer for a long time and we have quite a few machines with them at this point and we have people once in a while asking how in the world do we do what we do at softlayer.  Some examples are routing our IP’s on a VLAN and having ranges on various machines and quickly routing them across different servers.  Another common one is how do we route private network IP’s to our VPS plans giving a user the potential to use say NAS.   I’m going to quickly go through them for anyone curious

VLAN Routed IP’s

VLAN routed IP’s most believe are only useful for virtual private servers where you can use IP pool features to spread a range across numerous servers.  This is untrue as we actually have every single IP routed to our VLAN’s to make it possible to share ranges among servers.  That’s actually easy to do you just need to use the right netmask on the IP’s so a 32 IP range is a 255.255.255.224 for example.  You can use the site http://grox.net/utils/whatmask/ to quickly calculate this for you if you’re unsure so say you were given 1.2.3.4/28 255.255.255.240.  So for each IP you add or a range you add specify the netmask as otherwise you can cause some very strange routing later on when re-routing IP’s.

So the second portion is I have 1.2.3.4 on Machine1 and I want to route it to Machine2 this is very easy to do.  You want to add 1.2.3.4 to Machine2 then arp the IP to the new server.  I prefer to remove it from the old server as well before doing the arp as I don’t want to cause any confusion but it may not be necessary I just prefer to be safe than sorry in case it causing routing issues of the range.  So to re-route the 1.2.3.4 with the gateway 4.3.2.1 you’d run the following command on Machine2 in SSH:

arping -A -s 1.2.3.4 -I eth1 4.3.2.1

Obviously you’d change 1.2.3.4 with your IP and 4.3.2.1 with the gateway of your VLAN.  In the SoftLayer panel you can find the gateway of your VLAN by going to any IP and looking for the server address and below that it lists the gateway of the VLAN.  It is also worth noting with this setup you lose the use of 3 IP’s so I recommend your minimum IP range is 32 IP’s and you also obviously need softlayers VLAN routed IP’s.  In the Softlayer IP manager it also tells you which IP’s are not usable so it’s pretty self explanatory there.

Private IP’s on VPS

We also give each VPS it’s own private IP so they have access to Softlayer tools such as the resolvers but we could expand this out to NAS, iSCSI ect.  There are several topics going around on how to do it in OpenVZ but we’ve found the easiest solution is just one command on the VPS and it does not even care where the private IP is on the VPS’s ip list.  The first thing to do this is you need VLAN routed private IP’s which you should have if you have a public IP set.  Add one private IP to the VPS which is it no in use then login to the VPS in question.  We’ll say the private ip is 10.10.10.10 in this case and we’ll need to run the following command:

ip r a 10.0.0.0/8 dev venet0 scope link src 10.10.10.10

Now you can ping 10.0.80.11 and you’ll notice it now responds to pings!  You can also receive 10.x.x.x traffic from any IP and also send it to any this includes VPS’s (might be useful to some).  Just so this is automatically ran you can add it to /etc/rc.local or someway so it automatically executes this.  There might be a way to do this without modifying the VPS it self but I have yet to find one so if anyone knows feel free to add a comment about it.

So I hope this helps some how or maybe if you have a better way of doing either of these feel free to post a comment.

This entry was posted in Tips. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *