Search This Blog

Monday, August 6, 2012

I'm using Rackconnect and after my cloud server is built I can't ping anything

Rackconnect is Rackspace product that allows you to use a dedicated as well as the cloud products (cloud servers, cloud files and others). It provides cloud servers a secure way to connect to the dedicated and other way around. The majority of implementations are done by using F5 load balancers and Cisco ASA firewalls but company has plans to support other vendors as well. To have a better understanding of RC an implementation can be done for example on:
  • standalone ASA
  • standalone F5
  • HA ASA 
  • HA F5 
  • single ASA and single F5 
  • single ASA and HA f5 
  • HA ASA and single F5 
  • HA ASA and HA F5
There are sometimes situations when the things don't work as expected. It can be because of a mis-configuration. In a very rare cases because of bugs. Below is an example of a problem I was ask to help to troubleshoot.

Problem 

My newly built cloud server is isolated. After logging over console I can't ping any other servers. Example:
  • I can't ping my default gateway from the cloud
  • I can't ping any other internal or external address (example Google DNS 8.8.8.8)
Troubleshooting and Analysis

The customer is using Rackconnect. That makes all the network and routing configuration a little bit different comparing to how we set up a standard cloud server without Rackconnect.

Example of a route output from a cloud servers that is rackconnected:

$ ip r | sort | column -t
10.176.0.0/12    via  10.176.0.1     dev    eth1
10.176.0.0/18    dev  eth1           proto  kernel  scope   link  src  10.176.4.37
10.191.192.0/18  via  10.176.0.1     dev    eth1
default          via  10.176.11.111  dev    eth1

For a comparison a routing table from a cloud server that belongs to a cloud account that is not linked to Rackconnect:

# ip r | sort | column -t
10.176.0.0/12     via  10.177.128.1   dev    eth1
10.177.128.0/18   dev  eth1           proto  kernel  scope   link  src  10.177.132.15
10.191.192.0/18   via  10.177.128.1   dev    eth1
164.177.146.0/24  dev  eth0           proto  kernel  scope   link  src  164.177.146.87
default           via  164.177.146.1  dev    eth0    metric  100

Starting troubleshooting I was able to reproduce the issue and confirm that you can't ping the default gateway or anything internal or external IP:

$ ping 10.176.11.111
PING 10.176.11.111 (10.176.11.111) 56(84) bytes of data.
^C
--- 10.176.11.111 ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 1293ms

Looking further I saw that the host fails to resolve the IP 10.176.11.111 (default gateway) to its MAC address. The following output from the cloud server confirmed this.

$ arp -an
? (10.176.11.111) at incomplete on eth1

As the customer was using RC with F5 load balancer i went there to check what traffic was hitting the LB. I confirmed that the cloud default gateway is defined on F5 as a self ip object so F5 should be responding to the pings.

# tmsh list /net self
net self 10.176.11.111/18 {
    vlan hybridServiceNet-100
}

When pinging from cloud server I saw that F5 see the ARP request but never replays.

[lb:Active]~ # tcpdump -s0 -l -nn -i 0.0:nnn arp or icmp or host 10.176.4.37 | grep --color=always 10.176.4.37
15:14:26.465108 arp who-has 10.176.11.111 tell 10.176.4.37


I tried to ping the cloud server from F5 and to my surprise it worked fine.

Even at some point shortly after I pinged the cloud server from F5 successfully I was able to see ICMP requests from the cloud server but still F5 was not responding back. That means once the cloud server learned the MAC address of its default gateway it stopped sending the ARP requests and proceed to sending ICMP requests next, as expected.

The cloud server learned the MAC of its default gateway for a while but as the entry timeouted there were only ARP request on the wire again.

[lb:Active] ~ # tcpdump -s0 -l -nn -i 0.0:nnn arp or icmp or host 10.176.4.37 | grep --color=always 10.176.4.37
15:20:35.309694 IP 10.176.4.37 > 10.176.11.111: ICMP echo request, id 36453, seq 1, length 64 in slot1/tmm0 lis= flowtype=0 flowid=0 =00000000:00000000:00000000:00000000 remoteport=0 localport=0 proto=0 vlan=0

By looking further at the F5 configuration I found that there was a missing filter to allow this traffic. It is important because the default RC implementation is dropping any traffic sent from the cloud network to the Rackconnect device (F5 for my customer). Below is a example of a filter that was needed for the ping to start to work.

Example of a missing filter

net packet-filter RCAuto-ID_8-NP_28780-CS_57663-GW_62497 {
    action accept
    order 8
    rule "( src host 10.176.4.37 ) and ( dst host 10.176.11.111 )"
}

The easy way to create it is to go to MyRackspace portal and add all the basic network polices under the Rackconnect. By adding these network policies the Rackconnect system generated number of rules for the F5 and one of them was the missing filter described above:

