route files are not written on SUSE distros

Bug #1812117 reported by Robert Schweikert on 2019-01-16
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Undecided
Unassigned

Bug Description

On SUSE distros the routes need to be written to ifroute-* files.

At present the sysconfig renderer does not write the default routes to ifroute-* files, rather the default rout information is set in ifcfg-*. However the values DEFROUTE=yes and IPV6_DEFAULTGW have no meaning in SUSE ifcfg-* files and are ignored. The routes for an interface are loaded from the ifroute-* file.

The file content is expected to be in the format

Destination Gateway Netmask Interface Options

The following config shown at https://pastebin.ubuntu.com/p/jjMKVTSK9v/ should produce 3 ifroute-* files

ifroute-eth1
default 10.80.124.81

ifroute-eth2
default 192.168.1.254

ifroute-eth3
default fe80::10:80:124:81

Related branches

Robert Schweikert (rjschwei) wrote :

Examples from the man page

       An example with common network interfaces and some static routes:

       # --- IPv4 routes in CIDR prefix notation:
       # Destination [Gateway] - Interface
       #
       127.0.0.0/8 - - lo
       204.127.235.0/24 - - eth0
       default 204.127.235.41 - eth0
       207.68.156.51/32 207.68.145.45 - eth1
       192.168.0.0/16 207.68.156.51 - eth1

       # --- IPv4 routes in deprecared netmask notation:
       # Destination [Dummy/Gateway] Netmask Interface
       #
       127.0.0.0 0.0.0.0 255.255.255.0 lo
       204.127.235.0 0.0.0.0 255.255.255.0 eth0
       default 204.127.235.41 0.0.0.0 eth0
       207.68.156.51 207.68.145.45 255.255.255.255 eth1
       192.168.0.0 207.68.156.51 255.255.0.0 eth1

       # --- IPv6 routes are always using CIDR notation:
       # Destination [Gateway] - Interface
       #
       2001:DB8:100::/64 - - eth0
       2001:DB8:100::/32 fe80::216:3eff:fe6d:c042 - eth0

Robert Schweikert (rjschwei) wrote :
Robert Schweikert (rjschwei) wrote :

And some more fun. We have to know the routes for all the interfaces. For example with the following configuration:

 {'version': 1, 'config': [{'type': 'physical', 'mtu': 1500, 'subnets': [{'type': 'static', 'netmask': '255.255.240.0', 'routes': [{'netmask': '0.0.0.0', 'network': '0.0.0.0', 'gateway': '51.68.80.1'}], 'address': '51.68.89.122', 'ipv4': True}], 'mac_address': 'fa:16:3e:25:b4:59', 'name': 'eth0'}, {'type': 'physical', 'mtu': 9000, 'subnets': [{'type': 'dhcp4'}], 'mac_address': 'fa:16:3e:b1:ca:29', 'name': 'eth1'}, {'type': 'nameserver', 'address': '213.186.33.99'}]}

We need to generate ifcfg-eth1 that contains:

DHCLIENT_SET_DEFAULT_ROUTE=no

in order to avoid the dhcpclient to set the default route based on the information received from the dhcp server on eth1.

I have a test case for this already. But I haven't figure out how to make it work as in sysconfig.py _render_subnets() does so on a per interface basis and thus there is no knowledge of the network topology.

Robert Schweikert (rjschwei) wrote :

https://code.launchpad.net/~rjschwei/cloud-init/+git/cloud-init/+merge/362020

Addresses the issue with setting DHCLIENT_SET_DEFAULT_ROUTE=no for networks where a default route is configured.

This bug is fixed with commit 3acaacc9 to cloud-init on branch master.
To view that commit see the following URL:
https://git.launchpad.net/cloud-init/commit/?id=3acaacc9

Changed in cloud-init:
status: New → Fix Committed

This bug is believed to be fixed in cloud-init in version 19.1. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers