I’m trying to port a junos config to vyos. The junos config uses 3 routing instances to ecapsulate 3 Internet/ISP connections and some associated ipsec tunnels. Static routes are used in the default vrf to route traffic to the other vrf’s via the junos “next-table” vs the typical next-hop. Is there a way to accomplish this in vyos?
@I-n-d-y thanks for the links. I actually saw those. However, there isn’t anything there about a simple static route from the default vrf to another vrf. I’m also a little confused about static routes in general. If I add a static route without specifying a vrf, I would expect it to show up when I do a “show ip route”. However, it does not. I can’t get it to show up with any of the “show ip route” variations. I’m a total vyos newbie, so I may have missed something.
Regarding the example in the docs a static route from the default vrf to another vrf should be configured like this:
set protocols static route 10.20.0.0/24 interface eth2 vrf 'blue'
set protocols static route 10.30.0.0/24 interface br10 vrf 'red'
show ip route
A static route from another vrf to the default vrf is done like this:
set vrf name blue protocols static route 10.0.0.0/24 interface eth1 vrf 'default'
set vrf name red protocols static route 10.0.0.0/24 interface eth1 vrf 'default'
show ip route vrf red
Is this what you are looking for? Unfortunately, I don’t have any VRF in my own configuration yet so I have no real examples.
Thanks again for the info. I have tried this, but it doesn’t work. However, I have a nat rule configured in the vrf. Perhaps that doesn’t work. I’m still trying to figure out if nat should work in this case.
what version are you using ? we’ve solved a old known issues related nat+route leaking with vrf . this configuration i’ve tested and it works :
set interfaces ethernet eth0 address '172.16.50.12/24'
set interfaces ethernet eth0 description 'RED'
set interfaces ethernet eth0 vrf 'RED'
set interfaces ethernet eth1 address '192.168.130.100/24'
set interfaces ethernet eth1 description 'BLUE'
set interfaces ethernet eth1 vrf 'BLUE'
set nat destination rule 110 description 'NAT ssh- INSIDE'
set nat destination rule 110 destination port '2022'
set nat destination rule 110 inbound-interface 'eth0'
set nat destination rule 110 protocol 'tcp'
set nat destination rule 110 translation address '192.168.130.40'
set nat source rule 100 outbound-interface 'eth0'
set nat source rule 100 protocol 'all'
set nat source rule 100 source address '192.168.130.0/24'
set nat source rule 100 translation address 'masquerade'
set vrf bind-to-all
set vrf name BLUE protocols static route 0.0.0.0/0 next-hop 172.16.50.1 vrf 'RED'
set vrf name BLUE protocols static route 172.16.50.0/24 interface eth0 vrf 'RED'
set vrf name BLUE table '1010'
set vrf name RED protocols static route 0.0.0.0/0 next-hop 172.16.50.1
set vrf name RED protocols static route 192.168.130.0/24 interface eth1 vrf 'BLUE'
set vrf name RED table '2020'
here is the reference the case , you must upgrade the latest 1.5 where we have this fix. ⚓ T3655 NAT Problem with VRF
set protocols static route z.z.z.0/29 interface eth5 vrf 'default
remove the nat , when you do the test to check it , it’s need use a host behind eth5 with a host eth1 ,don’t use vyos itself. So , if without nat doesn’t work , it’s possible you have another problem.