Retrieving Xenstore Networking settings from within a Rackspace Server

When a customer of ours is having issues with their networking, such as the configured gateway or netmask, we are able to provide a oneliner that allows them to run on the VM guest a command which takes the information directly from xenstore, (xe-linux-distribution). Find the command below.

xenstore-read vm-data/networking/$(xenstore-ls vm-data/networking | awk '/private/{print$1}')
{"label": "private", "broadcast": "10.255.255.255", "ips": [{"ip": "10.177.194.237", "netmask": "255.255.255.0", "enabled": "1", "gateway": null}], "mac": "BC:76:4E:11:11:11", "dns": ["83.138.151.81", "83.138.151.80"], "routes": [{"route": "10.208.0.0", "netmask": "255.255.0.0", "gateway": "10.166.255.1"}, {"route": "10.116.0.0", "netmask": "255.240.0.0", "gateway": "10.1.1.1"}], "gateway": null}

Please note that the information was modified for privacy. This is just grabbing servicenet. To gather all the vm-data use

xenstore-ls vm-data

Altogether now:

Step 1. Retrieve all vm-data


$ xenstore-ls vm-data
 user-metadata = ""
 rax_service_level_automation = ""Complete""
 build_config = """"
networking = ""
 BC764E182CB = "{"label": "private", "broadcast": "10.177.1.1", "ips": [{"ip": "10.177.1.1", "netmask": "255.255.255.0", "enabled": "1", "gateway": null}], "mac": "BC:76\..."
 BC764E0192DB = "{"ip6s": [{"ip": "2a00:1a48:7803:107:be76:4eff::", "netmask": 64, "enabled": "1", "gateway": "fg80::def"}], "label": "public", "broadcast": "37.188.117.2\..."
meta = "{"rxtx_cap": 80.0}"
auto-disk-config = "False"

Step 2. Retrieve data for Network MACID

xenstore-read vm-data/networking/BC764E182CB
"label": "private", "broadcast": "10.177.255.255", "ips": [{"ip": "10.177.1.1", "netmask": "255.255.255.0", "enabled": "1", "gateway": null}], "mac": "", "dns": ["83.138.151.81", "83.138.151.80"], "routes": [{"route": "10.1.0.0", "netmask": "255.255.255.0", "gateway": "10.177.1.1"}, {"route": "10.1.1.0", "netmask": "255.255.0.0", "gateway": "10.101.1.1"}], "gateway": null}

xenstore-read vm-data/networking/BC764E0192DB
{"ip6s": [{"ip": "2a00:1a48:7803:107:be76:4eff:fe08:9cc3", "netmask": 64, "enabled": "1", "gateway": "fe80::def"}], "label": "public", "broadcast": "37.1.117.255", "ips": [{"ip": "37.188.117.48", "netmask": "255.255.255.0", "enabled": "1", "gateway": "37.1.117.1"}], "mac": "", "gateway_v6": "ge77::def", "dns": ["83.138.151.81", "83.138.151.80"], "gateway": "37.1.117.1"}

Please note I sanitised the MACID and IP address information, altering it not to show my real ips and subnets, it is just to give you an idea of the two virtual intefaces, publicnet & servicenet.