Page MenuHomeVyOS Platform

Add ability to add local route-type when using set protocol static
Open, NormalPublicFEATURE REQUEST

Description

Summary

Request to add local route-type to set protocol static, something like:

set protocols static route 192.168.1.20/32 local interface eth1

This would align with current syntax of blackhole route-type which is:

set protocols static route 192.0.2.1/32 blackhole

Above is needed to make VRF-leaking working to access local interface in another VRF.

Use case

When doing VRF-leaking you add static routes in VRF default and point that to VRF PROD.

Example:

# Original vrf PROD routes
set vrf name PROD protocols static route 0.0.0.0/0 next-hop 192.168.1.254 interface 'eth1'

# So accessing external hosts through gateway in vrf PROD will work for vrf default services
set protocols static route 0.0.0.0/0 next-hop 192.168.1.254 vrf 'PROD'

# So accessing local subnet will work for vrf default services
set protocols static route 192.168.1.0/24 interface eth1 vrf 'PROD'

However for services in VRF default to be able to reach the local ip located at eth1 in VRF PROD you also need to add:

sudo ip route replace local 192.168.1.20/32 dev eth1 table main

The above is using the local route-type which according to manpages for ip route is described as:

local - the destinations are assigned to this host. The packets are looped back and delivered locally.

The above manual fix shows up in the routing table like local 192.168.1.20 dev eth1 scope host:

# ip route show table all | grep -i 192.168.1
default nhid 22 via 192.168.1.254 dev eth1 table PROD proto static metric 20 
192.168.1.0/24 dev eth1 table PROD proto kernel scope link src 192.168.1.20 
local 192.168.1.20 dev eth1 table PROD proto kernel scope host src 192.168.1.20 
broadcast 192.168.1.255 dev eth1 table PROD proto kernel scope link src 192.168.1.20 
default nhid 22 via 192.168.1.254 dev eth1 proto static metric 20 
192.168.1.0/24 nhid 12 dev eth1 proto static metric 20 
local 192.168.1.20 dev eth1 scope host

Currently there doesnt seem to be a way to use only vyos config to add this.

None of this works:

set protocols static route 192.168.1.20/32 interface eth1

or

set protocols static route 192.168.1.20/32 interface eth1 vrf 'default'

As in current workaround is forcing the admin to use postconfig or posthook scripting which I prefer to avoid.

Additional information

Manpage of ip route:

https://manpages.debian.org/trixie/iproute2/ip-route.8.en.html#DESCRIPTION

Details

Version
Stream 2026.03
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Feature (new functionality)
Forum thread
https://forum.vyos.io/t/vrf-leaking-and-access-to-local-ip/17764