Cannot add scope: link route to interface

Bug #1789862 reported by Fabian
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Netplan
Confirmed
Undecided
Unassigned

Bug Description

I want to add a link local route to an interface.
Config looks like this:
network:
    ethernets:
        ens192:
            addresses:
            - 172.16.4.131/24
            optional: true
            routing-policy:
                - from: 172.16.4.0/24
                  table: 200
            routes:
                - to: 0.0.0.0/0
                  via: 172.16.4.1
                  table: 200
                  metric: 1
        ens224:
            addresses:
            - 10.0.0.31/24
            gateway4: 10.0.0.1
            optional: true
    version: 2

Unfortunately this means I cannot reach 172.16.4.0/24

I now add this route to ens192:

                - to: 172.16.4.0/24
                  scope: link
                  metric: 1

But netplan apply fails with: "unicast route must include both a 'to' and 'via' IP"
How should i give a "via" to a route with the scope link?

Revision history for this message
Fabian (rtech) wrote :

Also when using scope: link the "table" option is ignored.

Revision history for this message
Daniel Axtens (daxtens) wrote :

Hi Fabian,

I've seen this too in synthetic testing so setting to 'Confirmed'. (I haven't checked if the table option is ignored but I think that might be a kernel-level limitation rather than a netplan one - can you get it to work with ip 'route'?)

I'm not 100% sure I understand your setup, is the 'on-link' keyword an option as an alternative to a link-scoped route?

Regards,
Daniel

Changed in netplan:
status: New → Confirmed
Revision history for this message
Fabian (rtech) wrote :

I am using a script with networkd-dispatcher now:
/sbin/ip route add table 200 172.16.4.0/24 dev ens192
This correctly adds the route to the table 200.

AFAIK on-link does specify that the route should be added even when the "via" is not in the same subnet as the address. So this would not apply to my case.

Fabian (rtech)
description: updated
Revision history for this message
Daniel Axtens (daxtens) wrote :

Hi,

It looks like we've also seen this reported in LP: #1777681.

I think that duplicates your issue netplan apply failing with: "unicast route must include both a 'to' and 'via' IP". That has also had a fix committed in https://github.com/CanonicalLtd/netplan/pull/33

So I think we're just left with your issue with "Also when using scope: link the "table" option is ignored."

Regards,
Daniel

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.