VPP中VRF租户路由域的命令使用

1、创建删除vrf表 

vpp# ip table ?
ip table                                 ip table [add|del] <table-id>
vpp# ip6 table ?
ip6 table                                ip6 table [add|del] <table-id>

2、端口绑定及查看端口绑定情况

1)绑定及解绑端口

ip6 table add 100   //ip6接口VRF表100
//将eth1网卡绑定到vrf100上面
set interface ip6 table eth1 100        //当作主干路由出口,将该端口绑定到主vrf 0

重点:ip参数是设置ipv4的vrf,ip6参数是设置ipv6的vrf,两种ip形式分别拥有默认ID为0的vrf,并相互不重叠;需要在端口绑定完VRF之后,再设置IP地址;若要删除某端口绑定vrf,需要提前删除其ip,否则报错IP addresses are still present on XXX;

vpp# create tap id 9
vpp# set int ip address tap9 10.10.10.1/24
vpp# set int ip address del tap9 10.10.10.1/24
vpp# set int ip table tap9 0

2)查看端口绑定vrf情况

vpp# set int ip address tap9 10.10.10.1/24
vpp# set int ip address tap10 10.10.1.1/24
vpp# show int addr
local0 (dn):
tap10 (up):
  L3 10.10.1.1/24 ip4 table-id 100 fib-idx 1
tap9 (up):
  L3 10.10.10.1/24 ip4 table-id 100 fib-idx 1

以上命令,可以确认,tap9和tap10接口绑定到vrf100上面。

3.显示VRF

显示指定vrf表或所有表

vpp# show ip fib ?
  show ip fib                              show ip fib [summary] [table <table-id>] [index <fib-id>] [<ip4-addr>[/<mask>]] [mtrie] [detail]

vpp#show ip fib table 100
ipv4-VRF:100, fib_index:1, flow hash:[src dst sport dport proto ] locks:[src:CLI:3, ]
0.0.0.0/0
  unicast-ip4-chain
  [@0]: dpo-load-balance: [proto:ip4 index:9 buckets:1 uRPF:7 to:[0:0]]
    [0] [@0]: dpo-drop ip4
0.0.0.0/32
  unicast-ip4-chain
  [@0]: dpo-load-balance: [proto:ip4 index:10 buckets:1 uRPF:8 to:[0:0]]
    [0] [@0]: dpo-drop ip4
224.0.0.0/4
  unicast-ip4-chain
  [@0]: dpo-load-balance: [proto:ip4 index:12 buckets:1 uRPF:10 to:[0:0]]
    [0] [@0]: dpo-drop ip4
240.0.0.0/4
  unicast-ip4-chain
  [@0]: dpo-load-balance: [proto:ip4 index:11 buckets:1 uRPF:9 to:[0:0]]
    [0] [@0]: dpo-drop ip4
255.255.255.255/32
  unicast-ip4-chain
  [@0]: dpo-load-balance: [proto:ip4 index:13 buckets:1 uRPF:11 to:[0:0]]
    [0] [@0]: dpo-drop ip4

显示所有vrf总览

vpp# show ip fib summary
ipv4-VRF:0, fib_index:0, flow hash:[src dst sport dport proto ] locks:[src:plugin-hi:2, src:default-route:1, ]
    Prefix length         Count
                   0               1
                   4               2
                  32               2
ipv4-VRF:100, fib_index:1, flow hash:[src dst sport dport proto ] locks:[src:CLI:3, ]
    Prefix length         Count
                   0               1
                   4               2
                  32               2

发表评论

邮箱地址不会被公开。 必填项已用*标注