Cloud-init fails to set the default gateway on RHEL 7/8 via VMware Guest Customization
Issue
The default gateway set during the Guest Customization in VMware is ignored after the VM deployment.
nmcli con show "System ens222" | grep -i GATEWAY
connection.gateway-ping-timeout: 0
ipv4.gateway: --
ipv6.gateway: --
IP4.GATEWAY: --
/var/log/messages
Cloud-init v. 18.2 running 'init' at Thu, 23 May 2019 09:46:54 +0000. Up 9.90 seconds.
ci-info: ++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++
ci-info: +---------+------+-----------------+---------------+-------+-------------------+
ci-info: | Device | Up | Address | Mask | Scope | Hw-Address |
ci-info: +---------+------+-----------------+---------------+-------+-------------------+
ci-info: | ens222: | True | 192.168.160.111 | 255.255.255.0 | . | 00:50:56:a2:61:41 |
ci-info: | ens222: | True | . | . | d | 00:50:56:a2:61:41 |
ci-info: | lo: | True | 127.0.0.1 | 255.0.0.0 | . | . |
ci-info: | lo: | True | . | . | d | . |
ci-info: +---------+------+-----------------+---------------+-------+-------------------+
ci-info: ++++++++++++++++++++++++++++Route IPv4 info++++++++++++++++++++++++++++
ci-info: +-------+---------------+---------+---------------+-----------+-------+
ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags |
ci-info: +-------+---------------+---------+---------------+-----------+-------+
ci-info: | 0 | 192.168.160.0 | 0.0.0.0 | 255.255.255.0 | ens222 | U |
ci-info: +-------+---------------+---------+---------------+-----------+-------+
Environment
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 8
- VMware
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.