vpp + frrouting
在frr中查看vrf
给host-ns1_tap配个ip
DBGvpp# set interface ip address host-ns1_tap 192.168.1.230/24 set interface ip address: failed to add 192.168.1.230/24 on host-ns1_tap which conflicts with 192.168.1.229/24 for interface UnknownEthernet5/0/0
报错了先给vpp添加个vrf,再把host-ns1_tap 添加进vrf和给host-ns1_tap 配置ip
DBGvpp# ip table add 100 DBGvpp# set interface ip table host-ns1_tap 100 DBGvpp# set interface ip address host-ns1_tap 192.168.1.230/24 DBGvpp#
DBGvpp# show int addr UnknownEthernet5/0/0 (up): L3 192.168.1.229/24 host-ns1_tap (up): L3 192.168.1.230/24 ip4 table-id 100 fib-idx 1 local0 (dn): vxlan_tunnel0 (up): DBGvpp#
show ip route vrf ns1还是什么都没有
ip netns exec ns1 ip a add 192.168.1.231/24 dev veth0 配个ip
localhost.localdomain# show ip route vrf ns1 Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP, T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP, F - PBR, f - OpenFabric, > - selected route, * - FIB route, q - queued route, r - rejected route VRF ns1: C>* 192.168.1.0/24 is directly connected, veth0, 00:00:07
localhost.localdomain# show ip route vrf ns1 Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP, T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP, F - PBR, f - OpenFabric, > - selected route, * - FIB route, q - queued route, r - rejected route VRF ns1: C>* 192.168.1.0/24 is directly connected, veth0, 00:00:07 有路由了
localhost.localdomain# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
K>* 0.0.0.0/0 [0/0] via 10.10.16.254, enp125s0f0, 00:17:00
C>* 10.10.16.0/24 is directly connected, enp125s0f0, 00:17:00
localhost.localdomain#
host上路由
[root@localhost bin]# ip r show default via 10.10.16.254 dev enp125s0f0 10.10.16.0/24 dev enp125s0f0 proto kernel scope link src 10.10.16.229 [root@localhost bin]#
DBGvpp# show ip fib ipv4-VRF:0, fib_index:0, flow hash:[src dst sport dport proto ] epoch:0 flags:none locks:[default-route:1, nat-hi:2, ] 0.0.0.0/0 unicast-ip4-chain [@0]: dpo-load-balance: [proto:ip4 index:1 buckets:1 uRPF:0 to:[0:0]] [0] [@0]: dpo-drop ip4 0.0.0.0/32 unicast-ip4-chain [@0]: dpo-load-balance: [proto:ip4 index:2 buckets:1 uRPF:1 to:[0:0]] [0] [@0]: dpo-drop ip4 192.168.1.0/32 unicast-ip4-chain [@0]: dpo-load-balance: [proto:ip4 index:10 buckets:1 uRPF:9 to:[0:0]] [0] [@0]: dpo-drop ip4 192.168.1.0/24 unicast-ip4-chain [@0]: dpo-load-balance: [proto:ip4 index:9 buckets:1 uRPF:8 to:[0:0]] [0] [@4]: ipv4-glean: host-ns1_tap: mtu:9000 ffffffffffff02fe2aefec4f0806 192.168.1.230/32 unicast-ip4-chain [@0]: dpo-load-balance: [proto:ip4 index:12 buckets:1 uRPF:13 to:[0:0]] [0] [@2]: dpo-receive: 192.168.1.230 on host-ns1_tap 192.168.1.255/32 unicast-ip4-chain [@0]: dpo-load-balance: [proto:ip4 index:11 buckets:1 uRPF:11 to:[0:0]] [0] [@0]: dpo-drop ip4 224.0.0.0/4 unicast-ip4-chain [@0]: dpo-load-balance: [proto:ip4 index:4 buckets:1 uRPF:3 to:[0:0]] [0] [@0]: dpo-drop ip4
ipv4-VRF:0, fib_index:0, flow hash:[src dst sport dport proto ] epoch:0 flags:none locks:[default-route:1, nat-hi:2, ] Prefix length Count 0 1 4 2 24 1 32 5 ipv4-VRF:100, fib_index:1, flow hash:[src dst sport dport proto ] epoch:0 flags:none locks:[CLI:1, ] Prefix length Count 0 1 4 2 32 2 DBGvpp#
DBGvpp# set int ip address del host-ns1_tap 192.168.1.230/24
DBGvpp#
show ip fib [summary] [table <table-id>] [index <fib-id>] [<ip4-addr>[/<mask>]] [mtrie] [detail]
DBGvpp# show ip fib summary table 100
ipv4-VRF:100, fib_index:1, flow hash:[src dst sport dport proto ] epoch:0 flags:none locks:[CLI:1, ]
Prefix length Count
0 1
4 2
32 2
DBGvpp# set int ip address del host-ns1_tap 192.168.1.230/24
DBGvpp# set interface ip table host-ns1_tap 0
DBGvpp# set int ip address host-ns1_tap 192.168.1.230/24
DBGvpp#