BGP 自动发现的邻居
了解 BGP 自动发现的邻居
SUMMARY 使用 BGP 自动发现的邻居 按接口(而不是指定远程或本地邻居 IP 地址)配置 BGP 对等互连。
要在路由器之间建立 BGP 会话, 必须 按地址显式配置 BGP 组和对等方。 BGP 对等会话要求您 识别 TCP 通信终结点的源和目标 IP 地址。因此,显式配置这些地址是网络横向扩展的障碍,也是配置错误的机会。
为了简化 您的 BGP 配置,我们不再需要从 BGP 配置每个对等方地址。使用 BGP 自动发现的邻居 按接口(而不是指定远程或本地邻居 IP 地址)配置 BGP 对等互连。这包括使用隐式或协议机制来发现要在 TCP 对等会话中使用的 IP 地址。
必须显式配置对等行为和地址用法,以避免基于接口地址更改对等互连 由于配置或地址有效性而发生更改(例如,IPv6 重复地址检测 (DAD))。
BGP 根据配置确定要对等的地址族。对等会话根据确定的系列的接口地址的可用性而启动。使用 IPv6 邻居发现 (RFC4861) 发现对等链路本地地址,并创建朝向该邻居的 BGP 会话。即使 IPv6 接口未配置地址,也会生成链路本地地址。
必须启用 IPv6 邻居发现才能使用此功能。
BGP 自动发现邻居的优势
-
简化 IGP 部署到单跳 外部 BGP (EBGP) 的过程
-
按接口和接口范围(而不是按 IP 地址)配置邻居
-
使用动态邻居组最大限度地减少两端的配置
示例:配置 BGP 自动发现的邻居
SUMMARY 此示例说明如何配置 BGP 自动发现的邻居。
概述
从 Junos OS 21.1R1 版开始,我们支持 BGP 使用 IPv6 邻居发现协议 (ND) 自动发现的邻居。此功能允许 BGP 使用直接连接的邻居路由器的链路本地 IPv6 地址创建对等邻居会话。无需指定远程或本地邻居 IP 地址。
拓扑学
下图显示了一个简化的示例拓扑。
要求
此示例使用以下硬件和软件组件:
MX 系列路由器
Junos OS 21.1R1 或更高版本
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改任何必要的详细信息以匹配您的网络配置,然后将命令复制并粘贴到 [edit] 层次结构级别的 CLI 中。
VM1
set interfaces interface-range tor-to-leaf member ge-0/0/4 set interfaces interface-range tor-to-leaf unit 0 family inet6 set interfaces ge-0/0/4 unit 0 family inet address 192.168.1.1/24 set interfaces lo0 unit 0 family inet address 192.168.30.1/32 set interfaces lo0 unit 0 family inet6 address 2001:db8:70::1/128 set policy-options policy-statement DIRECT-RTS from protocol direct set policy-options policy-statement DIRECT-RTS then accept set policy-options policy-statement lb then load-balance per-packet set policy-options as-list a-list members 1-65535 set routing-options autonomous-system 64500 set routing-options forwarding-table export lb set routing-options forwarding-table ecmp-fast-reroute set protocols router-advertisement interface tor-to-leaf set protocols bgp group autodisc family inet unicast extended-nexthop set protocols bgp group autodisc family inet6 unicast set protocols bgp group autodisc export DIRECT-RTS set protocols bgp group autodisc multipath multiple-as set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery family inet6 ipv6-nd set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery interface tor-to-leaf set protocols bgp group autodisc peer-as-list a-list set protocols bgp group to-leaf-v4 family inet unicast extended-nexthop set protocols bgp group to-leaf-v4 export DIRECT-RTS set protocols bgp group to-leaf-v4 local-as 64500 set protocols bgp group to-leaf-v4 neighbor 192.168.1.2 peer-as 64496
VM2
set interfaces interface-range tor-to-leaf member ge-0/0/4 set interfaces interface-range tor-to-leaf unit 0 family inet6 set interfaces ge-0/0/4 unit 0 family inet address 192.168.2.1/24 set interfaces lo0 unit 0 family inet address 192.168.30.2/32 set interfaces lo0 unit 0 family inet6 address 2001:db8:60::1/128 set policy-options policy-statement DIRECT-RTS from protocol direct set policy-options policy-statement DIRECT-RTS then accept set policy-options policy-statement lb then load-balance per-packet set policy-options as-list a-list members 1-65535 set routing-options autonomous-system 64501 set routing-options forwarding-table export lb set routing-options forwarding-table ecmp-fast-reroute set protocols router-advertisement interface tor-to-leaf set protocols bgp group autodisc family inet unicast extended-nexthop set protocols bgp group autodisc family inet6 unicast set protocols bgp group autodisc export DIRECT-RTS set protocols bgp group autodisc multipath multiple-as set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery family inet6 ipv6-nd set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery interface tor-to-leaf set protocols bgp group autodisc peer-as-list a-list set protocols bgp group to-leaf-v4 family inet unicast extended-nexthop set protocols bgp group to-leaf-v4 export DIRECT-RTS set protocols bgp group to-leaf-v4 local-as 64501 set protocols bgp group to-leaf-v4 neighbor 192.168.2.2 peer-as 64497
枝叶 1
set interfaces interface-range to-spine member "ge-0/0/[0-4]" set interfaces interface-range to-spine unit 0 family inet set interfaces interface-range to-spine unit 0 family inet6 set interfaces ge-0/0/4 unit 0 family inet address 192.168.1.2/24 set interfaces lo0 unit 0 family inet address 192.168.10.1/32 set interfaces lo0 unit 0 family inet6 address 2001:db8:90::1/128 set policy-options policy-statement DIRECT-RTS from protocol direct set policy-options policy-statement DIRECT-RTS then accept set policy-options policy-statement lb then load-balance per-packet set policy-options as-list a-list members 1-65535 set routing-options autonomous-system 64496 set routing-options forwarding-table export lb set routing-options forwarding-table ecmp-fast-reroute set protocols router-advertisement interface to-spine max-advertisement-interval 9 set protocols router-advertisement interface to-spine min-advertisement-interval 3 set protocols bgp group autodisc family inet unicast extended-nexthop set protocols bgp group autodisc family inet6 unicast set protocols bgp group autodisc export DIRECT-RTS set protocols bgp group autodisc multipath multiple-as set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery family inet6 ipv6-nd set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery interface to-spine set protocols bgp group autodisc peer-as-list a-list set protocols bgp group to-crpd-v4 family inet unicast extended-nexthop set protocols bgp group to-crpd-v4 export DIRECT-RTS set protocols bgp group to-crpd-v4 neighbor 192.168.1.1 peer-as 64500
枝叶 2
set interfaces interface-range to-spine member "ge-0/0/[0-4]" set interfaces interface-range to-spine unit 0 family inet set interfaces interface-range to-spine unit 0 family inet6 set interfaces ge-0/0/4 unit 0 family inet address 192.168.2.2/24 set interfaces lo0 unit 0 family inet address 192.168.10.2/32 set interfaces lo0 unit 0 family inet6 address 2001:db8:90::2/128 set policy-options policy-statement DIRECT-RTS from protocol direct set policy-options policy-statement DIRECT-RTS then accept set policy-options policy-statement lb then load-balance per-packet set policy-options as-list a-list members 1-65535 set routing-options autonomous-system 64497 set routing-options forwarding-table export lb set routing-options forwarding-table ecmp-fast-reroute set protocols router-advertisement interface to-spine max-advertisement-interval 9 set protocols router-advertisement interface to-spine min-advertisement-interval 3 set protocols bgp group autodisc family inet unicast extended-nexthop set protocols bgp group autodisc family inet6 unicast set protocols bgp group autodisc export DIRECT-RTS set protocols bgp group autodisc multipath multiple-as set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery family inet6 ipv6-nd set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery interface to-spine set protocols bgp group autodisc peer-as-list a-list set protocols bgp group to-crpd-v4 family inet unicast extended-nexthop set protocols bgp group to-crpd-v4 export DIRECT-RTS set protocols bgp group to-crpd-v4 neighbor 192.168.2.1 peer-as 64501
主干 1
set interfaces interface-range to-leaf member "ge-0/0/[0-3]" set interfaces interface-range to-leaf unit 0 family inet set interfaces interface-range to-leaf unit 0 family inet6 set interfaces lo0 unit 0 family inet address 192.168.20.1/32 set interfaces lo0 unit 0 family inet6 address 2001:db8:80::1/128 set policy-options policy-statement DIRECT-RTS from protocol direct set policy-options policy-statement DIRECT-RTS then accept set policy-options policy-statement lb then load-balance per-packet set policy-options as-list a-list members 1-65535 set routing-options autonomous-system 64498 set routing-options forwarding-table export lb set routing-options forwarding-table ecmp-fast-reroute set protocols router-advertisement interface to-leaf max-advertisement-interval 9 set protocols router-advertisement interface to-leaf min-advertisement-interval 3 set protocols bgp group autodisc family inet unicast extended-nexthop set protocols bgp group autodisc family inet6 unicast set protocols bgp group autodisc export DIRECT-RTS set protocols bgp group autodisc multipath multiple-as set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery family inet6 ipv6-nd set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery interface to-leaf set protocols bgp group autodisc peer-as-list a-list
主干 2
set interfaces interface-range to-leaf member "ge-0/0/[0-3]" set interfaces interface-range to-leaf unit 0 family inet set interfaces interface-range to-leaf unit 0 family inet6 set interfaces lo0 unit 0 family inet address 192.168.20.2/32 set interfaces lo0 unit 0 family inet6 address 2001:db8:80::2/128 set policy-options policy-statement DIRECT-RTS from protocol direct set policy-options policy-statement DIRECT-RTS then accept set policy-options policy-statement lb then load-balance per-packet set policy-options as-list a-list members 1-65535 set routing-options autonomous-system 64499 set routing-options forwarding-table export lb set routing-options forwarding-table ecmp-fast-reroute set protocols router-advertisement interface to-leaf max-advertisement-interval 9 set protocols router-advertisement interface to-leaf min-advertisement-interval 3 set protocols bgp group autodisc family inet unicast extended-nexthop set protocols bgp group autodisc family inet6 unicast set protocols bgp group autodisc export DIRECT-RTS set protocols bgp group autodisc multipath multiple-as set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery family inet6 ipv6-nd set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery interface to-leaf set protocols bgp group autodisc peer-as-list a-list
配置 VM1
要配置 BGP 自动发现的邻居,请在 VM1 上执行以下步骤:
-
配置设备接口。
user@VM1# set interfaces interface-range tor-to-leaf member ge-0/0/4 user@VM1# set interfaces interface-range tor-to-leaf unit 0 family inet6
-
创建环路接口并配置 IP 地址。
user@VM1# set interfaces lo0 unit 0 family inet address 192.168.30.1/32 user@VM1# set interfaces lo0 unit 0 family inet6 address 2001:db8:70::1/128
-
启用路由策略。
user@VM1# set policy-options policy-statement DIRECT-RTS from protocol direct user@VM1# set policy-options policy-statement DIRECT-RTS then accept user@VM1# set policy-options policy-statement lb then load-balance per-packet user@VM1# set policy-options as-list a-list members 1-65535
-
配置自治系统 (AS) 编号
user@VM1# set routing-options autonomous-system 64500
-
应用按数据包策略以启用流量和 ECMP 的负载平衡。
user@VM1# set routing-options forwarding-table export lb user@VM1# set routing-options forwarding-table ecmp-fast-reroute
-
配置 BGP 以建立内部和外部对等会话。
user@VM1# set protocols bgp group autodisc family inet unicast extended-nexthop user@VM1# set protocols bgp group autodisc family inet6 unicast user@VM1# set protocols bgp group autodisc export DIRECT-RTS user@VM1# set protocols bgp group autodisc multipath multiple-as user@VM1# set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery family inet6 ipv6-nd user@VM1# set protocols bgp group autodisc dynamic-neighbor ndp peer-auto-discovery interface tor-to-leaf user@VM1# set protocols bgp group autodisc peer-as-list a-list user@VM1# set protocols bgp group to-leaf-v4 family inet unicast extended-nexthop user@VM1# set protocols bgp group to-leaf-v4 export DIRECT-RTS user@VM1# set protocols bgp group to-leaf-v4 local-as 5 user@VM1# set protocols bgp group to-leaf-v4 neighbor 192.168.1.2 peer-as 1
-
如果完成设备配置,请提交配置。
user@VM1# commit
结果
在配置模式下,输入 show interfaces、show protocol、show policy-options 和 show routing-options 命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以便进行更正。
[edit] user@VM1# show interfaces interface-range tor-to-leaf { member ge-0/0/4; unit 0 { family inet6; } } ge-0/0/4 { unit 0 { family inet { address 192.168.1.1/24; } } } lo0 { unit 0 { family inet { address 192.168.30.1/32; } family inet6 { address 2001:db8:70::1/128; } } }
[edit] user@VM1# show protocols router-advertisement { interface tor-to-leaf; } bgp { group autodisc { family inet { unicast { extended-nexthop; } } family inet6 { unicast; } export DIRECT-RTS; multipath { multiple-as; } dynamic-neighbor ndp { peer-auto-discovery { family inet6 { ipv6-nd; } interface tor-to-leaf; } } peer-as-list a-list; } group to-leaf-v4 { family inet { unicast { extended-nexthop; } } export DIRECT-RTS; local-as 64500; neighbor 192.168.1.2 { peer-as 64496; } } }
[edit] user@VM1# show policy-options policy-statement DIRECT-RTS { from protocol direct; then accept; } policy-statement lb { then { load-balance per-packet; } } as-list a-list members 1-65535;
[edit] user@VM1# show policy-options policy-statement DIRECT-RTS { from protocol direct; then accept; } policy-statement lb { then { load-balance per-packet; } } as-list a-list members 1-65535; [
edit] user@VM1# show routing-options autonomous-system 64500; forwarding-table { export lb; ecmp-fast-reroute; }
验证
确认配置工作正常。
验证自动发现的邻居
目的
验证自动发现的 BGP 邻居。
操作
在操作模式下,运行 show bgp summary auto-discovered
命令
在叶子上1
user@Leaf1> show bgp summary auto-discovered Threading mode: BGP I/O Default eBGP mode: advertise - accept, receive - accept Groups: 2 Peers: 5 Down peers: 1 Auto-discovered peers: 4 Table Tot Paths Act Paths Suppressed History Damp State Pending inet.0 24 20 0 0 0 0 inet6.0 16 16 0 0 0 0 Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped... fe80::5668:a3ff:fe16:1049%ge-0/0/3.0 64499 194 195 0 1 1:25:18 Establ inet.0: 5/6/6/0 inet6.0: 4/4/4/0 fe80::5668:a3ff:fe16:104c%ge-0/0/4.0 64499 193 195 0 1 1:25:18 Establ inet.0: 5/6/6/0 inet6.0: 4/4/4/0 fe80::5668:a3ff:fe16:12c9%ge-0/0/1.0 64498 217 223 0 1 1:35:53 Establ inet.0: 5/6/6/0 inet6.0: 4/4/4/0 fe80::5668:a3ff:fe16:12ce%ge-0/0/2.0 64498 218 223 0 1 1:35:57 Establ inet.0: 5/6/6/0 inet6.0: 4/4/4/0
在主干1上
user@Spine1> show bgp summary auto-discovered Threading mode: BGP I/O Default eBGP mode: advertise - accept, receive - accept Groups: 1 Peers: 4 Down peers: 0 Auto-discovered peers: 4 Table Tot Paths Act Paths Suppressed History Damp State Pending inet.0 24 20 0 0 0 0 inet6.0 16 16 0 0 0 0 Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped... fe80::5668:a3ff:fe16:2e7%ge-0/0/0.0 64496 245 237 0 0 1:45:19 Establ inet.0: 5/6/6/0 inet6.0: 4/4/4/0 fe80::5668:a3ff:fe16:2f2%ge-0/0/1.0 64496 245 238 0 0 1:45:23 Establ inet.0: 5/6/6/0 inet6.0: 4/4/4/0 fe80::5668:a3ff:fe16:e49%ge-0/0/2.0 64497 245 243 0 0 1:45:19 Establ inet.0: 5/6/6/0 inet6.0: 4/4/4/0 fe80::5668:a3ff:fe16:e59%ge-0/0/3.0 64497 247 248 0 0 1:45:23 Establ inet.0: 5/6/6/0 inet6.0: 4/4/4/0
意义
输出显示自动发现的 bgp 邻居的摘要。您可以查看自动发现的对等节点的数量及其详细信息。
验证 BGP 自动发现的对等方
目的
验证自动发现的 BGP 邻居。
操作
在操作模式下,运行 show bgp neighbor auto-discovered
命令。
在叶子上1
user@Leaf1> show bgp neighbor auto-discovered Peer: fe80::5668:a3ff:fe16:1049%ge-0/0/3.0+65265 AS 64499 Local: fe80::5668:a3ff:fe16:2f6%ge-0/0/3.0+179 AS 64496 Group: autodisc Routing-Instance: master Forwarding routing-instance: master Type: External State: Established Flags: <Sync PeerAsList AutoDiscoveredNdp> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None Export: [ DIRECT-RTS ] Options: <AddressFamily Multipath Refresh> Options: <MultipathAs> Options: <GracefulShutdownRcv> Address families configured: inet-unicast inet6-unicast Holdtime: 90 Preference: 170 Graceful Shutdown Receiver local-preference: 0 Number of flaps: 1 Last flap event: RecvNotify Error: 'Cease' Sent: 0 Recv: 1 Peer ID: 128.49.102.24 Local ID: 128.49.102.139 Active Holdtime: 90 Keepalive Interval: 30 Group index: 2 Peer index: 2 SNMP index: 9 I/O Session Thread: bgpio-0 State: Enabled BFD: disabled, down Local Interface: ge-0/0/3.0 NLRI for restart configured on peer: inet-unicast inet6-unicast NLRI advertised by peer: inet-unicast inet6-unicast NLRI for this session: inet-unicast inet6-unicast Peer supports Refresh capability (2) Stale routes from peer are kept for: 300 Peer does not support Restarter functionality Restart flag received from the peer: Notification NLRI that restart is negotiated for: inet-unicast inet6-unicast NLRI of received end-of-rib markers: inet-unicast inet6-unicast NLRI of all end-of-rib markers sent: inet-unicast inet6-unicast ....................
在主干1上
user@Spine1> show bgp neighbor auto-discovered Peer: fe80::5668:a3ff:fe16:2e7%ge-0/0/0.0+60458 AS 64496 Local: fe80::5668:a3ff:fe16:12c9%ge-0/0/0.0+179 AS 64498 Group: autodisc Routing-Instance: master Forwarding routing-instance: master Type: External State: Established Flags: <Sync PeerAsList AutoDiscoveredNdp> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None Export: [ DIRECT-RTS ] Options: <AddressFamily Multipath Refresh> Options: <MultipathAs> Options: <GracefulShutdownRcv> Address families configured: inet-unicast inet6-unicast Holdtime: 90 Preference: 170 Graceful Shutdown Receiver local-preference: 0 Number of flaps: 0 Peer ID: 128.49.102.139 Local ID: 128.49.103.129 Active Holdtime: 90 Keepalive Interval: 30 Group index: 1 Peer index: 3 SNMP index: 7 I/O Session Thread: bgpio-0 State: Enabled BFD: disabled, down Local Interface: ge-0/0/0.0 NLRI for restart configured on peer: inet-unicast inet6-unicast NLRI advertised by peer: inet-unicast inet6-unicast NLRI for this session: inet-unicast inet6-unicast Peer supports Refresh capability (2) Stale routes from peer are kept for: 300 Peer does not support Restarter functionality Restart flag received from the peer: Notification NLRI that restart is negotiated for: inet-unicast inet6-unicast NLRI of received end-of-rib markers: inet-unicast inet6-unicast NLRI of all end-of-rib markers sent: inet-unicast inet6-unicast Peer does not support LLGR Restarter functionality Peer supports 4 byte AS extension (peer-as 64496) Peer does not support Addpath NLRI that we support extended nexthop encoding for: inet-unicast NLRI that peer supports extended nexthop encoding for: inet-unicast Table inet.0 Bit: 20000 ....................
意义
输出显示有关自动发现的 BGP 邻居的信息。