BGP实验
实验要求
实验拓扑如图:R1 的 AS 编号为1,环回为 1.1.1.1/24 ,R2,R3,R4的环回分别为2.2.2.2/24,3.3.3.3/24,4.4.4.4/24 AS编号为 2 ;R5环回为5.5.5.5/24.AS编号为3, 要求五个路由器可以学习到其他路由器的环回。
实验注意事项
- 由于BGP 的 AS-BY-AS 机制,会造成当路由传递到 IBGP后属性不发生改变,因此在IBGP中需要修改路由条目属性路由表才会加表转发。
- 在EBGP中,双方发送数据报文TTL值为1,因此需要修改EBGP邻居间的TTL值。
- 本地从一个IBGP邻居处学习到的路由条目,不得传递给本地的其他IBGP邻居;AS-BY-AS在一个AS内部条目传递的过程中,默认不会修改任何的属性;运行BGP协议的路由器只能将需要让内部运行BGP协议的路由器两两互相建邻。
实验配置
R1配置:
bgp 1
router-id 1.1.1.1
peer 12.1.1.2 as-number 2
ipv4-family unicast
undo synchronization
network 1.1.1.0 255.255.255.0
peer 12.1.1.2 enable
R2配置:
bgp 2
router-id 2.2.2.2
peer 3.3.3.3 as-number 2
peer 3.3.3.3 connect-interface LoopBack1
peer 4.4.4.4 as-number 2
peer 4.4.4.4 connect-interface LoopBack1
peer 12.1.1.1 as-number 1
ipv4-family unicast
undo synchronization
network 2.2.2.0 255.255.255.0
peer 3.3.3.3 enable
peer 3.3.3.3 next-hop-local
peer 4.4.4.4 enable
peer 4.4.4.4 next-hop-local
peer 12.1.1.1 enable
peer 12.1.1.1 next-hop-local
R3配置:
bgp 2
router-id 3.3.3.3
peer 2.2.2.2 as-number 2
peer 2.2.2.2 connect-interface LoopBack1
peer 4.4.4.4 as-number 2
peer 4.4.4.4 connect-interface LoopBack1
ipv4-family unicast
undo synchronization
network 3.3.3.0 255.255.255.0
peer 2.2.2.2 enable
peer 2.2.2.2 next-hop-local
peer 4.4.4.4 enable
R4配置:
bgp 2
router-id 4.4.4.4
peer 2.2.2.2 as-number 2
peer 2.2.2.2 connect-interface LoopBack1
peer 3.3.3.3 as-number 2
peer 3.3.3.3 connect-interface LoopBack1
peer 5.5.5.5 as-number 3
peer 5.5.5.5 ebgp-max-hop 2
peer 5.5.5.5 connect-interface LoopBack1
ipv4-family unicast
undo synchronization
network 4.4.4.0 255.255.255.0
peer 2.2.2.2 enable
peer 2.2.2.2 next-hop-local
peer 3.3.3.3 enable
peer 3.3.3.3 next-hop-local
peer 5.5.5.5 enable
peer 5.5.5.5 next-hop-local
R5配置;
bgp 3
peer 4.4.4.4 as-number 2
peer 4.4.4.4 ebgp-max-hop 2
peer 4.4.4.4 connect-interface LoopBack1
ipv4-family unicast
undo synchronization
network 5.5.5.0 255.255.255.0
peer 4.4.4.4 enable
实验结果
R1 的 BGP 表:
[r1]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: 5
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.0/24 0.0.0.0 0 0 i
*> 2.2.2.0/24 12.1.1.2 0 0 2i
*> 3.3.3.0/24 12.1.1.2 0 2i
*> 4.4.4.0/24 12.1.1.2 0 2i
*> 5.5.5.0/24 12.1.1.2 0 2 3i
R2 BGP表
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: 5
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.0/24 12.1.1.1 0 0 1i
*> 2.2.2.0/24 0.0.0.0 0 0 i
*>i 3.3.3.0/24 3.3.3.3 0 100 0 i
*>i 4.4.4.0/24 4.4.4.4 0 100 0 i
*>i 5.5.5.0/24 4.4.4.4 0 100 0 3i
R3 BGP表
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: 5
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 1.1.1.0/24 2.2.2.2 0 100 0 1i
*>i 2.2.2.0/24 2.2.2.2 0 100 0 i
*> 3.3.3.0/24 0.0.0.0 0 0 i
*>i 4.4.4.0/24 4.4.4.4 0 100 0 i
*>i 5.5.5.0/24 4.4.4.4 0 100 0 3i
R4 BGP 表
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: 5
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 1.1.1.0/24 2.2.2.2 0 100 0 1i
*>i 2.2.2.0/24 2.2.2.2 0 100 0 i
*>i 3.3.3.0/24 3.3.3.3 0 100 0 i
*> 4.4.4.0/24 0.0.0.0 0 0 i
*> 5.5.5.0/24 5.5.5.5 0 0 3i
R5 BGP表
BGP Local router ID is 45.1.1.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: 5
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.0/24 4.4.4.4 0 2 1i
*> 2.2.2.0/24 4.4.4.4 0 2i
*> 3.3.3.0/24 4.4.4.4 0 2i
*> 4.4.4.0/24 4.4.4.4 0 0 2i
*> 5.5.5.0/24 0.0.0.0 0 0 i