Comment 2 for bug 1805038

Revision history for this message
Lukas Märdian (slyon) wrote (last edit ):

Hi Michael,

the "dev" part is enabled by default in netplan, as every route is defined within a network definition for a specific network interface.

But netplan assumes a default of type: "unicast" and scope: "global" for routes and such routes require a gateway ("via") setting. Maybe we should improve netplan's default here, to detect "scope: link" routes automatically...

The iproute2 example you showed above creates a "scope: link" route:

$ sudo ip route add 10.96.0.0/24 dev enp0s31f6
$ ip route
[...]
10.96.0.0/24 dev enp0s31f6 scope link

So in order to create the same effect via netplan, you should be able to use this stanza:

      routes:
      - to: 10.96.0.0/24
        scope: link

PS: I started drafting some improvements here: https://github.com/canonical/netplan/pull/248