Basic Access Configuration Policy 1 CLOUD SERVERS CLOUD SERVERS ANY ALL  
Basic Access Configuration Policy 2 CLOUD SERVERS DEDICATED ANY ALL
Basic Access Configuration Policy 3 CLOUD SERVERS INTERNET ANY ALL    
Basic Access Configuration Policy 4 DEDICATED CLOUD SERVERS ANY ALL

This resolved the issue with the default gateway but I was still unable to ping 8.8.8.8. Once again  looking at the tcpdumps on F5 I saw traffic hitting F5. The loadbalancer never forwarded it further. The traffic was simply dropped on the incoming VLAN.

To understand why this is happening it is important to know that by default F5 will drop any traffic unless there is a configuration object to handle it. In my case there were no specific virtual servers, NAT, SNAT that could handle the traffic. We had only a forwarding VS. As the VS was enabled only on specific VLANS it was not used to handle the cloud traffic so all traffic was dropped.

ltm virtual VS-FORWARDING {
    destination any:any
    ip-forward
    mask any
    profiles {
        PROF-FASTL4-FORWARDING { }
    }
    translate-address disabled
    translate-port disabled
 vlans {   
        internal
        external
    }
    vlans-enabled
}

Once we resolved this and enable the VS on necessary vlans all issues were resolved ;).

Sunday, August 5, 2012

Do you know what is powering Rackconnect at Rackspace

These a few videos are showing some inside into the Hybrid Cloud Product Rackspace has to offer to its customers:





If you are looking for more information these are some links to read more about Rackconnect:


How to configure the Python interpreter to save all your commands to a history file on a disk

The interactive Python interpreter is a great way to quickly test python expressions and code snippets. With the default configuration the only disadvantage is that it doesn't keep any history of the commands your run last time. If you restart the interpreter you have to type all commands again and again.

Solution

On of the solution is to define a script to execute when the interpreter starts. This is described here [1]. My own configs can be found here [2].
  1. http://docs.python.org/tutorial/interactive.html
  2. https://github.com/rtomaszewski/configs

What does the cloud API returns when a server build failed

Cloud is a very flexible solution that can be used to build resilient, highly available and self healing architectures. But it is important to understand that it is not unbreakable and the solution has to be able to deal with it.

As an example, once in a while you are going to see that the cloud API to created a server succeded but the server itself never came online because the build failed. On Rackspace cloud infrastructure this can be visible like this.

  • In the original Cloud Control Panel (CP / CCP)
https://lon.manage.rackspacecloud.com/CloudServers/ServerList.do 



  • In the new Cloud Control Panel (CP / CCP)
https://mycloud.rackspace.com/a/accoutname/# 




  • Cloud API
