前言:本次结合之前学习到的IS-IS与BGP协议,做一个综合实验,除了复习下IS-IS与BGP协议的配置以及BGP邻居关系的建立之外,还涉及到BGP下一跳的优化,路由反射器的配置等其他知识
//这里就只展示接口信息,部分内容省略
R1:
[R1]dis ip int b
。。省略部分内容
GigabitEthernet0/0/0 12.0.0.1/30 up up
GigabitEthernet0/0/1 16.0.0.1/30 up up
LoopBack0 1.1.1.1/32 up up(s)
R2:
[R2]dis ip int b
GigabitEthernet0/0/0 12.0.0.2/30 up up
GigabitEthernet0/0/1 23.0.0.1/30 up up
GigabitEthernet0/0/2 26.0.0.1/30 up up
GigabitEthernet0/0/3 25.0.0.2/30 up up
LoopBack0 2.2.2.2/32 up up(s)
R3:
[R3]dis ip int b
GigabitEthernet0/0/0 23.0.0.2/30 up up
GigabitEthernet0/0/1 34.0.0.1/30 up up
GigabitEthernet0/0/2 37.0.0.1/30 up up
LoopBack0 3.3.3.3/32 up up(s)
R4:
[R4]dis ip int b
GigabitEthernet0/0/0 34.0.0.2/30 up up
GigabitEthernet0/0/1 48.0.0.1/30 up up
LoopBack0 4.4.4.4/32 up up(s)
R5:
[R5]dis ip int b
GigabitEthernet0/0/0 56.0.0.1/30 up up
GigabitEthernet0/0/1 25.0.0.1/30 up up
LoopBack0 5.5.5.5/32 up up(s)
R6:
[R6]dis ip int b
GigabitEthernet0/0/0 56.0.0.2/30 up up
GigabitEthernet0/0/1 67.0.0.1/30 up up
GigabitEthernet0/0/2 26.0.0.2/30 up up
GigabitEthernet0/0/3 16.0.0.2/30 up up
LoopBack0 6.6.6.6/32 up up(s)
R7:
[R7]dis ip int b
GigabitEthernet0/0/0 67.0.0.2/30 up up
GigabitEthernet0/0/1 78.0.0.1/30 up up
GigabitEthernet0/0/2 37.0.0.2/30 up up
LoopBack0 7.7.7.7/32 up up(s)
R8:
[R8]dis ip int b
GigabitEthernet0/0/0 78.0.0.2/30 up up
GigabitEthernet0/0/1 48.0.0.2/30 up up
LoopBack0 8.8.8.8/32 up up(s)
[R1]isis 1 //开启
[R1-isis-1]network-entity 49.0001.0010.0100.1001.00 //宣告NSAP
[R1-isis-1]is-level level-1 //配置IS-IS路由级别
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]isis en //开启isis
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]isis enable
[R1-GigabitEthernet0/0/1]int loo 0
[R1-LoopBack0]isis enable
各路由器的NSAP:
R2的NSAP:network-entity 49.0001.0010.0100.1001.00
R3的NSAP:network-entity 49.0000.0010.0100.1001.00
R5的NSAP:network-entity 49.0001.0010.0100.1001.00
R6的NSAP:network-entity 49.0001.0010.0100.1001.00
R7的NSAP:network-entity 49.0000.0010.0100.1001.00
各路由器的ISIS路由级别:
R2的路由级别:is-level level-1-2
R3的路由级别:is-level level-2
R5的路由级别:is-level level-1
R6的路由级别:is-level level-1-2
R7的路由级别:is-level level-2
注意:R3的G0/0/1和R7的G0/0/1接口不需要开启isis
[R2]isis 1
[R2-isis-1]import-route isis level-2 into level-1
[R6]isis 1
[R6-isis-1]import-route isis level-2 into level-1
[R1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 19 Routes : 22
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 ISIS-L1 15 10 D 12.0.0.2 GigabitEthernet
0/0/0
ISIS-L1 15 10 D 16.0.0.2 GigabitEthernet
0/0/1
1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
2.2.2.2/32 ISIS-L1 15 10 D 12.0.0.2 GigabitEthernet
0/0/0
3.3.3.3/32 ISIS-L1 15 20 D 12.0.0.2 GigabitEthernet
0/0/0
5.5.5.5/32 ISIS-L1 15 20 D 12.0.0.2 GigabitEthernet
0/0/0
ISIS-L1 15 20 D 16.0.0.2 GigabitEthernet
0/0/1
6.6.6.6/32 ISIS-L1 15 10 D 16.0.0.2 GigabitEthernet
0/0/1
11.0.0.0/30 Direct 0 0 D 11.0.0.1 LoopBack1
11.0.0.1/32 Direct 0 0 D 127.0.0.1 LoopBack1
12.0.0.0/30 Direct 0 0 D 12.0.0.1 GigabitEthernet
0/0/0
12.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
16.0.0.0/30 Direct 0 0 D 16.0.0.1 GigabitEthernet
0/0/1
16.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
23.0.0.0/30 ISIS-L1 15 20 D 12.0.0.2 GigabitEthernet
0/0/0
25.0.0.0/30 ISIS-L1 15 20 D 12.0.0.2 GigabitEthernet
0/0/0
26.0.0.0/30 ISIS-L1 15 20 D 12.0.0.2 GigabitEthernet
0/0/0
ISIS-L1 15 20 D 16.0.0.2 GigabitEthernet
0/0/1
37.0.0.0/30 ISIS-L1 15 30 D 12.0.0.2 GigabitEthernet
0/0/0
56.0.0.0/30 ISIS-L1 15 20 D 16.0.0.2 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
router id 1.1.1.1 //宣告router id
bgp 56001 //开启bgp协议,56001为所在AS区域号
peer 2.2.2.2 as-number 56001 //与AS区域号为56001,ip为2.2.2.2的路由建立邻居关系
peer 2.2.2.2 connect-interface LoopBack 0 //与ip2.2.2.2的路由loopback 0接口建立邻居关系
peer 3.3.3.3 as-number 56001 //同上
peer 3.3.3.3 connect-interface LoopBack 0
peer 6.6.6.6 as-number 56001
peer 6.6.6.6 connect-interface LoopBack 0
peer 7.7.7.7 as-number 56001
peer 7.7.7.7 connect-interface LoopBack 0
router id 2.2.2.2
bgp 56001
peer 1.1.1.1 as-number 56001
peer 1.1.1.1 connect-interface LoopBack 0
peer 3.3.3.3 as-number 56001
peer 3.3.3.3 connect-interface LoopBack 0
peer 5.5.5.5 as-number 56001
peer 5.5.5.5 connect-interface LoopBack 0
peer 6.6.6.6 as-number 56001
peer 6.6.6.6 connect-interface LoopBack 0
router id 3.3.3.3
bgp 56001
peer 1.1.1.1 as-number 56001
peer 1.1.1.1 connect-interface LoopBack 0
peer 2.2.2.2 as-number 56001
peer 2.2.2.2 connect-interface LoopBack 0
peer 5.5.5.5 as-number 56001
peer 5.5.5.5 connect-interface LoopBack 0
peer 7.7.7.7 as-number 56001
peer 7.7.7.7 connect-interface LoopBack 0
router id 5.5.5.5
bgp 56001
peer 2.2.2.2 as-number 56001
peer 2.2.2.2 connect-interface LoopBack 0
peer 3.3.3.3 as-number 56001
peer 3.3.3.3 connect-interface LoopBack 0
peer 6.6.6.6 as-number 56001
peer 6.6.6.6 connect-interface LoopBack 0
peer 7.7.7.7 as-number 56001
peer 7.7.7.7 connect-interface LoopBack 0
router id 6.6.6.6
bgp 56001
peer 1.1.1.1 as-number 56001
peer 1.1.1.1 connect-interface LoopBack 0
peer 2.2.2.2 as-number 56001
peer 2.2.2.2 connect-interface LoopBack 0
peer 5.5.5.5 as-number 56001
peer 5.5.5.5 connect-interface LoopBack 0
peer 7.7.7.7 as-number 56001
peer 7.7.7.7 connect-interface LoopBack 0
router id 7.7.7.7
bgp 56001
peer 1.1.1.1 as-number 56001
peer 1.1.1.1 connect-interface LoopBack 0
peer 3.3.3.3 as-number 56001
peer 3.3.3.3 connect-interface LoopBack 0
peer 5.5.5.5 as-number 56001
peer 5.5.5.5 connect-interface LoopBack 0
peer 6.6.6.6 as-number 56001
peer 6.6.6.6 connect-interface LoopBack 0
[R1]dis bgp peer
BGP local router ID : 1.1.1.1
Local AS number : 56001
Total number of peers : 4 Peers in established state : 4
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
2.2.2.2 4 56001 13 14 0 00:11:22 Established
0
3.3.3.3 4 56001 11 12 0 00:09:27 Established
0
6.6.6.6 4 56001 9 10 0 00:08:00 Established
0
7.7.7.7 4 56001 3 3 0 00:01:23 Established
0
[R1]int loo 1
[R1-LoopBack1]ip add 11.0.0.1 30
[R1-LoopBack1]
[R1]bgp 56001
[R1-bgp]network 11.0.0.0 30
//通过配置路由反射器让R5能够学习到业务网段
bgp 56001
reflector cluster-id 100
peer 1.1.1.1 reflect-client
peer 5.5.5.5 reflect-client
//在生产环境中我们还需要再R6上配置路由反射器,实现室内路由互通
bgp 56001
reflector cluster-id 100
peer 1.1.1.1 reflect-client
peer 5.5.5.5 reflect-client
//R3与R6没有建立邻居关系,所以不需要做R6的反射
bgp 56001
reflector cluster-id 200
peer 2.2.2.2 reflect-client
//R7与R2没有建立邻居关系,所以不需要做R2的反射
bgp 56001
reflector cluster-id 200
peer 6.6.6.6 reflect-client
//配置静态路由
[R3]ip route-static 4.4.4.4 32 34.0.0.2
[R7]ip route-static 8.8.8.8 32 78.0.0.2
[R4]ip route-static 3.3.3.3 32 34.0.0.1
[R8]ip route-static 7.7.7.7 32 78.0.0.1
//建立EBGP邻居
[R3]bgp 56001
[R3-bgp]peer 4.4.4.4 as-number 56002
[R3-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[R3-bgp]peer 4.4.4.4 ebgp-max-hop 2
[R4]router id 4.4.4.4
[R4]bgp 56002
[R4-bgp]peer 3.3.3.3 as-number 56001
[R4-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R4-bgp]peer 3.3.3.3 ebgp-max-hop 2
[R7]bgp 56001
[R7-bgp]peer 8.8.8.8 as-number 56002
[R7-bgp]peer 8.8.8.8 connect-interface LoopBack 0
[R7-bgp]peer 8.8.8.8 ebgp-max-hop 2
[R8]router id 8.8.8.8
[R8]bgp 56002
[R8-bgp]peer 7.7.7.7 as-number 56001
[R8-bgp]peer 7.7.7.7 connect-interface LoopBack 0
[R8-bgp]peer 7.7.7.7 ebgp-max-hop 2
[R4]int loo 1
[R4-LoopBack1]ip add 44.0.0.1 30
[R4-LoopBack1]q
[R4]bgp 56002
[R4-bgp]net
[R4-bgp]network 44.0.0.0 30
[R3-bgp]peer 1.1.1.1 next-hop-local
[R3-bgp]peer 2.2.2.2 next-hop-local
[R3-bgp]peer 5.5.5.5 next-hop-local
[R3-bgp]peer 7.7.7.7 next-hop-local
[R7-bgp]peer 1.1.1.1 next-hop-local
[R7-bgp]peer 3.3.3.3 next-hop-local
[R7-bgp]peer 5.5.5.5 next-hop-local
[R7-bgp]peer 6.6.6.6 next-hop-local
[R1]ping -a 11.0.0.1 44.0.0.1
PING 44.0.0.1: 56 data bytes, press CTRL_C to break
Reply from 44.0.0.1: bytes=56 Sequence=1 ttl=253 time=110 ms
Reply from 44.0.0.1: bytes=56 Sequence=2 ttl=253 time=70 ms
Reply from 44.0.0.1: bytes=56 Sequence=3 ttl=253 time=70 ms
Reply from 44.0.0.1: bytes=56 Sequence=4 ttl=253 time=60 ms
Reply from 44.0.0.1: bytes=56 Sequence=5 ttl=253 time=90 ms
--- 44.0.0.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 60/80/110 ms