Comment 11 for bug 1686856

Revision history for this message
In , Simone (simone-redhat-bugs) wrote :

Description of problem:
on latest version of cloud-init, it does not apply the default gateway on RHEL 7.4 vm.
Seen using the no-cloud provider with a static networking configuration.

 [root@enginevm ~]# nmcli con show "System eth0" | grep -i GATEWAY
 connection.gateway-ping-timeout: 0
 ipv4.gateway: --
 ipv6.gateway: --
 IP4.GATEWAY: --
 IP6.GATEWAY: fe80::c4ee:3eff:fed5:fad9
 [root@enginevm ~]# nmcli con modify "System eth0" ipv4.gateway
 Error: value for 'ipv4.gateway' is missing.
 [root@enginevm ~]#
 [root@enginevm ~]# nmcli con show "System eth0" | grep -i GATEWAY
 connection.gateway-ping-timeout: 0
 ipv4.gateway: --
 ipv6.gateway: --
 IP4.GATEWAY: --
 IP6.GATEWAY: fe80::c4ee:3eff:fed5:fad9
 [root@enginevm ~]# nmcli con modify "System eth0" ipv4.gateway 192.168.1.1
 [root@enginevm ~]# nmcli con reload "System eth0"
 [root@enginevm ~]# nmcli con up "System eth0"
 Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)
 [root@enginevm ~]# nmcli con show "System eth0" | grep -i GATEWAY
 connection.gateway-ping-timeout: 0
 ipv4.gateway: 192.168.1.1
 ipv6.gateway: --
 IP4.GATEWAY: 192.168.1.1
 IP6.GATEWAY: fe80::c4ee:3eff:fed5:fad9
 [root@enginevm ~]# mount /dev/sr0 /mnt/
 mount: /dev/sr0 is write-protected, mounting read-only
 [root@enginevm ~]# cat /mnt/meta-data
 instance-id: d8b22f43-1565-44e2-916f-f211c7e07f13
 local-hostname: enginevm.localdomain
 network-interfaces: |
   auto eth0
   iface eth0 inet static
     address 192.168.1.204
     network 192.168.1.0
     netmask 255.255.255.0
     broadcast 192.168.1.255
     gateway 192.168.1.1

