No support for classless-static-routes on centos 7

Bug #1850642 reported by Harry Kominos on 2019-10-30
This bug affects 2 people
Affects Status Importance Assigned to Milestone

Bug Description

In a tripleo Rocky deployment I am seeing the behaviour bellow.

In the bootup logs I see that the metadata service could not be reached.

  File "/usr/lib/python2.7/site-packages/cloudinit/sources/", line 177, in _crawl_metadata
    'No active metadata service found')

However the service is curlable from inside the VM and I am also seeing some requests in the metadata-service in Openstack. Furthemore I am getting SSH keys inserted so I believe this might be a false warning.

Harry Kominos (hkominos) wrote :
Scott Moser (smoser) wrote :

I think this is a duplicate of bug 1801364.

Scott Moser (smoser) wrote :

un-dupe this if you think my diagnosis is wrong.

Scott Moser (smoser) wrote :

un-marked as a duplicate.
cloud-init WARNed twice in this log.
a.) openstack local datasource failed to read metadata service (timed out)
b.) openstack network datasource worked, but failed to persisting instance-data.json. This is bug 1801364 I'm pretty sure.

I think the reason for 'a' is the fact that the dhcp lease gave an explicit
route to, but cloud-init doesn't know how to read that in its
EphemeralDhcp network. See:

+++++++++++++++++++++++++++++++++Route IPv4 info++++++++++++++++++++++++++++++++++
| Route | Destination | Gateway | Genmask | Interface | Flags |
| 0 | | | | eth0 | UG |
| 1 | | | | eth0 | U |
| 2 | | | | eth0 | UGH |

Ryan Harper (raharper) wrote :
Download full text (8.2 KiB)

The logs do contain that bug, but I'm not sure that's the failure here.

Looking at the cloud-init logs, we can see the Ephemeral DHCP start and obtain an lease, but the end point does not respond:

2019-10-30 13:28:41,516 -[DEBUG]: Received dhcp lease on eth0 for
2019-10-30 13:28:41,516 -[DEBUG]: Attempting setup of ephemeral network on eth0 with brd
2019-10-30 13:28:41,516 -[DEBUG]: Running command ['ip', '-family', 'inet', 'addr', 'add', '', 'broadcast', '', 'dev', 'eth0'] with allowed return codes [0] (shell=False, capture=True)
2019-10-30 13:28:41,519 -[DEBUG]: Running command ['ip', '-family', 'inet', 'link', 'set', 'dev', 'eth0', 'up'] with allowed return codes [0] (shell=False, capture=True)
2019-10-30 13:28:41,522 -[DEBUG]: Running command ['ip', 'route', 'show', ''] with allowed return codes [0] (shell=False, capture=True)
2019-10-30 13:28:41,525 -[DEBUG]: Running command ['ip', '-4', 'route', 'add', '', 'dev', 'eth0', 'src', ''] with allowed return codes [0] (shell=False, capture=True)
2019-10-30 13:28:41,527 -[DEBUG]: Running command ['ip', '-4', 'route', 'add', 'default', 'via', '', 'dev', 'eth0'] with allowed return codes [0] (shell=False, capture=True)
2019-10-30 13:29:21,573 -[DEBUG]: Resolving URL: took 40.044 seconds
2019-10-30 13:29:21,574 -[DEBUG]: [0/1] open '' with {'url': '', 'headers': {'User-Agent': 'Cloud-Init/18.5'}, 'allow_redirects': True, 'method': 'GET', 'timeout': 10.0} configuration
2019-10-30 13:29:31,608 -[DEBUG]: Calling '' failed [10/-1s]: request error [HTTPConnectionPool(host='', port=80): Max retries exceeded with url: /openstack (Caused by ConnectTimeoutError(<requests.packages.urllib3.connection.HTTPConnection object at 0x7fdc5e5dc210>, 'Connection to timed out. (connect timeout=10.0)'))]
2019-10-30 13:29:31,608 -[DEBUG]: Giving up on OpenStack md from [''] after 10 seconds
2019-10-30 13:29:31,609 -[DEBUG]: Crawl of metadata service took 50.079 seconds

Cloud-init did not find the OpenStack datasource at local time:

2019-10-30 13:29:31,689 -[DEBUG]: No local datasource found

So we write out a fallback network config (dhcp on eth0).

2019-10-30 13:29:31,722 -[INFO]: Applying network configuration from fallback bringup=False: {'version': 1, 'config': [{'subnets': [{'type': 'dhcp'}], 'type': 'physical', 'name': 'eth0', 'mac_address': 'fa:16:3e:f4:b5:1d'}]}
2019-10-30 13:29:31,723 -[DEBUG]: Selected renderer 'sysconfig' from priority list: None
2019-10-30 13:29:31,725 -[DEBUG]: Writing to /etc/sysconfig/network-scripts/ifcfg-eth0 - wb: [644] 159 bytes
2019-10-30 13:29:31,726 -[DEBUG]: Restoring selinux mode for /etc/sysconfig/network-scripts/ifcfg-eth0 (recursive=False)
2019-10-30 13:29:31,726 -[DEBUG]: Restor...


Harry Kominos (hkominos) wrote :

Attaching the lease file

