wireshark 数据包捕获 BGP
wireshark 抓包 BGP
wireshark 本地抓包 BGP 数据,便于进一步学习和使用 BGP 协议。
BGP FSM 图片来自于文档 在FB闯祸的BGP协议简介 :
本地启动 BGP route server 和 route client
本地安装 gobgp cli 和 gobgp daemon:
go install github.com/osrg/gobgp/v3/cmd/gobgp@v3.15.0
go install github.com/osrg/gobgp/v3/cmd/gobgpd@v3.15.0
启动 route server 的配置文件 route-server-conf.conf :
[global.config]
as = 64512
router-id = "1.1.1.1"
port = 1790
local-address-list = ["127.0.0.1"]
[[neighbors]]
[neighbors.config]
neighbor-address = "127.0.0.1"
peer-as = 65001
[neighbors.transport.config]
remote-port = 1791
passive-mode = true
[neighbors.route-server.config]
route-server-client = true
并命令启动 route server:
gobgpd -f ./route-server-conf.conf -l debug --api-hosts ":50052" --pprof-disable
启动 route client 的配置文件 route-client-conf.conf:
[global.config]
as = 65001
router-id = "2.2.2.2"
port = 1791
local-address-list = ["127.0.0.1"]
[[neighbors]]
[neighbors.config]
neighbor-address = "127.0.0.1"
peer-as = 64512
[neighbors.transport.config]
remote-port = 1790
gobgpd -f ./route-client-conf.conf -l debug --api-hosts ":50053" --pprof-disable
这样就创建了 route server 和 route client 两个进程,以 BGP 协议通信。route server 监听在 1790 端口。
route client 会按照 BGP 协议,依次发送 OPEN Message、KEEPALIVE Message 报文和 route server 通信,使得两个进程的状态机 BGP FSM 达到 ESTABLISHED 状态。
wireshark 抓包
由于 route server 监听在本地 1790 端口,选择抓包 Loopback:lo0 网卡。
配置 wireshark: 在 View -> Filter Toolbar 中输入 bgp 回车,然后 Analyze -> Decode As -> 加上 tcp port 1790(因为 route server tcp.port==1790), Current 选择 BGP。
然后断掉 route client 进程并重启,会发现 route client 和 route server 发送的 OPEN Message、KEEPALIVE Message 报文具体信息:
然后 route client 来宣告路由:
gobgp -p 50053 -d global rib add -a ipv4 100.0.0.0/24 nexthop 20.20.20.2
可以通过如下命令查看 route server 收到的路由宣告:
gobgp neighbor -p 50052 -d 127.0.0.1 adj-in
然后查看 wireshark 中的 UPDATE Message 报文具体信息:
参考文献
在FB闯祸的BGP协议简介
推荐阅读
-
wireshark 数据包捕获 BGP
-
GRE 原理、配置和捕获数据包分析
-
基于 H.264 的 RTP 分组和数据包捕获分析中的组合数据包和分割数据包结构介绍
-
wireshark 数据包捕获数据分析中的 TSval TSecr 字段分析
-
Aiki 网络控制和数据包捕获测试技术实践
-
I.常见协议的 WireShark 数据包捕获和分析 "建议加入书签"。
-
WireShark - IP 协议数据包分析(Ping 分析 IP 协议数据包)
-
Wireshark 的数据包捕获和分析功能,看这个就够了!
-
利用数据包捕获工具 Wireshark 分析物联网设备网络行为
-
如何在 python 中使用 libpcap 库进行数据包捕获和数据处理。