Technical documentation
发布日期:2023-07-11 浏览次数:1395 来源:WOLFLAB
HCIP Datacom培训课程精选作业|笔记|汇总|BGP综合实验
WOLFLAB官方微信:17316362402,关注WOLFLAB网络技术实验室,华为认证HCIP Datacom培训课程循环开班中,联系网站客服预约免费试听!
华为认证HCIP Datacom培训实验
一、 地址描述
1. R1-R5都有一个loopback0 IP ADD = 10.10.X.X/24,X=ROUTER NUMBER,比如R1 的LO0 =10.10.1.1/24。
[r1-LoopBack0]ip address 10.10.1.1 24
[R2-LoopBack0]ip address 10.10.2.2 24
[R3-LoopBack0]ip address 10.10.3.3 24
[R4-LoopBack0]ip address 10.10.4.4 24
[R5-LoopBack0]ip address 10.10.5.5 24
2. R1-R3以太口地址为:1.1.123.X/27,X=ROUTER NUMBER。
[r1-GigabitEthernet0/0/0]ip address 1.1.123.1 27
[R2-GigabitEthernet0/0/0]ip address 1.1.123.2 27
[R3-GigabitEthernet0/0/0]ip address 1.1.123.3 27
3. R2-R4接口地址为:1.1.24.X/24,X=ROUTER NUMBER。
[R2-Serial1/0/0]ip address 1.1.24.2 24
[R4-Serial1/0/0]ip address 1.1.24.4 24
4. R3-R4接口地址为:1.1.34.X/24,X=ROUTER NUMBER。
[R3-Serial1/0/0]ip address 1.1.34.3 24
[R4-Serial1/0/1]ip address 1.1.34.4 24
5. R4-R5接口地址为:1.1.45.X/24,X=ROUTER NUMBER。
[R4-Serial2/0/0]ip address 1.1.45.4 24
[R5-Serial2/0/0]ip address 1.1.45.5 24
HCIP Datacom培训BGP实验
二、 BRIDGE与OSPF的基本配置
1. 如图所示, 配置R1-R3的以太口地址。
2. 如图所示, 配置R2-R4,R3-R4,R4-R5之间物理接口地址。
3. 配置R1-R5的loopback0。
4. 配置完成后,测试各直连链路应能正常通讯。
[r1]ping 1.1.123.2
PING 1.1.123.2: 56 data bytes, press CTRL_C to break
Reply from 1.1.123.2: bytes=56 Sequence=1 ttl=255 time=150 ms
Reply from 1.1.123.2: bytes=56 Sequence=2 ttl=255 time=40 ms
[r1]ping 1.1.123.3
PING 1.1.123.3: 56 data bytes, press CTRL_C to break
Reply from 1.1.123.3: bytes=56 Sequence=1 ttl=255 time=100 ms
Reply from 1.1.123.3: bytes=56 Sequence=2 ttl=255 time=40 ms
<R2>ping 1.1.24.4
PING 1.1.24.4: 56 data bytes, press CTRL_C to break
Reply from 1.1.24.4: bytes=56 Sequence=1 ttl=255 time=50 ms
Reply from 1.1.24.4: bytes=56 Sequence=2 ttl=255 time=20 ms
<R3>ping 1.1.34.4
PING 1.1.34.4: 56 data bytes, press CTRL_C to break
Reply from 1.1.34.4: bytes=56 Sequence=1 ttl=255 time=30 ms
Reply from 1.1.34.4: bytes=56 Sequence=2 ttl=255 time=20 ms
<R4>ping 1.1.45.5
PING 1.1.45.5: 56 data bytes, press CTRL_C to break
Reply from 1.1.45.5: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 1.1.45.5: bytes=56 Sequence=2 ttl=255 time=30 ms
5. 在R1-R5上,按拓扑标识的区域,运行OSPF,并将R1-R5的loopback0宣告进OSPF。测试各路由器的邻居关系。
[R1]dis ospf peer brief
OSPF Process 1 with Router ID 1.1.1.1
Peer Statistic Information
-----------------------------------------
Area Id Interface Neighbor id State
0.0.0.2 GigabitEthernet0/0/0 2.2.2.2 Full
0.0.0.2 GigabitEthernet0/0/0 3.3.3.3 Full
-----------------------------------------
[R2]dis ospf peer brief
OSPF Process 1 with Router ID 2.2.2.2
Peer Statistic Information
------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Serial1/0/0 4.4.4.4 Full
0.0.0.2 GigabitEthernet0/0/0 1.1.1.1 Full
0.0.0.2 GigabitEthernet0/0/0 3.3.3.3 Full
------------------------------------
[R3]dis ospf peer brief
OSPF Process 1 with Router ID 3.3.3.3
Peer Statistic Information
----------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Serial1/0/0 4.4.4.4 Full
0.0.0.2 GigabitEthernet0/0/0 1.1.1.1 Full
0.0.0.2 GigabitEthernet0/0/0 2.2.2.2 Full
-----------------------------------
[R4]dis ospf peer brief
OSPF Process 1 with Router ID 4.4.4.4
Peer Statistic Information
-------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Serial1/0/0 2.2.2.2 Full
0.0.0.0 Serial1/0/1 3.3.3.3 Full
0.0.0.1 Serial2/0/0 5.5.5.5 Full
--------------------------------------
[R5]dis ospf peer brief
OSPF Process 1 with Router ID 5.5.5.5
Peer Statistic Information
---------------------------------------
Area Id Interface Neighbor id State
0.0.0.1 Serial2/0/0 4.4.4.4 Full
---------------------------------------
[R1]ping 10.10.5.5
PING 10.10.5.5: 56 data bytes, press CTRL_C to break
Reply from 10.10.5.5: bytes=56 Sequence=1 ttl=253 time=70 ms
Reply from 10.10.5.5: bytes=56 Sequence=2 ttl=253 time=40 ms
6. 在R5上做配置,使R5可以看到除了10.10.4.4以外的其他所有路由。
[R5-ospf-1]dis this
[V200R003C00]
#
ospf 1 router-id 5.5.5.5
filter-policy ip-prefix 10.4 import
area 0.0.0.1
network 1.1.45.5 0.0.0.0
network 10.10.5.5 0.0.0.0
#
[R5-ospf-1]dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
-------------------------------------------
Public routing table : OSPF
Destinations : 1 Routes : 1
OSPF routing table status : <Active>
Destinations : 1 Routes : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.10.4.4/32 OSPF 10 48 D 1.1.45.4 Serial2/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
三、 BGP PEER的建立,路由传递,参数修改,路由选择
1. R2,R3,R5属于 AS 235,建立两条 IBGP PEER:R5与 R2,R5与 R3。要求建邻居的时候,建立尽可能长的 TCP连接 。
[R2-bgp]dis this
[V200R003C00]
#
bgp 235
router-id 2.2.2.2
peer 10.10.3.3 as-number 235
peer 10.10.3.3 connect-interface LoopBack0
peer 10.10.5.5 as-number 235
peer 10.10.5.5 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 10.10.3.3 enable
peer 10.10.5.5 enable
#
[R2]dis bgp peer
BGP local router ID : 2.2.2.2
Local AS number : 235
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
10.10.3.3 4 235 5 5 0 00:03:14 Established
0
10.10.5.5 4 235 2 3 0 00:00:17 Established
0
[R3-bgp]dis this
[V200R003C00]
#
bgp 235
router-id 3.3.3.3
peer 10.10.2.2 as-number 235
peer 10.10.2.2 connect-interface LoopBack0
peer 10.10.5.5 as-number 235
peer 10.10.5.5 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 10.10.2.2 enable
peer 10.10.5.5 enable
#
[R3]dis bgp peer
BGP local router ID : 3.3.3.3
Local AS number : 235
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
10.10.2.2 4 235 5 6 0 00:03:38 Established
0
10.10.5.5 4 235 2 2 0 00:00:27 Established
0
[R5-bgp]dis this
[V200R003C00]
#
bgp 235
router-id 5.5.5.5
peer 10.10.2.2 as-number 235
peer 10.10.2.2 connect-interface LoopBack0
peer 10.10.3.3 as-number 235
peer 10.10.3.3 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 10.10.2.2 enable
peer 10.10.3.3 enable
#
[R5]dis bgp peer
BGP local router ID : 5.5.5.5
Local AS number : 235
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
10.10.2.2 4 235 2 2 0 00:00:52 Established
0
10.10.3.3 4 235 2 2 0 00:00:39 Established
0
2. R4属于 AS 64512,与 R5建立一条 EBGP PEER,要求 :
① 要求用两台路由器的loopback0建立
② 在R4上做配置,使它与R5建立PEER时,指向64513
bgp 64512
router-id 4.4.4.4
peer 10.10.5.5 as-number 64513
peer 10.10.5.5 ebgp-max-hop 255
peer 10.10.5.5 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 10.10.5.5 enable
#
[R5-bgp]dis this
[V200R003C00]
#
bgp 235
router-id 5.5.5.5
peer 10.10.4.4 as-number 64512
peer 10.10.4.4 ebgp-max-hop 255
peer 10.10.4.4 connect-interface LoopBack0
peer 10.10.4.4 fake-as 64513
#
ipv4-family unicast
undo synchronization
peer 10.10.4.4 enable
#
[R5]dis bgp peer
BGP local router ID : 5.5.5.5
Local AS number : 235
Total number of peers : 3 Peers in established state : 3
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
10.10.4.4 4 64512 2 2 0 00:00:19 Established
3. R1属于 AS 1,需要与R2、 R3建立EBGP PEER,要求只要有一条 Active Path,BGP邻居 不能 Down。
bgp 1
router-id 1.1.1.1
peer 10.10.2.2 as-number 235
peer 10.10.2.2 ebgp-max-hop 255
peer 10.10.2.2 connect-interface LoopBack0
peer 10.10.3.3 as-number 235
peer 10.10.3.3 ebgp-max-hop 255
peer 10.10.3.3 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 10.10.2.2 enable
peer 10.10.3.3 enable
#
[R1-bgp]dis bgp peer
BGP local router ID : 1.1.1.1
Local AS number : 1
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
10.10.2.2 4 235 2 3 0 00:00:41 Established
0
10.10.3.3 4 235 2 4 0 00:00:02 Established
0
4. 在R1上增加一个loopback101, 其IP ADD=101.1.1.1/24,通过network宣告进BGP,此时在R5的BGP表中会看到两条路由。希望在路由表里也可以看到两条等价路由。
<R5>dis 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 101.1.1.0/24 10.10.2.2 0 100 0 1i
* i 10.10.3.3 0 100 0 1i
[R5]dis ip routing-table protocol bgp
Route Flags: R - relay, D - download to fib
------------------------------------------
Public routing table : BGP
Destinations : 1 Routes : 2
BGP routing table status : <Active>
Destinations : 1 Routes : 2
Destination/Mask Proto Pre Cost Flags NextHop Interface
101.1.1.0/24 IBGP 255 0 RD 10.10.2.2 Serial2/0/0
IBGP 255 0 RD 10.10.3.3 Serial2/0/0
BGP routing table status : <Inactive>
Destinations : 0 Routes : 0
5. 在R4上增加一个loopback104,其地址如下:
interface Loopback104
ip address 104.1.1.1 255.255.255.0
ip address 104.1.2.1 255.255.255.0 sub
…
ip address 104.1.16.1 255.255.255.0 sub
用最小的命令行,将这些路由引入BGP,并且使R5看到这些路由的Origin是:IGP。
[R5]dis 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: 18
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 101.1.1.0/24 10.10.2.2 0 100 0 1i
* i 10.10.3.3 0 100 0 1i
*> 104.1.1.0/24 10.10.4.4 0 0 64512i
*> 104.1.2.0/24 10.10.4.4 0 0 64512i
*> 104.1.3.0/24 10.10.4.4 0 0 64512i
*> 104.1.4.0/24 10.10.4.4 0 0 64512i
*> 104.1.5.0/24 10.10.4.4 0 0 64512i
*> 104.1.6.0/24 10.10.4.4 0 0 64512i
*> 104.1.7.0/24 10.10.4.4 0 0 64512i
*> 104.1.8.0/24 10.10.4.4 0 0 64512i
*> 104.1.9.0/24 10.10.4.4 0 0 64512i
*> 104.1.10.0/24 10.10.4.4 0 0 64512i
*> 104.1.11.0/24 10.10.4.4 0 0 64512i
*> 104.1.12.0/24 10.10.4.4 0 0 64512i
*> 104.1.13.0/24 10.10.4.4 0 0 64512i
*> 104.1.14.0/24 10.10.4.4 0 0 64512i
*> 104.1.15.0/24 10.10.4.4 0 0 64512i
*> 104.1.16.0/24 10.10.4.4 0 0 64512i
[R5]
6. 在R4上做配置,使用最少的命令行,用ACL,使R4向R5传递路由时,只传递下列4条路由:
104.1.1.0/24
104.1.3.0/24
104.1.9.0/24
104.1.11.0/24
<R5>dis 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: 6
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 101.1.1.0/24 10.10.2.2 0 100 0 1i
* i 10.10.3.3 0 100 0 1i
*> 104.1.1.0/24 10.10.4.4 0 0 64512i
*> 104.1.3.0/24 10.10.4.4 0 0 64512i
*> 104.1.9.0/24 10.10.4.4 0 0 64512i
*> 104.1.11.0/24 10.10.4.4 0 0 64512i
7. 在R5上做配置, 使R5收到这四条路由时,BGP表里如下显示:
ROUTE AS-PATH
104.1.1.0/24 64513 64514 64512
104.1.3.0/24 64513 64514 64512
104.1.9.0/24 64513 64514 64512
104.1.11.0/24 64513 64514 64512
[R5-bgp]dis 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: 6
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 101.1.1.0/24 10.10.2.2 0 100 0 1i
* i 10.10.3.3 0 100 0 1i
*> 104.1.1.0/24 10.10.4.4 0 0 64513 6451
4 64512i
*> 104.1.3.0/24 10.10.4.4 0 0 64513 6451
4 64512i
*> 104.1.9.0/24 10.10.4.4 0 0 64513 6451
4 64512i
*> 104.1.11.0/24 10.10.4.4 0 0 64513 6451
4 64512i
8. 在R2 R3上做配置,使R1接收这4条BGP路由时,路由的AS-PATH为:235。使用最小的配置步骤及命令行。
[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
*> 101.1.1.0/24 0.0.0.0 0 0 i
*> 104.1.1.0/24 10.10.3.3 0 255i
*> 104.1.3.0/24 10.10.3.3 0 255i
*> 104.1.9.0/24 10.10.3.3 0 255i
*> 104.1.11.0/24 10.10.3.3 0 255i
9. 在R5上增加四个loopback接口:
Loopback100 100.1.0.1/24
Loopback101 100.1.1.1/24
Loopback102 100.1.2.1/24
Loopback103 100.1.3.1/24
将这些路由引入BGP,在R2与R3上聚合路由,使其在R1上看到100.1.0.0/22的路由。
<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: 11
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 100.1.0.0/22 10.10.2.2 0 235?
* 10.10.3.3 0 235?
10. 在R2与R3上做配置,使R1接收这条100.1.0.0/22的BGP路由时,路由的AS-PATH为:235 1 235。
[R1-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: 11
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 100.1.0.0/22 10.10.2.2 0 235 1 235?
* 10.10.3.3 0 235 1 235?
11. 在R1上增加六个loopback接口:
Loopback1 200.1.1.1/24
Loopback2 200.1.2.1/24
Loopback3 200.1.3.1/24
Loopback4 200.1.4.1/24
Loopback5 200.1.5.1/24
Loopback6 200.1.6.1/24
将这些路由引入BGP,使其在其他路由器上看到这六条路由的Origin是:IGP。
[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: 16
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 200.1.1.0 0.0.0.0 0 0 i
*> 200.1.2.0 0.0.0.0 0 0 i
*> 200.1.3.0 0.0.0.0 0 0 i
*> 200.1.4.0 0.0.0.0 0 0 i
*> 200.1.5.0 0.0.0.0 0 0 i
*> 200.1.6.0 0.0.0.0 0 0 i
12. 在R5上做配置,针对200.1.1.0/24这条路由,要求R5看到的最优路由是从R3学到的。它们是通过协议首选值来决定胜负的。
[r5]dis bgp routing-table 200.1.1.0
BGP local router ID : 1.1.45.5
Local AS number : 235
Paths: 2 available, 1 best, 1 select
BGP routing table entry information of 200.1.1.0/24:
From: 10.10.3.3 (1.1.34.3)
Route Duration: 00h02m18s
Relay IP Nexthop: 1.1.45.4
Relay IP Out-Interface: Serial2/0/0
Original nexthop: 10.10.1.1
Qos information : 0x0
AS-path 1, origin igp, MED 0, localpref 100, pref-val 5, valid, internal, best,
select, active, pre 255, IGP cost 97
Advertised to such 1 peers:
10.10.4.4
BGP routing table entry information of 200.1.1.0/24:
From: 10.10.2.2 (2.2.2.2)
Route Duration: 00h02m19s
Relay IP Nexthop: 1.1.45.4
Relay IP Out-Interface: Serial2/0/0
Original nexthop: 10.10.1.1
Qos information : 0x0
AS-path 1, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, pre 2
55, IGP cost 97, not preferred for PreVal
Not advertised to any peer yet
13. 在R5上做配置,针对200.1.2.0/24这条路由,要求R5看到的最优路由是从R3学到的。它们是通过Local Preference来决定胜负的。
[R5]dis bgp routing-table 200.1.2.0
BGP local router ID : 5.5.5.5
Local AS number : 235
Paths: 2 available, 0 best, 0 select
BGP routing table entry information of 200.1.2.0/24:
From: 10.10.2.2 (2.2.2.2)
Route Duration: 00h03m37s
Relay IP Nexthop: 0.0.0.0
Relay IP Out-Interface:
Original nexthop: 10.10.1.1
Qos information : 0x0
AS-path 1, origin igp, MED 0, localpref 100, pref-val 0, internal, pre 255
Not advertised to any peer yet
BGP routing table entry information of 200.1.2.0/24:
From: 10.10.3.3 (3.3.3.3)
Route Duration: 00h01m05s
Relay IP Nexthop: 0.0.0.0
Relay IP Out-Interface:
Original nexthop: 10.10.1.1
Qos information : 0x0
AS-path 1, origin igp, MED 0, localpref 105, pref-val 0, internal, pre 255
Not advertised to any peer yet
14. 在R1上做配置,将200.1.3.0/24通过OSPF传递过来, 并修改其OSPF网络类型为broadcast。在R5上将这条OSPF路由用network宣告进BGP,并且通过配置,确保这条路由在BGP里是最优路由。需要确保他们之间的比较是通过BGP选路原则的第三项来决定胜负的。
*> 200.1.3.0 0.0.0.0 97 0 i
* i 10.10.1.1 0 100 0 1i
* i 10.10.1.1 0 100 0 1i
15. 在R1上做配置,只针对R2的BGP邻居,针对200.1.4.0/24这条路由,要求R5看到的最优路由是从R3学到的, 它们是通过AS-Path来决定胜负的。
*>i 200.1.4.0 10.10.1.1 0 100 0 1i
* i 10.10.1.1 0 100 0 1 1 1 1i
16. 在R1上做配置,只针对R2的BGP邻居,针对200.1.5.0/24这条路由,要求R5看到的最优路由是从R3学到的, 它们是通过Origin Type来决定胜负的。
*>i 200.1.5.0 10.10.1.1 0 100 0 1i
* i 10.10.1.1 0 100 0 1?
17. 在R1上做配置,只针对R2的BGP邻居,针对200.1.6.0/24这条路由,要求R5看到的最优路由是从R3学到的, 它们是通过Med来决定胜负的。
*>i 200.1.6.0 10.10.1.1 0 100 0 1i
* i 10.10.1.1 500 100 0 1i
WOLFLAB官方微信:17316362402
WOLFLAB官方QQ:2569790740
学网络就选WOLF-LAB(沃尔夫)网络实验室
华为认证HCIP Datacom培训课程循环开班,联系网站客服预约免费试听!