0

I downloaded CentOS Atomic Host from here and installed in VirtualBox VM with Bridged adapter as the network adapter. Default installation and I only setup root password and nothing else. Then I logged in the VM and ran the command systemctl enable cloud-init to initialize my instance and reboot. The user-data and meta-data files of cloud-init are as follows:

#meta-data                     |   #user-data
--------------------------------------------------------------------------------
instance-id: magicatomic       |   #cloud-config
local-hostname: ss.magicatomic |   groups:
network-interfaces: |          |     - docker: [root]
  auto enp0s3                  |    write_files:
  iface enp0s3 inet static     |     - content: |
    address 192.168.1.110      |        {
    network 192.168.1.0        |           "debug": true,
    netmask 255.255.255.0      |           "hosts": ["tcp://192.168.1.110:2375"]
    broadcast 192.168.1.255    |        }
    gateway 192.168.1.1        |       path: /etc/docker/daemon.json
                               |       runcmd:
                               |         - sudo systemctl daemon-reload
                               |         - sudo systemctl restart docker.service

But the configuration is half broken, meaning: Default Gateway is not set and Protocol is not set to static in /etc/sysconfig/network-scripts/ifcfg-enp0s3 When I do cat /etc/sysconfig/network-scripts/ifcfg-enp0s3 I get

BOOTPROTO=none
DEVICE=enp0s3
IPADDR=192.168.1.110
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=ethernet
USERCTL=no

And when I do route -n

Kernel IP Routing Table
Destination   Gateway       Genmask        Flags  Metric  Ref  Use  Iface
172.17.0.0    0.0.0.0       255.255.0.0    U      0       0    0    docker0
192.168.1.0   0.0.0.0       255.255.255.0  U      100     0    0    enp0s3

QUESTION: No Default Gateway is set

Akshay Shah
  • 45
  • 1
  • 7

1 Answers1

0

Maybe it's only 25% broken... Your cloud-init configuration results in "BOOTPROTO=none", which is equivalent with "BOOTPROTO=static" More info at these links.

https://access.redhat.com/solutions/41630 or https://unix.stackexchange.com/questions/167083/bootproto-none-static-dhcp-and-etc-resolv-conf

I'm still looking for why the default gateway is not set. Have you tried removing that line? I'm reviewing the docs... http://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v1.html

Update: This appears to be a known issue, and is being actively worked on. The bugs tracking this issue are https://bugzilla.redhat.com/show_bug.cgi?id=1492726 and https://bugs.launchpad.net/cloud-init/+bug/1686856

As a workaround, I would suggest adding a line to runcmd with something like this nmcli con modify enp0s3 ipv4.gateway 192.168.1.1

John Call
  • 31
  • 3
  • Unfortunately, the workaround you suggested doesn't seem to work. Also, approximately how much time does it take to resolve such bugs because I need to use this in production so need to decide what should be done. – Akshay Shah Nov 10 '17 at 10:28
  • I don't think I can estimate how much time a resolution would take. All of the code changes have been completed. It appears to be a packing / delivery delay at this point. My workaround may have gotten NetworkManager's profile name wrong. It might be "System enp0s3"... If you have a booted instance, you can verify the name with the command "nmcli connection show" – John Call Nov 10 '17 at 16:43
  • i had the same problem; i ended up doing a write_files in cloud-config's userdata, which wrote: GATEWAY=192.168.0.1 into /etc/sysconfig/network and a run-cmd: systemctl restart network - that's ugly but it works. – frisbee23 Nov 15 '17 at 18:22