Two years ago I used Rackspace as my hosting platform. Their tech was pretty horrible, but, I found a way around most of my problems. One huge problem was finding the IP address of my load balancer so I could set my application to ignore that IP and use the http_x_forwarded_for address.

#! /bin/bash

#########################################################
# Bash Script to find the Interal IP for Load Balancers #
#########################################################

echo "=================================================="
echo "         ServiceNet IP for Load Balancers         "
echo "=================================================="

echo -n "Input Username: "
read USER

echo -n "Input API Key: "
read API

echo -n "Input Region (dfw ord lon): "
read REGION

echo -n "Input name of Load Balancer: "
read NAME

if [ "$REGION" == "lon" ]; then
  rc="lon."
else
  rc=""
fi
TOKEN=`curl -s -i -H "X-Auth-User: $USER" -H "X-Auth-Key: $API" https://${rc}auth.api.rackspacecloud.com/v1.0 | grep "Auth-Token:" | gawk '{ print $2 }'`
DDI=`curl -s -i -H "X-Auth-User: $USER" -H "X-Auth-Key: $API" https://${rc}auth.api.rackspacecloud.com/v1.0 | grep "Server-Management" | grep -Eo [0-9][0-9][0-9]*`

LB=`curl -s -H "X-Auth-Token: $TOKEN" https://$REGION.loadbalancers.api.rackspacecloud.com/v1.0/$DDI/loadbalancers/ | python -mjson.tool | grep "$NAME" -B 1 | grep "id" | gawk '{ print $2 }' | sed 's/,//g'`

echo ""
echo -n -e "ServiceNet IP = "
curl -s -H "X-Auth-Token: $TOKEN" https://$REGION.loadbalancers.api.rackspacecloud.com/v1.0/$DDI/loadbalancers/$LB | python -mjson.tool | grep "ipv4Servicenet" | gawk '{ print $2 }' | sed 's/"//g' | sed 's/,//g'

echo ""
echo "You're Welcome, $USERNAME"