Test eBGP 4-Byte ASN Peering, OSPF & BFD Without Router VMs
Spinning up a 16 GB Containerlab or GNS3 topology with vendor router images just to verify a Control Plane Policing (CoPP) ACL, a BGP route-collector parser, or a BFD UDP 3784 timer filter eats half an afternoon.
The Catch
Router control planes are picky: eBGP expects a valid 3-way TCP 179 handshake at TTL 1 and CS6 (DSCP 48), 4-byte ASNs above 65535 require RFC 6793 AS_TRANS (23456) plus Capability 65 inside the BGP OPEN message, and BFD control packets get dropped immediately unless Hop Limit / TTL equals 255.
Hand-coding 16-byte 0xff BGP markers, variable-length NLRI prefix tuples, and OSPF multicast MACs (01:00:5e:00:00:05) in raw hex is error-prone. FrameAssembly computes every marker, capability length, and multicast destination MAC automatically.
Edge Peering Turn-Up & CoPP Audit (AS 4200000001 <-> ISP AS 64512 + OSPF + BFD)
Twelve CS6-marked (dscp 48) control-plane packets exercise your entire routing ACL and telemetry parser: (1) a stateful TCP 179 handshake followed by 4-byte ASN bgp open, bidirectional keepalive, and an NLRI update advertising 203.0.113.0/24; (2) an OSPFv2 multicast hello to 224.0.0.5 answered by unicast lsack; and (3) a sub-second bfd state 3 (Up) session on UDP 3784 at ttl 255.
Adapt It for Your Network
- Set dc_border and isp_edge to your peering link
/30or/31addresses and replace asn 4200000001 / prefix with your own ASN and subnet. - Keep ttl 1 on eBGP (or change to ttl 2..255 for eBGP multihop checks) and ttl 255 on single-hop BFD.
- Run frameassembly bgp_ospf_bfd_lab.frasm, inspect Capability 65 and NLRI in tshark, or replay against your router CoPP test port.
.frasm -> .pcap
Preview frames inline or open in Playground ->Emits 12 CS6-marked routing frames covering stateful eBGP 4-byte ASN peering + NLRI UPDATE, multicast OSPFv2 Hello/LSAck, and TTL-255 BFD Up.
host dc_border { ip 198.51.100.1 mac 00:1c:73:b0:00:01 }
host isp_edge { ip 198.51.100.2 mac 00:1c:73:b0:00:02 }
host ospf_all { ip 224.0.0.5 }
flow ebgp_peering_and_nlri(local_rtr, peer_rtr) {
// 1. Stateful TCP 179 handshake + 4-byte ASN eBGP OPEN, KEEPALIVE, and NLRI UPDATE
local_rtr -> peer_rtr dscp 48 ttl 1 tcp syn srcport 51179 dstport 179 win 65535 mss 1460 wait 1ms
local_rtr <- peer_rtr dscp 48 ttl 1 tcp syn ack win 65535 mss 1460 wait 1ms
local_rtr -> peer_rtr dscp 48 ttl 1 tcp ack wait 1ms
local_rtr -> peer_rtr dscp 48 ttl 1 bgp open asn 4200000001 holdtime 90 bgpid 198.51.100.1 wait 2ms
local_rtr <- peer_rtr dscp 48 ttl 1 bgp open asn 64512 holdtime 90 bgpid 198.51.100.2 wait 2ms
local_rtr -> peer_rtr dscp 48 ttl 1 bgp keepalive wait 1ms
local_rtr <- peer_rtr dscp 48 ttl 1 bgp keepalive wait 2ms
local_rtr -> peer_rtr dscp 48 ttl 1 bgp update asn 4200000001 prefix "203.0.113.0/24" nexthop 198.51.100.1 wait 5ms
}
flow igp_and_bfd_liveness(local_rtr, peer_rtr, mcast_ospf) {
// 2. OSPFv2 multicast Hello (224.0.0.5 -> 01:00:5e:00:00:05) + unicast LSAck
local_rtr -> mcast_ospf dscp 48 ttl 1 ospf hello routerid 198.51.100.1 areaid 0.0.0.0 hellointerval 10 deadinterval 40 priority 100 wait 2ms
local_rtr <- peer_rtr dscp 48 ttl 1 ospf lsack routerid 198.51.100.2 areaid 0.0.0.0 wait 2ms
// 3. Sub-second BFD Control Up session (state 3, TTL 255) on UDP 3784
local_rtr -> peer_rtr dscp 48 ttl 255 bfd state 3 diag 0 mydisc 0x1001 yourdisc 0x2002 mintx 50000 minrx 50000 mult 3 wait 2ms
local_rtr <- peer_rtr dscp 48 ttl 255 bfd state 3 diag 0 mydisc 0x2002 yourdisc 0x1001 mintx 50000 minrx 50000 mult 3 wait 2ms
}
compile {
ebgp_peering_and_nlri(dc_border, isp_edge)
igp_and_bfd_liveness(dc_border, isp_edge, ospf_all)
}# 1. Preview the 12-packet eBGP + OSPF + BFD control-plane timeline
frameassembly show bgp_ospf_bfd_lab.frasm
# 2. Compile to .pcap and inspect BGP 4-byte ASN, OSPF Area 0, and BFD state in tshark
frameassembly bgp_ospf_bfd_lab.frasm bgp_ospf_bfd_lab.pcap
tshark -r bgp_ospf_bfd_lab.pcap -Y "bgp || ospf || bfd"
# 3. Replay against a router CoPP interface or feed into Zeek /pmacct
sudo tcpreplay -i eth0 bgp_ospf_bfd_lab.pcapKeep bgp_ospf_bfd_lab.frasm in Git and build .pcap in under 1ms
Single rootless binary + VS Code extension with live squiggles, quick-fixes, and side-by-side packet ladders ready for Wireshark.
Related Examples
All 81 Protocols ->Reproduce TCP Retransmissions, Out-of-Order & Zero-Window Stalls
tcp
Stamp 802.1Q VLAN, Double-Tagged QinQ & MPLS Without an IXIA Rack
vlan · rtp · qinq · mpls
Debug VXLAN, Geneve, WireGuard & IPsec Tunnel MTU Black Holes Offline
vxlan · geneve · udp · icmp