Scott Moser (smoser) wrote :

Un-duped again.

Ryan was on the right path... this is very close to bug 1821102.
But the lease there has a "rfc3442-classless-static-routes" entry
while Harry's has a 'classless-static-routes' entry.
And they're unfortunately different formats. Fun.

Examples collected in bugs:
  rfc3442-classless-static-routes 32,169,254,169,254,130,56,248,255,0,130,56,240,1;
  option classless-static-routes,0;

I guess possibly the centos 7 dhclient is just formatting the response

The lease that Harry posted looks like below:

lease {
  interface "eth0";
  option subnet-mask;
  option routers;
  option dhcp-lease-time 86400;
  option dhcp-message-type 5;
  option domain-name-servers;
  option dhcp-server-identifier;
  option interface-mtu 1500;
  option dhcp-renewal-time 43200;
  option classless-static-routes,0;
  option broadcast-address;
  option dhcp-rebinding-time 75600;
  option host-name "host-136-156-90-65";
  option domain-name "openstacklocal";
  renew 4 2019/10/31 02:14:16;
  rebind 4 2019/10/31 12:15:38;
  expire 4 2019/10/31 15:15:38;

Scott Moser (smoser) wrote :

cloud-init version used was cloudcloud-init-18.5-3.el7.centos.x86_64

Ryan Harper (raharper) wrote :

The value:

option classless-static-routes,0;

Doesn't look valid to me, the first period seems to be misplaced; it's either all comma separated, or space-separated list of IP/mask values.

Can we get the dhcp client's hook scripts? that's usually where the classless-static-route parsing is handled.

Changed in cloud-init:
status: New → Incomplete
Ryan Harper (raharper) wrote :

This suggests that this is another format, internal to the dhclient.

Once the system is up, can you include the output from:

% ip -d route show

And any dhclient related config or log files?

Ryan Harper (raharper) wrote :

I *think* the format is:


Comma is the record separator

0 is alias for default gateway.

With that, we'd have two routes:

ip route add via
ip route add default via

But I'd really like to see some source code of dhcp client to confirm
that this is the format being written.

Scott Moser (smoser) wrote :

@Harry, can you please post:
 $ rpm -q dhclient
 $ cat /usr/sbin/dhclient-script

then set the bug back to new.

summary: - Cloud init unable to find the metadata service but can CURL it
+ No support for classless-static-routes on centos 7
Harry Kominos (hkominos) wrote :

ip -d route show
unicast default via dev ens3 proto boot scope global
unicast dev ens3 proto kernel scope link src
unicast via dev ens3 proto static scope global

As for dhclient hooks, I see nothing in /etc/dhcp/. Is there some other location ?

Harry Kominos (hkominos) wrote :

rpm -qa |grep dhclient

I have also attached the dhclient hook.

Changed in cloud-init:
status: Incomplete → New
Ryan Harper (raharper) wrote :

Thanks Harry,

With the dhclient-script, I've found the parsing logic. Cloud-init will need to handle this format as well.

Changed in cloud-init:
importance: Undecided → Medium
status: New → Triaged
Ryan Harper (raharper) wrote :

Looking at the hook script, I see the record separator is ', |'

 if [ -n "${new_classless_static_routes}" ]; then
                IFS=', |'

And then, each entry is either 0 (default route)
or, it's split on '.'

if [ ${target} = "0" ]; then
   IFS="." target_arr=(${target})
   unset IFS
   for j in $(seq $pads); do

Hi all, first time commenting, so please do critic :).

My opinion on the matter is that is we use dhclient to do the leasing, maybe we should use it's interface to get the DNS option instead. That way we would avoid having to maintain a mapping of different naming convention.

Now, I understand that dhclient doesn't expose such mapping and that it's decided at compile time;
elafontaine@centos7# strings /sbin/dhclient | grep -i classless
classless static routes option has wrong size or there's some garbage in format

Maybe we could try to find a way to interface by having our own set of options asked to avoid that trouble?

so a dhclient.conf that would have an include statement on the standard dhclient.conf ?


BTW, I fixed this issue on my side by having dhclient.conf just rename the classless-static-route option to rfc3442-classless-static-routes.

my bad, the rfc3442-class-static-routes was working due to another hook. just setting the option doesn't solve the issue.

This bug is believed to be fixed in cloud-init in version 19.4. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Triaged → Fix Released
Harry Kominos (hkominos) wrote :

Hi again.
I have rebuild a centos image and integrated cloud-init 19.4+514.g4a4e26a4-1.el7 from

Again I believe the same issue is present. No metadata source is found in the network.

Logs are provided from both these bootups

Harry Kominos (hkominos) wrote :

As a workaround I force the metadata source to come as a disk and that works as expected.
I have attached a log to show how I would expect cloud init to work when network is the default metadata source

Harry Kominos (hkominos) wrote :

Bug re-opened

Changed in cloud-init:
status: Fix Released → New
Harry Kominos (hkominos) wrote :

Attaching the leases file that I get when I force the metadata source to be the network.

Harry Kominos (hkominos) wrote :

I am going to close this. The issue is appears to be resolved. The logs above do not represent accurate findings since the metadata service was not replying (for some reason).

Changed in cloud-init:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.