Manual:Internet access from VRF

From MikroTik Wiki
(Redirected from Internet access from VRF)
Jump to navigation Jump to search

Description

Packages required: routing-test, mpls-test, RouterOS version 3.23+


There are multiple ways how Internet access could be provided to VRF clients. They are outlined in RFC 4364 section 11, for example.

Here we show the way how to configure access using global routing table.

Example

L3vpn-internet.png

Default routes

Add default routes to VRF routing tables on PE:

 /ip route add routing-mark=cust-one gateway=10.0.0.1@main
 /ip route add routing-mark=cust-two gateway=10.0.0.1@main

Note that we must explicitly specify that the gateway should be resolved in the @main routing table, otherwise the routes will not become active.

Routes to client's networks

Routes to client's networks should be added in the main routing table, while their nexthops should be reachable via client's VRF interfaces, and as such belong to the VRF tables.

On the other hand, there is no way how to explicitly specify that gateway must be resolved in any other table, except the main table. So instead we specify the interface (which is in a VRF) and nexthop gateway address (which must be directly reachable on that interface). For point-to-point interfaces even the gateway address is not required.

Add these routes to PE's route table and redistribute them via OSPF:

 /ip route add dst-address=10.7.7.0/24 gateway=10.3.3.4%ether2
 /ip route add dst-address=10.8.8.0/24 gateway=10.4.4.5%ether3

And this is how should look in print:

 [admin@PE2] > /ip route print detail where !routing-mark
  ...
  5 A S  dst-address=10.7.7.0/24 gateway=10.3.3.4 on cust-one reachable ether2 
     distance=1 scope=30 target-scope=10
   
  6 A S  dst-address=10.8.8.0/24 gateway=10.4.4.5 on cust-two reachable ether3 
      distance=1 scope=30 target-scope=10