$ curl -v  -H 'x-auth-token: token' https://lon.servers.api.rackspacecloud.com/v1.0/10001641/servers/10204743?fresh | json_xs 
 GET /v1.0/10001641/servers/10204743?fresh HTTP/1.1
 User-Agent: curl/7.21.3 (i686-pc-linux-gnu) libcurl/7.21.3 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
 Host: lon.servers.api.rackspacecloud.com
 Accept: */*
 x-auth-token: token
 
 HTTP/1.1 203 OK
 Server: Apache-Coyote/1.1
 vary:  Accept, Accept-Encoding, X-Auth-Token
 Last-Modified: Sun, 05 Aug 2012 01:58:58 GMT
 X-PURGE-KEY: /10001641/servers/10204743
 Cache-Control: s-maxage=1800
 Content-Type: application/json
 Content-Length: 238
 Date: Sun, 05 Aug 2012 11:19:24 GMT
 X-Varnish: 1664599762 1664599608
 Age: 50
 Via: 1.1 varnish
 Connection: keep-alive
{
   "server" : {
      "status" : "ERROR",
      "progress" : 0,
      "name" : "csperform1344130906",
      "imageId" : 112,
      "flavorId" : 1,
      "addresses" : {
         "private" : [
            "10.176.4.188"
         ],
         "public" : [
            "46.38.185.119"
         ]
      },
      "hostId" : "cb728dfc3549dc7c92fb4abcba89dd0a",
      "metadata" : {},
      "id" : 10204743
   }
}

Saturday, August 4, 2012

How to change the action for Alt-Tab shortcut in VirtualBox and switch application windows running on your Windows 7 desktop rather than switching windows between the applications inside the VM only

Using multiple virtual mashines on your single desktop can be a little bit tricky when you need to change quickly focus between the various windows. In my practice I have offen a Windows 7 base desktop and run multiple VM's either using the VirtualBox or VMware Workstation

Problem

From the desktop in Windows 7 Alt+Tab switches between all the running application windows perfectly. Once in the single VM context the some combination switches windows of your VM application rather then all your origianl Windows application.

Solution

Use the host key . In VirtualBox by default, this is the right Control key on your keyboard. It changes the focus and once pressed any key pressed after is evaluated according to your host operating system and not the VM itself.

References
  1. http://ron.shoutboot.com/2010/09/11/alt-tab-out-of-virtualbox/
  2. http://pg-jottings.blogspot.co.uk/2011/05/host-key-and-virtual-box-how-to-alt-tab.html
  3. http://www.virtualbox.org/manual/ch01.html

Thursday, August 2, 2012

How to use internaly Cloud Files from dedicated servers when using Rackconnect

This is a similar to the previous post: It is possible to use Cloud Files on the private ServiceNet from Cloud Servers .

This issue a example where this questions was asked: Gladinet CloudAFS : RackSpace Servicenet

When the Rackconnect is implementd it changes the default gateway on the cloud servers. It is used as defautl gateway for the dedicated servers when they want to sent traffic to the Rackspace cloud infrastructure. That all togheter means that when the dedicated server wants to sent a Cloud Files API request all what they have to do is to use the privatge network IP address/URL name [1]

$ dig +short A snet-storage101.lon3.clouddrive.com
10.191.209.30

$ curl -X GET -D - -H "X-Auth-Token: mytocken" https://snet-storage101.lon3.clouddrive.com/v1/MossoCloudFS_f3ae48bb-983f-49e1-b656-0c58730fed1b

References
  1. http://www.rackspace.com/blog/networking-and-cloud-servers-more-on-the-interfaces/
  2. http://support.rightscale.com/06-FAQs/What_is_Rackspace_ServiceNet_and_how_can_I_use_it%3F
  3. http://www.rackspace.com/knowledge_center/frequently-asked-question/what-is-servicenet

It is possible to use Cloud Files (CF) on the private ServiceNet from Cloud Servers

In the Rackspace API documentation [1] there is information how to authenticate yourself before you can start sending request to use Cloud files. With the API you can easily for example store a file or get a containers listing.

# to authenticate your self 
$ curl -D - -H "X-Auth-User: myuser" -H "X-Auth-Key: mykey"  https://lon.auth.api.rackspacecloud.com/v1.0
HTTP/1.1 204 No Content
Server: Apache/2.2.3 (Red Hat)
vary: X-Auth-User,X-Auth-Key,X-Storage-User,X-Storage-Pass
X-Storage-Url: https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_f3ae48bb-983f-49e1-b656-0c58730fed1b
Cache-Control: s-maxage=63832
Content-Type: text/xml
Date: Wed, 01 Aug 2012 14:04:51 GMT
X-Auth-Token: 22222222
X-Server-Management-Url: https://lon.servers.api.rackspacecloud.com/v1.0/10020713
X-Storage-Token: 111111111111
Connection: Keep-Alive
X-CDN-Management-Url: https://cdn3.clouddrive.com/v1/MossoCloudFS_f3ae48bb-983f-49e1-b656-0c58730fed1b
Content-Length: 0

# get listing 
$ curl -X GET -D - -H "X-Auth-Token: myusr" https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_f3ae48bb-983f-49e1-b656-0c58730fed1b
HTTP/1.1 200 OK
X-Account-Object-Count: 2
X-Timestamp: 1341923250.51682
X-Account-Bytes-Used: 3210734282
X-Account-Container-Count: 2
Accept-Ranges: bytes
Content-Length: 18
Content-Type: text/plain; charset=utf-8
X-Trans-Id: txa863fe8321ab4b44a31d886d1a9a7fb1
Date: Wed, 01 Aug 2012 14:17:30 GMT

Test1
Test2

The most important thing to note is that the X-Storage-Url points by default to an external IP. It means that every request sent has to go out to get than back to the cloud files. Unnecessary wasting of network bandwidth and additional latency and delay.

$ dig +short A storage101.lon3.clouddrive.com
94.236.56.96

To work this around you can use a little modified X-Storage-Url value and append the snet string at the beginning to the server name.

$ dig +short A storage101.lon3.clouddrive.com
94.236.56.96

$ dig +short A snet-storage101.lon3.clouddrive.com
10.191.209.30

Because the IP 10.191.209.30 belongs to the Rackspace internal service network all the communication will be kept inside. From the cloud server point of view it will believe that it sent traffic to an internal host. No need to use a default gateway and complicated routing of deliver the traffic to the destination host.

A correct Cloud File API request that is utilizing the internal service network within Rackspace cloud infrastructure:

$ curl -X GET -D - -H "X-Auth-Token: mytoken" https://snet-storage101.lon3.clouddrive.com/v1/MossoCloudFS_f3ae48bb-983f-49e1-b656-0c58730fed1b

References
  1. http://docs.rackspace.com/files/api/v1/cf-devguide/content/Authentication-d1e639.html
  2. http://www.rackspace.com/cloud/public/files/api/
  3. http://www.rackspace.com/knowledge_center/getting-started/cloud-files
  4. http://blog.chmouel.com/2009/10/20/accessing-to-rackspace-cloud-files-via-servicenet-update/
  5. http://loose-bits.com/2010/10/rackspace-cloud-files-and-servicenet.html
  6. http://docs.rackspace.com/files/api/v1/cf-devguide/content/Service-Access-Endpoints-d1e003.html