(Network) Config Version 2 is not working on CentOS 7.4

Bug #1722288 reported by Thijs Cramer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Expired
Undecided
Unassigned

Bug Description

We're using CentOS 7.4.1708.
My config (using NoCloud ISO):

#### meta-data
#cloud-config
instance-id: iid-<hostname>
local-hostname: <fqdn>

#### user-data
#cloud-config
write_files:
  - content: |
      # This file is automatically generated by cloud-init!
      172.29.6.61 <fqdn> <hostname>
      127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
      ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
    path: /etc/hosts

#### network-config:
version: 1
config:
  - type: physical
    name: eth0
    subnets:
      - type: static
        address: <ip>/16
        dns_nameservers:
          - <DNS1>
          - <DNS2>
        dns_search:
          - <DNS_DOMAIN>
  - type: route
    destination: 0.0.0.0/0
    gateway: <GATEWAY>

I've disabled NetworkManager, and enabled the 'old' network daemon with chkconfig.

Things that do not work:
gateway is not set (either in the network-scripts/ifcfg-eth0 file or in the routes table). I've also tried to set the default gateway inside the subnet block, doesn't work either.

resolv.conf is empty, except for a comment that cloud-init visited the file.... :(

I've tried using Config Version 2, but that fails horribly (not even the IP is set). Even when enabling NetworkManager things go hay-wire real soon (things like dhclient interfering, having a DHCP address as well as a static address...)

I only want 3 things:
- simple network configuration with IP, GW, DNS and DNS Lookup Domain
- hostname
- hosts file

I don't care if i have to use the Legacy ENI, Config Version 1 or Config Version 2, i just want it to work...

Can anyone provide a working example?

description: updated
Revision history for this message
xiaoxin yang (xiaoxin-yang) wrote :

You might need to remove the prefix in 'address: <ip>/16'. It doesn't work on CentOS7.

I believe this issue was addressed by d00da2d5b0d45db5670622a66d833d2abb907388 in the latest cloud-init.

The route part doesn't work even in the latest cloudinit.

Revision history for this message
xiaoxin yang (xiaoxin-yang) wrote :

I tried the latest cloud-init and route works after moving to subnets. Here is my config:

network:
  version: 1
  config:
    - type: physical
      name: eth1
      subnets:
        - type: static
          address: 192.168.10.4/24
          routes:
            - network: 192.168.20.0
              gateway: 192.168.10.1

Revision history for this message
Scott Moser (smoser) wrote :

Hi,
Can you try out cloud-init from copr repo and report if that is working for you?
You do need to use sysconfig/chkconfig but it should work.

the network config that you provided (v1) should work for sure.

If it does not, please run 'cloud-init collect-logs' adn attach output.

Then, set Status to New again.

Changed in cloud-init:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for cloud-init because there has been no activity for 60 days.]

Changed in cloud-init:
status: Incomplete → Expired
Revision history for this message
James Falcon (falcojr) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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