under /var/log/messages:
Sep 18 09:47:34 localhost cloud-init: Cloud-init v. 0.7.9 running 'init' at Mon, 18 Sep 2017 09:47:34 +0000. Up 8.48 seconds.
Sep 18 09:47:34 localhost cloud-init: ci-info: +++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++
Sep 18 09:47:34 localhost cloud-init: ci-info: +--------+------+---------------+---------------+-------+-------------------+
Sep 18 09:47:34 localhost cloud-init: ci-info: | Device | Up | Address | Mask | Scope | Hw-Address |
Sep 18 09:47:34 localhost cloud-init: ci-info: +--------+------+---------------+---------------+-------+-------------------+
Sep 18 09:47:34 localhost cloud-init: ci-info: | lo: | True | 127.0.0.1 | 255.0.0.0 | . | . |
Sep 18 09:47:34 localhost cloud-init: ci-info: | lo: | True | . | . | d | . |
Sep 18 09:47:34 localhost cloud-init: ci-info: | eth0: | True | 192.168.1.204 | 255.255.255.0 | . | 00:16:3e:10:dc:25 |
Sep 18 09:47:34 localhost cloud-init: ci-info: | eth0: | True | . | . | d | 00:16:3e:10:dc:25 |
Sep 18 09:47:34 localhost cloud-init: ci-info: +--------+------+---------------+---------------+-------+-------------------+
Sep 18 09:47:34 localhost cloud-init: ci-info: +++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++
Sep 18 09:47:34 localhost cloud-init: ci-info: +-------+-------------+---------+---------------+-----------+-------+
Sep 18 09:47:34 localhost cloud-init: ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags |
Sep 18 09:47:34 localhost cloud-init: ci-info: +-------+-------------+---------+---------------+-----------+-------+
Sep 18 09:47:34 localhost cloud-init: ci-info: | 0 | 192.168.1.0 | 0.0.0.0 | 255.255.255.0 | eth0 | U |
Sep 18 09:47:34 localhost cloud-init: ci-info: +-------+-------------+---------+---------------+-----------+-------+
Sep 18 09:47:34 localhost systemd: Started Dynamic System Tuning Daemon.
Sep 18 09:47:34 localhost NetworkManager[829]: <info> [1505728054.7326] ifcfg-rh: update /etc/sysconfig/network-scripts/ifcfg-eth0 (5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03,"System eth0")
Sep 18 09:47:34 localhost systemd: Started Postfix Mail Transport Agent.
Sep 18 09:47:34 localhost NetworkManager[829]: <info> [1505728054.8337] device (eth0): state change: activated -> deactivating (reason 'user-requested') [100 110 39]
Sep 18 09:47:34 localhost NetworkManager[829]: <info> [1505728054.8341] manager: NetworkManager state is now DISCONNECTING
Sep 18 09:47:34 localhost NetworkManager[829]: <info> [1505728054.8382] audit: op="device-disconnect" interface="eth0" ifindex=2 pid=1384 uid=0 result="success"
Sep 18 09:47:34 localhost NetworkManager[829]: <info> [1505728054.8384] device (eth0): state change: deactivating -> disconnected (reason 'user-requested') [110 30 39]
Sep 18 09:47:34 localhost NetworkManager[829]: <info> [1505728054.8406] manager: NetworkManager state is now DISCONNECTED
Sep 18 09:47:34 localhost nm-dispatcher: req:3 'down' [eth0]: new request (4 scripts)
Sep 18 09:47:34 localhost cloud-init: Device 'eth0' successfully disconnected.
Sep 18 09:47:34 localhost nm-dispatcher: req:3 'down' [eth0]: start running ordered scripts...
Sep 18 09:47:34 localhost NetworkManager[829]: <info> [1505728054.9309] device (eth0): Activation: starting connection 'System eth0' (5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03)
Sep 18 09:47:34 localhost NetworkManager[829]: <info> [1505728054.9310] audit: op="connection-activate" uuid="5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03" name="System eth0" pid=1423 uid=0 result="success"
Sep 18 09:47:34 localhost NetworkManager[829]: <info> [1505728054.9310] device (eth0): state change: disconnected -> prepare (reason 'none') [30 40 0]
Sep 18 09:47:34 localhost NetworkManager[829]: <info> [1505728054.9311] manager: NetworkManager state is now CONNECTING
Sep 18 09:47:34 localhost NetworkManager[829]: <info> [1505728054.9313] device (eth0): state change: prepare -> config (reason 'none') [40 50 0]
Sep 18 09:47:34 localhost NetworkManager[829]: <info> [1505728054.9461] device (eth0): state change: config -> ip-config (reason 'none') [50 70 0]
Sep 18 09:47:34 localhost NetworkManager[829]: <info> [1505728054.9513] device (eth0): state change: ip-config -> ip-check (reason 'none') [70 80 0]
Sep 18 09:47:34 localhost NetworkManager[829]: <info> [1505728054.9521] device (eth0): state change: ip-check -> secondaries (reason 'none') [80 90 0]
Sep 18 09:47:34 localhost NetworkManager[829]: <info> [1505728054.9522] device (eth0): state change: secondaries -> activated (reason 'none') [90 100 0]
Sep 18 09:47:34 localhost NetworkManager[829]: <info> [1505728054.9523] manager: NetworkManager state is now CONNECTED_LOCAL
Sep 18 09:47:34 localhost cloud-init: Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
Sep 18 09:47:34 localhost NetworkManager[829]: <info> [1505728054.9570] device (eth0): Activation: successful, device activated.
Sep 18 09:47:34 localhost nm-dispatcher: req:4 'up' [eth0]: new request (4 scripts)
Sep 18 09:47:34 localhost nm-dispatcher: req:4 'up' [eth0]: start running ordered scripts...

Cloud-init configuration:
[root@enginevm ~]# cat /mnt/meta-data
instance-id: d8b22f43-1565-44e2-916f-f211c7e07f13
local-hostname: enginevm.localdomain
network-interfaces: |
  auto eth0
  iface eth0 inet static
    address 192.168.1.204
    network 192.168.1.0
    netmask 255.255.255.0
    broadcast 192.168.1.255
    gateway 192.168.1.1

Version-Release number of selected component (if applicable):
cloud-init.x86_64 0.7.9-9.el7.centos.2 @anaconda

How reproducible:
100%

Steps to Reproduce:
1. try to configure static ipv4 networking with a gateway with cloud-init and no-cloud provider
2.
3.

Actual results:
it ignores the gateway parameter

Expected results:
it applies also the gateway parameters

Additional info: