The metadata service is hosted by the "Virtual Router" of a domain, which is also a router and a DHCP server.
The FQDN of the metadata service is "data-server" + a customizable network domain. This domain name is provided by DHCP.
For example, in my CloudStack lab environment, it is "vm.apalia.lan". I've copy-pasted below some command outputs from this specific lab environment.
With a Fedora 33 VM in my CloudStack lab environment, you can see that:
- dig needs the FQDN to find the data-server IP address,
- "host" succeeds with "data-server" but fails with "data-server."
- However, both curl and python's getaddrinfo returns the correct IP address
of the metadata service when requesting data-server or data-server.
With a Fedora 34 VM, you can see that both curl and python's getaddrinfo now
returns the correct IP address when being requested with "data-server" or the
FQDN (here "data-server.vm.apalia.lan") but fail with "data-server."
[fedora@fed34 ~]$ python
Python 3.9.6 (default, Jul 16 2021, 00:00:00)
[GCC 11.1.1 20210531 (Red Hat 11.1.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from socket import getaddrinfo
>>> getaddrinfo("data-server", 80)
[(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('10.0.26.1', 80)), (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('10.0.26.1', 80)), (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_RAW: 3>, 0, '', ('10.0.26.1', 80))]
>>> getaddrinfo("data-server.", 80)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.9/socket.py", line 953, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
However, CloudStack documents using "data-server." to find the metadata service, so I'll ping some people in the CloudStack community to have their views.
Hi James,
The metadata service is hosted by the "Virtual Router" of a domain, which is also a router and a DHCP server.
The FQDN of the metadata service is "data-server" + a customizable network domain. This domain name is provided by DHCP.
For example, in my CloudStack lab environment, it is "vm.apalia.lan". I've copy-pasted below some command outputs from this specific lab environment.
With a Fedora 33 VM in my CloudStack lab environment, you can see that:
- dig needs the FQDN to find the data-server IP address,
- "host" succeeds with "data-server" but fails with "data-server."
- However, both curl and python's getaddrinfo returns the correct IP address
of the metadata service when requesting data-server or data-server.
[fedora@fed33 ~]$ grep search /etc/resolv.conf
# configured search domains.
search vm.apalia.lan
[fedora@fed33 ~]$ dig +short data-server vm.apalia. lan
[fedora@fed33 ~]$ dig +short data-server.
10.0.26.1
[fedora@fed33 ~]$ host data-server vm.apalia. lan has address 10.0.26.1
data-server.
[fedora@fed33 ~]$ host data-server.
Host data-server not found: 2(SERVFAIL)
[fedora@fed33 ~]$ curl http:// data-server/ latest/ local-hostname
fed33
[fedora@fed33 ~]$ curl http:// data-server. /latest/ local-hostname
fed33
[fedora@fed33 ~]$ python "data-server" , 80) y.AF_INET: 2>, <SocketKind. SOCK_STREAM: 1>, 6, '', ('10.0.26.1', 80)), (<AddressFamily .AF_INET: 2>, <SocketKind. SOCK_DGRAM: 2>, 17, '', ('10.0.26.1', 80)), (<AddressFamily .AF_INET: 2>, <SocketKind. SOCK_RAW: 3>, 0, '', ('10.0.26.1', 80))] "data-server. ", 80) y.AF_INET: 2>, <SocketKind. SOCK_STREAM: 1>, 6, '', ('10.0.26.1', 80)), (<AddressFamily .AF_INET: 2>, <SocketKind. SOCK_DGRAM: 2>, 17, '', ('10.0.26.1', 80)), (<AddressFamily .AF_INET: 2>, <SocketKind. SOCK_RAW: 3>, 0, '', ('10.0.26.1', 80))]
Python 3.9.6 (default, Jul 16 2021, 00:00:00)
[GCC 10.3.1 20210422 (Red Hat 10.3.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from socket import getaddrinfo
>>> getaddrinfo(
[(<AddressFamil
>>> getaddrinfo(
[(<AddressFamil
With a Fedora 34 VM, you can see that both curl and python's getaddrinfo now vm.apalia. lan") but fail with "data-server."
returns the correct IP address when being requested with "data-server" or the
FQDN (here "data-server.
[fedora@fed34 ~]$ grep search /etc/resolv.conf
# configured search domains.
search vm.apalia.lan
[fedora@fed34 ~]$ dig +short data-server vm.apalia. lan
[fedora@fed34 ~]$ dig +short data-server.
10.0.26.1
[fedora@fed34 ~]$ host data-server vm.apalia. lan has address 10.0.26.1
data-server.
[fedora@fed34 ~]$ host data-server.
Host data-server not found: 2(SERVFAIL)
[fedora@fed34 ~]$ curl http:// data-server/ latest/ local-hostname
fed34
[fedora@fed34 ~]$ curl http:// data-server. /latest/ local-hostname
curl: (6) Could not resolve host: data-server.
[fedora@fed34 ~]$ curl http:// data-server. vm.apalia. lan/latest/ local-hostname
fed34
[fedora@fed34 ~]$ python "data-server" , 80) y.AF_INET: 2>, <SocketKind. SOCK_STREAM: 1>, 6, '', ('10.0.26.1', 80)), (<AddressFamily .AF_INET: 2>, <SocketKind. SOCK_DGRAM: 2>, 17, '', ('10.0.26.1', 80)), (<AddressFamily .AF_INET: 2>, <SocketKind. SOCK_RAW: 3>, 0, '', ('10.0.26.1', 80))] "data-server. ", 80) python3. 9/socket. py", line 953, in getaddrinfo getaddrinfo( host, port, family, type, proto, flags):
Python 3.9.6 (default, Jul 16 2021, 00:00:00)
[GCC 11.1.1 20210531 (Red Hat 11.1.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from socket import getaddrinfo
>>> getaddrinfo(
[(<AddressFamil
>>> getaddrinfo(
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/
for res in _socket.
socket.gaierror: [Errno -2] Name or service not known
However, CloudStack documents using "data-server." to find the metadata service, so I'll ping some people in the CloudStack community to have their views.