sysconfig renderer does not render gateway settings in ifcfg-$iface files
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Undecided
|
Unassigned | ||
oVirt |
Unknown
|
High
|
|||
CentOS |
Unknown
|
Undecided
|
Bug Description
cloud-init trunk with the following network config:
network:
version: 1
config:
- type: physical
name: interface0
subnets:
- type: static
renders an ifcfg-interface0 file without a GATEWAY=10.0.2.2
% cat /etc/sysconfig/
# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=static
DEVICE=interface0
HWADDR=
IPADDR=10.0.2.15
NETMASK=
NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
Subsequently, route -n shows that a default gateway is not set.
% route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 interface0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 interface0
If you add GATEWAY=10.0.2.2 you see a route like this:
% route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.0.2.2 0.0.0.0 UG 0 0 0 interface0
10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 interface0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 interface0
Changed in ovirt: | |
importance: | Unknown → High |
Changed in centos: | |
importance: | Unknown → Undecided |
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 gateway- ping-timeout: 0 3eff:fed5: fad9 gateway- ping-timeout: 0 3eff:fed5: fad9 p/NetworkManage r/ActiveConnect ion/3) gateway- ping-timeout: 0 3eff:fed5: fad9 1565-44e2- 916f-f211c7e07f 13 localdomain interfaces: |
connection.
ipv4.gateway: --
ipv6.gateway: --
IP4.GATEWAY: --
IP6.GATEWAY: fe80::c4ee:
[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.
ipv4.gateway: --
ipv6.gateway: --
IP4.GATEWAY: --
IP6.GATEWAY: fe80::c4ee:
[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/freedeskto
[root@enginevm ~]# nmcli con show "System eth0" | grep -i GATEWAY
connection.
ipv4.gateway: 192.168.1.1
ipv6.gateway: --
IP4.GATEWAY: 192.168.1.1
IP6.GATEWAY: fe80::c4ee:
[root@enginevm ~]# mount /dev/sr0 /mnt/
mount: /dev/sr0 is write-protected, mounting read-only
[root@enginevm ~]# cat /mnt/meta-data
instance-id: d8b22f43-
local-hostname: enginevm.
network-
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: +++++++ +++++++ +++++++ +++Net device info+++ +++++++ +++++++ +++++++ +++++++ --+---- --+---- ------- ----+-- ------- ------+ ------- +------ ------- ------+ --+---- --+---- ------- ----+-- ------- ------+ ------- +------ ------- ------+ --+---- --+---- ------- ----+-- ----...
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: +++++++
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: +------