Calico Network 简介
在 calico 官网中,对于生产网络选型这块,calico 专门做了两篇描述,一篇是针对于二层以太网的选型设计,一篇是基于三层路由的选型设计。
因为Calico BGP更多的是为了大规模集群环境的节点提供了端到端的网络互联,正是因为如此,所以Calico 也需要一个物理层的互联架构,并且 Calico 可同时在以太网或IP互联架构上保持良好运行。
calico 架构详述
在 Calico 中,各计算节点充当了路由器的角色,他们为运行在本机上的容器或是虚拟机提供路由。因此我们称之为 vRoute。Linux 内核负责数据包路由转发,通过 BGP协议 来控制路由分发,calico agent 来管理路由信息,处于节点上的 Endpoint 只能同本节点 vRoute 通信,calico 中,数据包的第一跳和最后一跳都是通过 vRoute 中的路由规则来实现,vRoute 之间通过 BGP协议 来同步节点上的 Endpoint 信息。
AS Per Rack model
本文注重解释 AS Per Rack model,其他模型,请参考官网解释 正如前面提到的,这种模型也有两个版本,一个版本有一组互联 ToR 交换机的以太网平台,另一个版本有一组互联 ToR 交换机的路由平面
上图显示了每个机架的 AS 模型,其中 ToR 交换机通过一组以太网交换平面物理上网。
上面的图表显示了每个机架模型的 AS,其中 ToR 交换机通过一组离散的 BGP Spine 路由器物理上网,每个路由器都在自己的 AS 中。 在这种方案里,每个Tor 交换机到Tor 交换机或者TOR交换机到 spine switch 的链路是EBGP对等的。那就意味着北向 tor 交换机无法使用 RR(Route Reflector)。
如果使用了2层的方式,结果就是每个Tor 交换机之间必须彼此对等(可能有上百个对等),可能会造成负载过重,通过查看黄色虚线即可。
如果使用3层的方式,那么每个TOR 交换机只需要和上级的 spine switch 对等即可。虽然spine switch 下会有许多TOR 交换机,可以使用RR(如上图所示),而且绝大部分spine switch拥有比TOR交换机更好的平面控制能力,在多数环境下更易扩展。 两者的配置基本相同,只是在TOR 交换机的北向配置上有些差异。
TOR 交换机,作为EBGP router 会获取其他TOR switch 以及数据中心上的路由,重新分配到该AS下的每个计算节点上。并且会将自身AS内的所有路由信息向外通告。这就意味着,每个计算节点会将该AS内的TOR 交换机视为到外部路由的下一跳。外部路由到该AS的下一跳则是该AS下的某台计算节点 综上所述,我们选择 L3 的 AS Per Rack model 作为演示。
eNSP 模拟 AS Per Rack model
我们使用如下所示进行演示 AR1 和 AR2 为 最上层 Spine switch,分别对应独立的 AS-number 100 和 200 AR3 和 AR6 为 各自 AS 域内 BGP RR,对应 ToR switch,分别对应各自的 AS-number 345 和 678 AS345 和 AS678 内部使用 OSPF 进行网络打通 AR4 AR5 AR7 AR8 对应底层 Computer Server ,作为 RR-Client 最终效果: AR4和AR8 分别发布一条 BGP 路由,查看对端能否学习到,并用新发布的端口互ping,查看能否 ping 通。 peer-next-hop-local
AR1
# 配置 接口 ip 地址
AR1
[AR1]interface l0
[AR1-LoopBack0]ip a 1.1.1.1 32
[AR1-LoopBack0]interf G 0/0/0
[AR1-GigabitEthernet0/0/0]ip a 10.1.13.1 24
[AR1-GigabitEthernet0/0/0]inter G 0/0/1
[AR1-GigabitEthernet0/0/1]ip a 10.1.16.1 24
[AR1-GigabitEthernet0/0/1]q
[AR1]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.1.13.1/24 up up
GigabitEthernet0/0/1 10.1.16.1/24 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 1.1.1.1/32 up up(s)
NULL0 unassigned up up(s)
# 配置 BGP 信息
[AR1]bgp 100
[AR1-bgp]router-id 1.1.1.1
[AR1-bgp]peer 10.1.13.3 as-number 345
[AR1-bgp]peer 10.1.16.6 as-number 678
[AR1-bgp]display this
[V200R003C00]
#
bgp 100
router-id 1.1.1.1
peer 10.1.13.3 as-number 345
peer 10.1.16.6 as-number 678
#
ipv4-family unicast
undo synchronization
peer 10.1.13.3 enable
peer 10.1.16.6 enable
#
return
[AR1-bgp]dis bgp peer
BGP local router ID : 1.1.1.1
Local AS number : 100
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
10.1.13.3 4 345 49 49 0 00:47:48 Established
0
10.1.16.6 4 678 3 4 0 00:01:44 Established
0
# 查看 BGP 发布路由
[AR1-bgp]dis bgp routing-table
BGP Local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 44.44.44.44/32 10.1.13.3 0 345i
*> 88.88.88.88/32 10.1.16.6 0 678i
[AR1-bgp]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.13.0/24 Direct 0 0 D 10.1.13.1 GigabitEthernet
0/0/0
10.1.13.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.13.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.16.0/24 Direct 0 0 D 10.1.16.1 GigabitEthernet
0/0/1
10.1.16.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
10.1.16.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
44.44.44.44/32 EBGP 255 0 D 10.1.13.3 GigabitEthernet
0/0/0
88.88.88.88/32 EBGP 255 0 D 10.1.16.6 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
AR2
system-view
Enter system view, return user view with Ctrl+Z.
[AR2]interface l0
[AR2-LoopBack0]ip a 2.2.2.2 32
[AR2-LoopBack0]inter G 0/0/1
[AR2-GigabitEthernet0/0/1]ip a 10.1.23.2 24
[AR2-GigabitEthernet0/0/1]inter G 0/0/0
[AR2-GigabitEthernet0/0/0]ip a 10.1.26.2 24
[AR2-GigabitEthernet0/0/0]q
[AR2]dis ip inter brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.1.26.2/24 up up
GigabitEthernet0/0/1 10.1.23.2/24 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 2.2.2.2/32 up up(s)
NULL0 unassigned up up(s)
[AR2]bgp 200
[AR2-bgp]router-id 2.2.2.2
[AR2-bgp]peer 10.1.23.3 as
[AR2-bgp]peer 10.1.23.3 as-number 345
[AR2-bgp]peer 10.1.26.6 as-number 678
[AR2-bgp]dis this
[V200R003C00]
#
bgp 200
router-id 2.2.2.2
peer 10.1.23.3 as-number 345
peer 10.1.26.6 as-number 678
#
ipv4-family unicast
undo synchronization
peer 10.1.23.3 enable
peer 10.1.26.6 enable
#
return
[AR2-bgp]dis bgp peer
BGP local router ID : 2.2.2.2
Local AS number : 200
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
10.1.23.3 4 345 7 7 0 00:05:44 Established
0
10.1.26.6 4 678 3 4 0 00:01:11 Established
0
[AR2]display bgp routing-table
BGP Local router ID is 2.2.2.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 4
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 44.44.44.44/32 10.1.23.3 0 345i
* 10.1.26.6 0 678 100 34
5i
*> 88.88.88.88/32 10.1.26.6 0 678i
* 10.1.23.3 0 345 100 67
8i
[AR2]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
2.2.2.2/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.23.0/24 Direct 0 0 D 10.1.23.2 GigabitEthernet
0/0/1
10.1.23.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
10.1.23.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
10.1.26.0/24 Direct 0 0 D 10.1.26.2 GigabitEthernet
0/0/0
10.1.26.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.26.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
44.44.44.44/32 EBGP 255 0 D 10.1.23.3 GigabitEthernet
0/0/1
88.88.88.88/32 EBGP 255 0 D 10.1.26.6 GigabitEthernet
0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
AR3
system-view
[Huawei]sysname AR3
[AR3]inter l0
[AR3-LoopBack0]ip a 3.3.3.3 32
[AR3-LoopBack0]inter G 0/0/1
[AR3-GigabitEthernet0/0/1]ip a 10.1.34.3 24
[AR3-GigabitEthernet0/0/1]inter G 0/0/2
[AR3-GigabitEthernet0/0/2]ip a 10.1.35.3 24
[AR3-GigabitEthernet0/0/2]inter G 0/0/0
[AR3-GigabitEthernet0/0/0]ip a 10.1.13.3 24
[AR3-GigabitEthernet0/0/0]inter G 4/0/0
[AR3-GigabitEthernet4/0/0]ip a 10.1.23.3 24
[AR3-GigabitEthernet4/0/0]q
[AR3]dis ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 6
The number of interface that is DOWN in Physical is 3
The number of interface that is UP in Protocol is 6
The number of interface that is DOWN in Protocol is 3
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.1.13.3/24 up up
GigabitEthernet0/0/1 10.1.34.3/24 up up
GigabitEthernet0/0/2 10.1.35.3/24 up up
GigabitEthernet4/0/0 10.1.23.3/24 up up
GigabitEthernet4/0/1 unassigned down down
GigabitEthernet4/0/2 unassigned down down
GigabitEthernet4/0/3 unassigned down down
LoopBack0 3.3.3.3/32 up up(s)
NULL0 unassigned up up(s)
[AR3]ospf 3 router-id 3.3.3.3
[AR3-ospf-3]ar
[AR3-ospf-3]area 0
[AR3-ospf-3-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[AR3-ospf-3-area-0.0.0.0]network 10.1.34.0 0.0.0.255
[AR3-ospf-3-area-0.0.0.0]network 10.1.35.0 0.0.0.255
[AR3-ospf-3-area-0.0.0.0]dis this
[V200R003C00]
#
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 10.1.34.0 0.0.0.255
network 10.1.35.0 0.0.0.255
#
return
[AR3-ospf-3-area-0.0.0.0]q
[AR3-ospf-3]q
[AR3]q
[AR3]bgp 345
[AR3-bgp]router-id 3.3.3.3
[AR3-bgp]peer 4.4.4.4 as-number 345
[AR3-bgp]peer 4.4.4.4 connect-interface l0
[AR3-bgp]peer 4.4.4.4 next-hop-local
[AR3-bgp]peer 5.5.5.5 as-number 345
[AR3-bgp]peer 5.5.5.5 connect-interface l0
[AR3-bgp]peer 5.5.5.5 next-hop-local
[AR3-bgp]peer 4.4.4.4 reflect-client
[AR3-bgp]peer 5.5.5.5 reflect-client
[AR3-bgp]dis this
[V200R003C00]
#
bgp 345
router-id 3.3.3.3
peer 4.4.4.4 as-number 345
peer 4.4.4.4 connect-interface LoopBack0
peer 5.5.5.5 as-number 345
peer 5.5.5.5 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 4.4.4.4 enable
peer 4.4.4.4 reflect-client
peer 4.4.4.4 next-hop-local
peer 5.5.5.5 enable
peer 5.5.5.5 reflect-client
peer 5.5.5.5 next-hop-local
#
return
[AR3-bgp]display bgp peer
BGP local router ID : 3.3.3.3
Local AS number : 345
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
4.4.4.4 4 345 2 2 0 00:00:51 Established
0
5.5.5.5 4 345 2 2 0 00:00:09 Established
0
[AR3-bgp]peer 1.1.1.1 as
[AR3-bgp]peer 1.1.1.1 as-number 100
[AR3-bgp]peer 1.1.1.1 con
[AR3-bgp]peer 1.1.1.1 connect-interface l0
[AR3-bgp]display this
[V200R003C00]
#
bgp 345
router-id 3.3.3.3
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0
peer 4.4.4.4 as-number 345
peer 4.4.4.4 connect-interface LoopBack0
peer 5.5.5.5 as-number 345
peer 5.5.5.5 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 1.1.1.1 enable
peer 4.4.4.4 enable
peer 4.4.4.4 reflect-client
peer 4.4.4.4 next-hop-local
peer 5.5.5.5 enable
peer 5.5.5.5 reflect-client
peer 5.5.5.5 next-hop-local
#
return
[AR3-bgp]peer 10.1.13.1 as-number 100
[AR3-bgp]peer 10.1.23.2 as-number 200
[AR3-bgp]dis this
[V200R003C00]
#
bgp 345
router-id 3.3.3.3
peer 4.4.4.4 as-number 345
peer 4.4.4.4 connect-interface LoopBack0
peer 5.5.5.5 as-number 345
peer 5.5.5.5 connect-interface LoopBack0
peer 10.1.13.1 as-number 100
peer 10.1.23.2 as-number 200
#
ipv4-family unicast
undo synchronization
peer 4.4.4.4 enable
peer 4.4.4.4 reflect-client
peer 4.4.4.4 next-hop-local
peer 5.5.5.5 enable
peer 5.5.5.5 reflect-client
peer 5.5.5.5 next-hop-local
peer 10.1.13.1 enable
peer 10.1.23.2 enable
#
return
[AR3-bgp]display bgp peer
BGP local router ID : 3.3.3.3
Local AS number : 345
Total number of peers : 4 Peers in established state : 4
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
4.4.4.4 4 345 72 72 0 01:10:38 Established
0
5.5.5.5 4 345 71 71 0 01:09:56 Established
0
10.1.13.1 4 100 50 52 0 00:48:06 Established
0
10.1.23.2 4 200 8 9 0 00:06:16 Established
0
[AR3]display bgp routing-table
BGP Local router ID is 3.3.3.3
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 3
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 44.44.44.44/32 4.4.4.4 0 100 0 i
*> 88.88.88.88/32 10.1.13.1 0 100 678i
* 10.1.23.2 0 200 678i
[AR3]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 21 Routes : 21
Destination/Mask Proto Pre Cost Flags NextHop Interface
3.3.3.3/32 Direct 0 0 D 127.0.0.1 LoopBack0
4.4.4.4/32 OSPF 10 1 D 10.1.34.4 GigabitEthernet
0/0/1
5.5.5.5/32 OSPF 10 1 D 10.1.35.5 GigabitEthernet
0/0/2
10.1.13.0/24 Direct 0 0 D 10.1.13.3 GigabitEthernet
0/0/0
10.1.13.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.13.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.23.0/24 Direct 0 0 D 10.1.23.3 GigabitEthernet
4/0/0
10.1.23.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0
10.1.23.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0
10.1.34.0/24 Direct 0 0 D 10.1.34.3 GigabitEthernet
0/0/1
10.1.34.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
10.1.34.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
10.1.35.0/24 Direct 0 0 D 10.1.35.3 GigabitEthernet
0/0/2
10.1.35.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
10.1.35.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
44.44.44.44/32 IBGP 255 0 RD 4.4.4.4 GigabitEthernet
0/0/1
88.88.88.88/32 EBGP 255 0 D 10.1.13.1 GigabitEthernet
0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
AR4
system-view
[Huawei]sys AR4
[AR4]inter l0
[AR4-LoopBack0]ip a 4.4.4.4 32
[AR4-LoopBack0]inter G 0/0/0
[AR4-GigabitEthernet0/0/0]ip a 10.1.34.4 24.
[AR4-GigabitEthernet0/0/0]q
[AR4]dis ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.1.34.4/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 4.4.4.4/32 up up(s)
NULL0 unassigned up up(s)
[AR4]ospf 3 router-id 4.4.4.4
[AR4-ospf-3]area 0
[AR4-ospf-3-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[AR4-ospf-3-area-0.0.0.0]network 10.1.34.0 0.0.0.255
[AR4-ospf-3-area-0.0.0.0]dis this
[V200R003C00]
#
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 10.1.34.0 0.0.0.255
#
return
[AR4]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost Flags NextHop Interface
3.3.3.3/32 OSPF 10 1 D 10.1.34.3 GigabitEthernet
0/0/0
4.4.4.4/32 Direct 0 0 D 127.0.0.1 LoopBack0
5.5.5.5/32 OSPF 10 2 D 10.1.34.3 GigabitEthernet
0/0/0
10.1.34.0/24 Direct 0 0 D 10.1.34.4 GigabitEthernet
0/0/0
10.1.34.4/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.34.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.35.0/24 OSPF 10 2 D 10.1.34.3 GigabitEthernet
0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[AR4]bgp 345
[AR4-bgp]router-id 4.4.4.4
[AR4-bgp]peer 3.3.3.3 as-number 345
[AR4-bgp]peer 3.3.3.3 connect-interface l0
[AR4-bgp]dis this
[V200R003C00]
#
bgp 345
router-id 4.4.4.4
peer 3.3.3.3 as-number 345
peer 3.3.3.3 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 3.3.3.3 enable
#
return
[AR4]display bgp peer
BGP local router ID : 4.4.4.4
Local AS number : 345
Total number of peers : 1 Peers in established state : 1
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
3.3.3.3 4 345 73 73 0 01:11:00 Established
0
[AR4-LoopBack1]ip a 44.44.44.44 32
[AR4-LoopBack1]bgp 345
[AR4-bgp]network 44.44.44.44 255.255.255.255
[AR4]display bgp routing-table
BGP Local router ID is 4.4.4.4
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 44.44.44.44/32 0.0.0.0 0 0 i
*>i 88.88.88.88/32 3.3.3.3 100 0 100 678i
[AR4]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
3.3.3.3/32 OSPF 10 1 D 10.1.34.3 GigabitEthernet
0/0/0
4.4.4.4/32 Direct 0 0 D 127.0.0.1 LoopBack0
5.5.5.5/32 OSPF 10 2 D 10.1.34.3 GigabitEthernet
0/0/0
10.1.34.0/24 Direct 0 0 D 10.1.34.4 GigabitEthernet
0/0/0
10.1.34.4/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.34.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.35.0/24 OSPF 10 2 D 10.1.34.3 GigabitEthernet
0/0/0
44.44.44.44/32 Direct 0 0 D 127.0.0.1 LoopBack1
88.88.88.88/32 IBGP 255 0 RD 3.3.3.3 GigabitEthernet
0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
AR5
system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname AR5
[AR5]interface l0
[AR5-LoopBack0]ip a 5.5.5.5 32
[AR5-LoopBack0]inter G 0/0/0
[AR5-GigabitEthernet0/0/0]ip a 10.1.35.5 24
[AR5-GigabitEthernet0/0/0]q
[AR5]dis ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.1.35.5/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 5.5.5.5/32 up up(s)
NULL0 unassigned up up(s)
[AR5]ospf 3 router-id 5.5.5.5
[AR5-ospf-3]area 0
[AR5-ospf-3-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[AR5-ospf-3-area-0.0.0.0]network 10.1.35.0 0.0.0.255
[AR5-ospf-3-area-0.0.0.0]dis this
[V200R003C00]
#
area 0.0.0.0
network 5.5.5.5 0.0.0.0
network 10.1.35.0 0.0.0.255
#
return
[AR5-ospf-3-area-0.0.0.0]
[AR5]bgp 345
[AR5-bgp]router-id 5.5.5.5
[AR5-bgp]peer 3.3.3.3 as-number 345
[AR5-bgp]peer 3.3.3.3 connect-interface l0
[AR5]dis bgp peer
BGP local router ID : 5.5.5.5
Local AS number : 345
Total number of peers : 1 Peers in established state : 1
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
3.3.3.3 4 345 72 74 0 01:10:42 Established
0
[AR5]display bgp routing-table
BGP Local router ID is 5.5.5.5
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 44.44.44.44/32 4.4.4.4 0 100 0 i
*>i 88.88.88.88/32 3.3.3.3 100 0 100 678i
[AR5]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
3.3.3.3/32 OSPF 10 1 D 10.1.35.3 GigabitEthernet
0/0/0
4.4.4.4/32 OSPF 10 2 D 10.1.35.3 GigabitEthernet
0/0/0
5.5.5.5/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.34.0/24 OSPF 10 2 D 10.1.35.3 GigabitEthernet
0/0/0
10.1.35.0/24 Direct 0 0 D 10.1.35.5 GigabitEthernet
0/0/0
10.1.35.5/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.35.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
44.44.44.44/32 IBGP 255 0 RD 4.4.4.4 GigabitEthernet
0/0/0
88.88.88.88/32 IBGP 255 0 RD 3.3.3.3 GigabitEthernet
0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
AR6
system-view
Enter system view, return user view with Ctrl+Z.a
[Huawei]sysname AR6
system-view
Enter system view, return user view with Ctrl+Z.
[AR6]interface l0
[AR6-LoopBack0]ip a 6.6.6.6 32
[AR6-LoopBack0]inter G 4/0/0
[AR6-GigabitEthernet4/0/0]ip a 10.1.16.6 24
[AR6-GigabitEthernet4/0/0]inter G 0/0/0
[AR6-GigabitEthernet0/0/0]ip a 10.1.26.6 24
[AR6-GigabitEthernet0/0/0]inter G 0/0/1
[AR6-GigabitEthernet0/0/1]ip a 10.1.67.6 24
[AR6-GigabitEthernet0/0/1]inter G 0/0/2
[AR6-GigabitEthernet0/0/2]ip a 10.1.68.6 24
[AR6-GigabitEthernet0/0/2]q
[AR6]dis ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 6
The number of interface that is DOWN in Physical is 3
The number of interface that is UP in Protocol is 6
The number of interface that is DOWN in Protocol is 3
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.1.26.6/24 up up
GigabitEthernet0/0/1 10.1.67.6/24 up up
GigabitEthernet0/0/2 10.1.68.6/24 up up
GigabitEthernet4/0/0 10.1.16.6/24 up up
GigabitEthernet4/0/1 unassigned down down
GigabitEthernet4/0/2 unassigned down down
GigabitEthernet4/0/3 unassigned down down
LoopBack0 6.6.6.6/32 up up(s)
NULL0 unassigned up up(s)
[AR6]ospf 6 router-id 6.6.6.6
[AR6-ospf-6]area 0
[AR6-ospf-6-area-0.0.0.0]network 6.6.6.6 0.0.0.0
[AR6-ospf-6-area-0.0.0.0]network 10.1.67.0 0.0.0.255
[AR6-ospf-6-area-0.0.0.0]network 10.1.68.0 0.0.0.255
[AR6-ospf-6-area-0.0.0.0]display this
[V200R003C00]
#
area 0.0.0.0
network 6.6.6.6 0.0.0.0
network 10.1.67.0 0.0.0.255
network 10.1.68.0 0.0.0.255
#
return
[AR6]bgp 678
[AR6-bgp]router-id 6.6.6.6
[AR6-bgp]peer 7.7.7.7 as-number 678
[AR6-bgp]peer 7.7.7.7 connect-interface l0
[AR6-bgp]peer 7.7.7.7 reflect-client
[AR6-bgp]peer 7.7.7.7 next-hop-local
[AR6-bgp]peer 8.8.8.8 as-number 678
[AR6-bgp]peer 8.8.8.8 connect-interface l0
[AR6-bgp]peer 8.8.8.8 reflect-client
[AR6-bgp]peer 8.8.8.8 next-hop-local
[AR6-bgp]dis this
[V200R003C00]
#
bgp 678
router-id 6.6.6.6
peer 7.7.7.7 as-number 678
peer 7.7.7.7 connect-interface LoopBack0
peer 8.8.8.8 as-number 678
peer 8.8.8.8 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 7.7.7.7 enable
peer 7.7.7.7 reflect-client
peer 7.7.7.7 next-hop-local
peer 8.8.8.8 enable
peer 8.8.8.8 reflect-client
peer 8.8.8.8 next-hop-local
#
return
[AR6]bgp 678
[AR6-bgp]peer 10.1.16.1 as-number 100
[AR6-bgp]peer 10.1.26.2 as-number 200
[AR6-bgp]dis this
[V200R003C00]
#
bgp 678
router-id 6.6.6.6
peer 7.7.7.7 as-number 678
peer 7.7.7.7 connect-interface LoopBack0
peer 8.8.8.8 as-number 678
peer 8.8.8.8 connect-interface LoopBack0
peer 10.1.16.1 as-number 100
peer 10.1.26.2 as-number 200
#
ipv4-family unicast
undo synchronization
peer 7.7.7.7 enable
peer 7.7.7.7 reflect-client
peer 7.7.7.7 next-hop-local
peer 8.8.8.8 enable
peer 8.8.8.8 reflect-client
peer 8.8.8.8 next-hop-local
peer 10.1.16.1 enable
peer 10.1.26.2 enable
#
return
[AR6-bgp]display bgp peer
BGP local router ID : 6.6.6.6
Local AS number : 678
Total number of peers : 4 Peers in established state : 4
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
7.7.7.7 4 678 59 60 0 00:57:53 Established
0
8.8.8.8 4 678 58 60 0 00:56:13 Established
0
10.1.16.1 4 100 5 5 0 00:03:06 Established
0
10.1.26.2 4 200 4 4 0 00:02:46 Established
0
[AR6]display bgp routing-table
BGP Local router ID is 6.6.6.6
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 3
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 44.44.44.44/32 10.1.16.1 0 100 345i
* 10.1.26.2 0 200 345i
*>i 88.88.88.88/32 8.8.8.8 0 100 0 i
[AR6]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 21 Routes : 21
Destination/Mask Proto Pre Cost Flags NextHop Interface
6.6.6.6/32 Direct 0 0 D 127.0.0.1 LoopBack0
7.7.7.7/32 OSPF 10 1 D 10.1.67.7 GigabitEthernet
0/0/1
8.8.8.8/32 OSPF 10 1 D 10.1.68.8 GigabitEthernet
0/0/2
10.1.16.0/24 Direct 0 0 D 10.1.16.6 GigabitEthernet
4/0/0
10.1.16.6/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0
10.1.16.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0
10.1.26.0/24 Direct 0 0 D 10.1.26.6 GigabitEthernet
0/0/0
10.1.26.6/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.26.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.67.0/24 Direct 0 0 D 10.1.67.6 GigabitEthernet
0/0/1
10.1.67.6/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
10.1.67.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
10.1.68.0/24 Direct 0 0 D 10.1.68.6 GigabitEthernet
0/0/2
10.1.68.6/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
10.1.68.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
44.44.44.44/32 EBGP 255 0 D 10.1.16.1 GigabitEthernet
4/0/0
88.88.88.88/32 IBGP 255 0 RD 8.8.8.8 GigabitEthernet
0/0/2
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
AR7
system-view
[Huawei]sysname AR7
[AR7]inte l0
[AR7-LoopBack0]ip a 7.7.7.7 32
[AR7-LoopBack0]inter G 0/0/0
[AR7-GigabitEthernet0/0/0]ip a 10.1.67.7 24
[AR7-GigabitEthernet0/0/0]q
[AR7]dis ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.1.67.7/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 7.7.7.7/32 up up(s)
NULL0 unassigned up up(s)
[AR7]ospf 6 router-id 7.7.7.7
[AR7-ospf-6]area 0
[AR7-ospf-6-area-0.0.0.0]network 7.7.7.7 0.0.0.0
[AR7-ospf-6-area-0.0.0.0]network 10.1.67.0 0.0.0.255
[AR7-ospf-6-area-0.0.0.0]display this
[V200R003C00]
#
area 0.0.0.0
network 7.7.7.7 0.0.0.0
network 10.1.67.0 0.0.0.255
#
return
[AR7]bgp 678
[AR7-bgp]router-id 7.7.7.7
[AR7-bgp]peer 6.6.6.6 as-number 678
[AR7-bgp]peer 6.6.6.6 connect-interface l0
[AR7-bgp]dis this
[V200R003C00]
#
bgp 678
router-id 7.7.7.7
peer 6.6.6.6 as-number 678
peer 6.6.6.6 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 6.6.6.6 enable
#
return
[AR7]display bgp peer
BGP local router ID : 7.7.7.7
Local AS number : 678
Total number of peers : 1 Peers in established state : 1
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
6.6.6.6 4 678 60 60 0 00:58:15 Established
0
[AR7]display bgp routing-table
BGP Local router ID is 7.7.7.7
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 44.44.44.44/32 6.6.6.6 100 0 100 345i
*>i 88.88.88.88/32 8.8.8.8 0 100 0 i
[AR7]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
6.6.6.6/32 OSPF 10 1 D 10.1.67.6 GigabitEthernet
0/0/0
7.7.7.7/32 Direct 0 0 D 127.0.0.1 LoopBack0
8.8.8.8/32 OSPF 10 2 D 10.1.67.6 GigabitEthernet
0/0/0
10.1.67.0/24 Direct 0 0 D 10.1.67.7 GigabitEthernet
0/0/0
10.1.67.7/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.67.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.68.0/24 OSPF 10 2 D 10.1.67.6 GigabitEthernet
0/0/0
44.44.44.44/32 IBGP 255 0 RD 6.6.6.6 GigabitEthernet
0/0/0
88.88.88.88/32 IBGP 255 0 RD 8.8.8.8 GigabitEthernet
0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
AR8
system-view
[Huawei]sysname AR8
[AR8]interface l0
[AR8-LoopBack0]ip a 8.8.8.8 32
[AR8-LoopBack0]inter G 0/0/0
[AR8-GigabitEthernet0/0/0]ip a 10.1.68.8 24
[AR8-GigabitEthernet0/0/0]q
[AR8]dis ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.1.68.8/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 8.8.8.8/32 up up(s)
NULL0 unassigned up up(s)
[AR8]ospf 6 router-id 8.8.8.8
[AR8-ospf-6]area 0
[AR8-ospf-6-area-0.0.0.0]network 8.8.8.8 0.0.0.0
[AR8-ospf-6-area-0.0.0.0]network 10.1.68.0 0.0.0.255
[AR8-ospf-6-area-0.0.0.0]display this
[V200R003C00]
#
area 0.0.0.0
network 8.8.8.8 0.0.0.0
network 10.1.68.0 0.0.0.255
#
return
[AR8]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost Flags NextHop Interface
6.6.6.6/32 OSPF 10 1 D 10.1.68.6 GigabitEthernet
0/0/0
7.7.7.7/32 OSPF 10 2 D 10.1.68.6 GigabitEthernet
0/0/0
8.8.8.8/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.67.0/24 OSPF 10 2 D 10.1.68.6 GigabitEthernet
0/0/0
10.1.68.0/24 Direct 0 0 D 10.1.68.8 GigabitEthernet
0/0/0
10.1.68.8/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.68.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[AR8]bgp 678
[AR8-bgp]router
[AR8-bgp]router-id 8.8.8.8
[AR8-bgp]peer 6.6.6.6 as-number 678
[AR8-bgp]peer 6.6.6.6 connect-interface l0
[AR8-bgp]dis this
[V200R003C00]
#
bgp 678
router-id 8.8.8.8
peer 6.6.6.6 as-number 678
peer 6.6.6.6 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 6.6.6.6 enable
#
return
[AR8]dis bgp peer
BGP local router ID : 8.8.8.8
Local AS number : 678
Total number of peers : 1 Peers in established state : 1
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
6.6.6.6 4 678 58 58 0 00:56:50 Established
0
[AR8]display bgp routing-table
BGP Local router ID is 8.8.8.8
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 44.44.44.44/32 6.6.6.6 100 0 100 345i
*> 88.88.88.88/32 0.0.0.0 0 0 i
[AR8]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
6.6.6.6/32 OSPF 10 1 D 10.1.68.6 GigabitEthernet
0/0/0
7.7.7.7/32 OSPF 10 2 D 10.1.68.6 GigabitEthernet
0/0/0
8.8.8.8/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.67.0/24 OSPF 10 2 D 10.1.68.6 GigabitEthernet
0/0/0
10.1.68.0/24 Direct 0 0 D 10.1.68.8 GigabitEthernet
0/0/0
10.1.68.8/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.68.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
44.44.44.44/32 IBGP 255 0 RD 6.6.6.6 GigabitEthernet
0/0/0
88.88.88.88/32 Direct 0 0 D 127.0.0.1 LoopBack1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[AR8]interface l1
[AR8-LoopBack1]ip a 88.88.88.88 32
[AR8-LoopBack1]bgp 678
[AR8-bgp]network 88.88.88.88 255.255.255.255
[AR8-bgp]ping -a 88.88.88.88 44.44.44.44
PING 44.44.44.44: 56 data bytes, press CTRL_C to break
Reply from 44.44.44.44: bytes=56 Sequence=1 ttl=252 time=40 ms
Reply from 44.44.44.44: bytes=56 Sequence=2 ttl=252 time=40 ms
Reply from 44.44.44.44: bytes=56 Sequence=3 ttl=252 time=30 ms
Reply from 44.44.44.44: bytes=56 Sequence=4 ttl=252 time=30 ms
Reply from 44.44.44.44: bytes=56 Sequence=5 ttl=252 time=40 ms
--- 44.44.44.44 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/36/40 ms
最终效果
通过 AR8 上的地址 ping AR4 的地址 可以正常通信