I have solved the issue using a pair of virtual ethernet interfaces to connect the two vrf.
Here is the config:
interfaces {
ethernet eth0 {
address dhcp
}
ethernet eth2 {
address 10.0.0.1/24
vrf pippo
}
virtual-ethernet veth0 {
address 10.1.1.0/31
peer-name veth2
}
virtual-ethernet veth2 {
address 10.1.1.1/31
peer-name veth0
vrf pippo
}
}
vrf {
name pippo {
protocols {
static {
route 0.0.0.0/0 {
next-hop 10.1.1.0 {
interface veth2
}
}
}
}
table 1000
}
}
vth0
resides in the default vrf, while its peer, vth2
resides in the pippo
vrf.
Then vth2
is used in the pippo
vrf to define the default root.
Here are the routing tables:
VRF default:
S>* 0.0.0.0/0 [210/0] via 192.168.154.2, eth0, weight 1, 00:40:35
C>* 10.1.1.0/31 is directly connected, veth0, 00:15:54
C>* 192.168.154.0/24 is directly connected, eth0, 00:40:35
VRF pippo:
S>* 0.0.0.0/0 [1/0] via 10.1.1.0, veth2, weight 1, 00:09:15
C>* 10.0.0.0/24 is directly connected, eth2, 00:44:58
C>* 10.1.1.0/31 is directly connected, veth2, 00:15:54