vrf

VRFf简介:

VRF相当于一个个独立路由表,STATIC是路由表里的一个(条目)策略添加vrf相当于隔离建立多个独立的路由器

一,创建 vrf

1.vpp# ip table 100     //创建ipv4 vrf 100
2.vpp# ip6 table 200   //创建ipv6 vrf 200
3.vpp# show ip fib    //查看IPv4
4.vpp# show ip6 fib  //查看IPv6 
5.vpp# show ip6 fib table 

//IPv6的格式

#etcdctl put /vnf-agent/vpp1/config/vpp/v2/vrf-table/id/1/protocol/IPV6 '{"id":1,"protocol":1,"label":"ip6 table 1"}'

//IPv4的格式

#etcdctl put /vnf-agent/vpp1/config/vpp/v2/vrf-table/id/1/protocol/IPV4 '{"id":1,"protocol":0,"label":"ip4 table 1"}'

二,将端口绑定到指定的vrf上

//默认IP4

vpp# set int ip table G7 100  //将 G7 放入vrf100中,再对其添加路由,前提是G7 没配IP

//IP6

vpp# set int ip6 table G6 200 //将 G6 放入vrf200中,再对其添加路由,前提是G6 没配IP

#etcdctl put /vnf-agent/00000016/config/vpp/v2/interfaces/G5 '{"name":"G5","type":"DPDK","enabled":true,"vrf":100}'

三,下发(非指定接口的)路由

#etcdctl put /vnf-agent/00000016/config/vpp/v2/route/vrf/0/dst/0.0.0.0/0/gw/192.168.100.254 '{"type":"INTRA_VRF","dst_network":"0.0.0.0/0","next_hop_addr":"192.168.100.254",weight":6}'

四,下发指定接口的路由

#etcdctl put /vnf-agent/00000016/config/vpp/v2/route/if/G3/vrf/0/dst/10.1.1.3/32/gw/192.168.1.13 '{"type":"INTRA_VRF","dst_network":"10.1.1.3/32","next_hop_addr":"192.168.1.13","outgoing_interface":"G3","weight":6}'

五,下发到子接口上

#etcdctl put /vnf-agent/00000016/config/vpp/v2/route/if/G4.100/vrf/0/dst/10.11.12.13/32/gw/192.168.111.111 '{"type":"INTRA_VRF","dst_network":"10.11.12.13/32","next_hop_addr":"192.168.111.111","outgoing_interface":"G4.100","weight":6}'

//有时间补上 ~~~ 下班了

你可能感兴趣的:(vrf)