FRRoute 路由信息采集 + MPLS VPN隧道信息采集与识别

FRRoute

数据库-表

routeinfo
id				next_hop	eth_ip		metric
10.1.1.1	10.1.1.10	10.1.1.9	
10.1.1.1	10.1.1.2	10.1.1.1	
10.1.1.1	192.1.1.0	24	
10.1.1.2	10.1.1.1	10.1.1.2	
10.1.1.2	10.1.1.14	10.1.1.13	
10.1.1.2	192.1.6.0	24	
10.1.1.5	10.1.1.6	10.1.1.5	
10.1.1.5	10.1.1.9	10.1.1.10	
10.1.1.5	192.1.5.0	24	
10.1.1.6	10.1.1.13	10.1.1.14	
10.1.1.6	10.1.1.5	10.1.1.6	
10.1.1.6	192.1.7.0	24	

mplsneighbor
RouterIp	next_hop	isPE

在这里插入图片描述

在这里插入图片描述

路由信息采集

命令输出字段 -> 映射到 -> 数据库字段

  1. FRR采集命令:
    • show int br 命令采集
      • 一个路由的每个【接口 Interface】 对应的
      • 【ip 地址 Addresses】,作为【接口ip eth_ip】。
    • route-n 采集
      • 各接口对应的 【Gateway】,作为【下一跳 ip 地址 next_hop】。
    • show interfaces lo 采集
      • 路由器的 第一个【lo】的
      • 【环回接口 IP Address】,作为该路由器的【唯一标识 id】。
  2. 采集字段处理:
    • show int br 【Addresses】字段映射到 数据库 routeinfo【接口ip eth_ip】,
    • route-n 【Gateway】字段映射到 数据库 routeinfo 的【下一条ip地址 next_hop】,
    • show interfaces lo【IP Address 】字段映射到 数据库 routeinfo【唯一标识 id】。
  3. 数据存储:处理后的数据上传到mysql数据库。

数据结构 + 算法

map<>

show int br

PR# show int br
Interface       Status  VRF             Addresses
---------       ------  ---             ---------
eth0            up      default         10.1.1.254/24
eth1            up      default         10.1.2.254/24
lo              up      default         9.9.9.9/32

PE1# show int br
Interface       Status  VRF             Addresses
---------       ------  ---             ---------
CUSTA           up      CUSTA           
eth1            up      CUSTA           172.16.1.254/24
Interface       Status  VRF             Addresses
---------       ------  ---             ---------
CUSTB           up      CUSTB           
eth2            up      CUSTB           172.16.3.254/24
Interface       Status  VRF             Addresses
---------       ------  ---             ---------
eth0            up      default         10.1.1.2/24
lo              up      default         1.1.1.1/32

PE2# show int br
Interface       Status  VRF             Addresses
---------       ------  ---             ---------
CUSTA           up      CUSTA           
eth1            up      CUSTA           172.16.2.254/24
Interface       Status  VRF             Addresses
---------       ------  ---             ---------
CUSTB           up      CUSTB           
eth2            up      CUSTB           172.16.4.254/24
Interface       Status  VRF             Addresses
---------       ------  ---             ---------
eth0            up      default         10.1.2.2/24
lo              up      default         2.2.2.2/32


CE1# show int br
Interface       Status  VRF             Addresses
---------       ------  ---             ---------
eth0            up      default         172.16.1.2/24
lo              up      default         192.168.1.1/24

CE2# show int br
Interface       Status  VRF             Addresses
---------       ------  ---             ---------
eth0            up      default         172.16.2.2/24
lo              up      default         192.168.2.1/24

CE3# show int br
Interface       Status  VRF             Addresses
---------       ------  ---             ---------
eth0            up      default         172.16.3.2/24
lo              up      default         192.168.3.1/24

CE4# show int br
Interface       Status  VRF             Addresses
---------       ------  ---             ---------
eth0            up      default         172.16.4.2/24
lo              up      default         192.168.4.1/24
CE4# 

route -n

PR:
bash-5.0# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
1.1.1.1         10.1.1.2        255.255.255.255 UGH   20     0        0 eth0
2.2.2.2         10.1.2.2        255.255.255.255 UGH   20     0        0 eth1
10.1.1.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
10.1.2.0        0.0.0.0         255.255.255.0   U     0      0        0 eth1
PE1:
bash-5.0# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
2.2.2.2         10.1.1.254      255.255.255.255 UGH   20     0        0 eth0
9.9.9.9         10.1.1.254      255.255.255.255 UGH   20     0        0 eth0
10.1.1.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
10.1.2.0        10.1.1.254      255.255.255.0   UG    20     0        0 eth0
PE2:
bash-5.0# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
1.1.1.1         10.1.2.254      255.255.255.255 UGH   20     0        0 eth0
9.9.9.9         10.1.2.254      255.255.255.255 UGH   20     0        0 eth0
10.1.1.0        10.1.2.254      255.255.255.0   UG    20     0        0 eth0
10.1.2.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
CE1# exit
bash-5.0# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.16.1.254    0.0.0.0         UG    20     0        0 eth0
172.16.1.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
CE2# exit
bash-5.0# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.16.2.254    0.0.0.0         UG    20     0        0 eth0
172.16.2.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
CE3# exit
bash-5.0# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.16.3.254    0.0.0.0         UG    20     0        0 eth0
172.16.3.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
CE4# exit
bash-5.0# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.16.4.254    0.0.0.0         UG    20     0        0 eth0
172.16.4.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0

show interfaces lo

frr_router# show interfaces lo
Interface  IP Address                   Status          Protocol    MTU
lo         192.168.1.1/32               up              up          65536
lo:1       10.0.0.1/32                  up              up          65536
lo:2       172.16.1.1/32                up              up          65536

MPLS VPN隧道信息采集与识别

step 1 : 采集mpls邻居表

step 2 : MPLS 隧道识别

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值