02 - 路由网络.note

noteId: 9549148227464A638297B8E1891B1750 · 原始路径:/ALL/世赛题目(练习) - 笔记/考核/1月份考核(第二次考核)/C-模块(只剩 证书、SSLVPN未做完)/02 - 路由网络.note · 图片:22 · 附件待处理:0

 
一、开启 路由转发功能(交换机):
 
1、LEAF-SW-03、LEAF-SW-04、SPINE-SW-01、SPINE-SW-02:
# 全局模式:
ip routing
 
 
·为 VLAN 10、VLAN 20 配置 IP地址:
没找到 vlan 的ip,这里是自定义的IP地址
1、SPINE-SW-01:
SPINE-SW-01(config)#int vlan 10
SPINE-SW-01(config-if)#no sh
SPINE-SW-01(config-if)#ip address 192.168.10.252 255.255.255.0
SPINE-SW-01(config-if)#int vlan 20
SPINE-SW-01(config-if)#no sh
SPINE-SW-01(config-if)#ip address 192.168.20.252 255.255.255.0
 
 
2、SPINE-SW-02:
SPINE-SW-02(config)#int vlan 10
SPINE-SW-02(config-if)#no sh     
SPINE-SW-02(config-if)#ip address 192.168.10.253 255.255.255.0
SPINE-SW-02(config)#int vlan 20
SPINE-SW-02(config-if)#no sh
SPINE-SW-02(config-if)#ip address 192.168.20.253 255.255.255.0
 
 
 
二、配置 OSPF 协议:
 
1、LEAF-SW-03:
 
 
LEAF-SW-03(config)#router ospf 2024
LEAF-SW-03(config-router)#router-id 1.1.1.3 
LEAF-SW-03(config-router)#net 10.0.1.0 255.255.255.0 area 0
LEAF-SW-03(config-router)#net 10.0.2.0 255.255.255.0 area 0
LEAF-SW-03(config-router)#net 10.0.3.0 255.255.255.0 area 0
LEAF-SW-03(config-router)#net 10.1.4.0 255.255.255.0 area 0
LEAF-SW-03(config-router)#net 1.1.1.3 255.255.255.255 area 0
·配置 邻居之间不选举 DR/BDR:
LEAF-SW-03(config-router)#int ra g0/1-3,g1/0
LEAF-SW-03(config-if-range)#ip ospf network point-to-point 
 
 
2、LEAF-SW-04:
 
LEAF-SW-04(config)#router ospf 2024
LEAF-SW-04(config-router)#router-id 1.1.1.4
LEAF-SW-04(config-router)#network 10.1.1.0 255.255.255.0 area 0

LEAF-SW-04(config-router)#network 10.1.2.0 255.255.255.0 area 0

LEAF-SW-04(config-router)#network 10.1.3.0 255.255.255.0 area 0 

LEAF-SW-04(config-router)#network 10.1.4.0 255.255.255.0 area 0

LEAF-SW-04(config-router)#network 1.1.1.4 255.255.255.255 area 0
·配置 邻居之间不选举 DR/BDR:
LEAF-SW-04(config-router)#int ra g0/1-3,g1/0
LEAF-SW-04(config-if-range)#ip ospf network point-to-point 
 
 
3、SPINE-SW-01:
 
SPINE-SW-01(config)#router ospf 2024
SPINE-SW-01(config-router)#router-id 1.1.1.5
SPINE-SW-01(config-router)#network 10.0.1.0 255.255.255.0 area 0
SPINE-SW-01(config-router)#network 10.1.1.0 255.255.255.0 area 0
SPINE-SW-01(config-router)#network 1.1.1.5 255.255.255.255 area 0
·配置 邻居之间不选项 DR/BDR:
SPINE-SW-01(config-router)#int ra g0/3,g1/0
SPINE-SW-01(config-if-range)#ip ospf network point-to-point 
 
·配置 重分发直连(只重分发 VLAN10 和 VLAN20)
SPINE-SW-01(config)#route-map VLAN permit 10
SPINE-SW-01(config-route-map)#match interface Vlan 10
SPINE-SW-01(config-route-map)#exit
SPINE-SW-01(config)#route-map VLAN permit 20
SPINE-SW-01(config-route-map)#match interface Vlan 20
 
SPINE-SW-01(config-route-map)#router ospf 2024
SPINE-SW-01(config-router)#redistribute connected subnets route-map VLANSPINE-SW-02(config)#route-map VLAN permit 10 
 
 
 
4、SPINE-SW-02:
 
SPINE-SW-02(config)#router ospf 2024
SPINE-SW-02(config-router)#router-id 1.1.1.6 
SPINE-SW-02(config-router)#network 10.0.2.0 255.255.255.0 area 0
SPINE-SW-02(config-router)#network 10.1.2.0 255.255.255.0 area 0
SPINE-SW-02(config-router)#network 1.1.1.6 255.255.255.255 area 0
·配置 邻居之间不选项 DR/BDR:
SPINE-SW-02(config-router)#int ra g0/3,g1/0
SPINE-SW-02(config-if-range)#ip ospf network point-to-point 
 
·配置 重分发直连(只重分发 VLAN10 和 VLAN20)
SPINE-SW-02(config)#route-map VLAN permit 10 
SPINE-SW-02(config-route-map)#match interface Vlan 10
SPINE-SW-02(config-route-map)#exit      
SPINE-SW-02(config)#route-map VLAN permit 20
SPINE-SW-02(config-route-map)#match interface Vlan 20
SPINE-SW-02(config)#router ospf 2024
SPINE-SW-02(config-router)#redistribute connected subnets route-map VLAN
 
 
 
5、CORE-RT-01:
CORE-RT-01(config)#router ospf 2024
CORE-RT-01(config-router)#router-id 1.1.1.7
CORE-RT-01(config-router)#network 10.0.3.0 255.255.255.0 area 0
CORE-RT-01(config-router)#network 10.1.4.0 255.255.255.0 area 0
CORE-RT-01(config-router)#network 1.1.1.7 255.255.255.255 area 0
·配置 邻居之间不选举 DR/BDR:
CORE-RT-01(config)#interface range g0/1,g0/3
CORE-RT-01(config-if-range)#ip ospf network point-to-point 
 
 
6、CORE-RT-02:
CORE-RT-02(config)#router ospf 2024
CORE-RT-02(config-router)#router-id 1.1.1.8
CORE-RT-02(config-router)#network 10.1.3.0 255.255.255.0 area 0
CORE-RT-02(config-router)#network 10.1.4.0 255.255.255.0 area 0
CORE-RT-02(config-router)#network 1.1.1.8 255.255.255.255 area 0
·配置 邻居之间不选举 DR/BDR:
CORE-RT-02(config)#interface range g0/1,g0/3
CORE-RT-02(config-if-range)#ip ospf network point-to-point 
 
 
三、配置 GLBP:
 
1、SPINE-SW-01:
(1)VLAN 10:
SPINE-SW-01(config)#int vlan 10
SPINE-SW-01(config-if)#glbp 10 authentication md5 key-string Skills39!
SPINE-SW-01(config-if)#glbp 10 ip 192.168.10.254 
SPINE-SW-01(config-if)#glbp 10 priority 200
SPINE-SW-01(config-if)#glbp 10 preempt 
 
(2)VLAN 20:
SPINE-SW-01(config)#interface vlan 20
SPINE-SW-01(config-if)#glbp 20 authentication md5 key-string Skills39!
SPINE-SW-01(config-if)#glbp 20 ip 192.168.20.254
SPINE-SW-01(config-if)#glbp 20 preempt 
SPINE-SW-01(config-if)#glbp 20 priority 200
 
(3)查看 GLBP 状态:
do show glbp br
 
 
2、SPINE-SW-02:
(1)VLAN 10:
SPINE-SW-02(config)#int vlan 10
SPINE-SW-02(config-if)#glbp 10 authentication md5 key-string Skills39!
SPINE-SW-02(config-if)#glbp 10 ip 192.168.10.254
SPINE-SW-02(config-if)#glbp 10 priority 150
SPINE-SW-02(config-if)#glbp 10 preempt 
 
(2)VLAN 20:
SPINE-SW-02(config)#interface vlan 20
SPINE-SW-02(config-if)#glbp 20 authentication md5 key-string Skills39!
SPINE-SW-02(config-if)#glbp 20 ip 192.168.20.254
SPINE-SW-02(config-if)#glbp 20 preempt 
SPINE-SW-02(config-if)#glbp 20 priority 150
 
 
四、配置 Null 路由、配置 NAT:
 
1、配置 Null 路由:
 
(1)CORE-RT-01:
CORE-RT-01(config)#ip route 193.16.25.0 255.255.255.252 Null 0 
 
 
(2)CORE-RT-02:
CORE-RT-02(config)#ip route 193.16.25.0 255.255.255.252 Null 0
 
 
(3)EDGE-FW:(配置完 ASA防火墙高可用后)
EDGE-FW(config)# route Null0 199.61.52.100 255.255.255.255 
 
 
 
2、配置 NAT:
 
 
 
 
 
 
 
 
五、配置 BGP(BGP联邦、BGP反射器):
 
1、LEAF-SW-03:
 
LEAF-SW-03(config)#router bgp 65013    //设置 AS 号为: 65013
LEAF-SW-03(config-router)#bgp confederation identifier 100    //设置 BGP 联邦标识符为:100
 
# 与 CORE-RT-01 建立 iBGP邻居(BGP联邦)
LEAF-SW-03(config-router)#neighbor 1.1.1.7 remote-as 65013
LEAF-SW-03(config-router)#neighbor 1.1.1.7 update-source Loopback 0 
1、配置 重分发(将 OSPF中 ‘OE2’类型得路由发布到 BGP,要求过滤私有地址段)
·私有地址段:
 
# 配置 ACL ,禁用私有地址网段(过滤私有地址段)
LEAF-SW-03(config)#ip access-list extended BGP
## 因为题目说过滤私有地址段,但没说只匹配 192.168网段,不知道是否会计算分数,所以就写一个最完美的出来,匹配所有私有地址(至少不会被扣分)
LEAF-SW-03(config-ext-nacl)#deny ip 10.0.0.0 0.255.255.255 any     //A类地址 私有地址段
LEAF-SW-03(config-ext-nacl)#deny ip 172.16.0.0 0.16.255.255 any    //B类地址 私有地址段(这里写的没有问题)
LEAF-SW-03(config-ext-nacl)#deny ip 192.168.0.0 0.0.255.255 any    //C类地址 私有地址段(这里写的也没有问题)
LEAF-SW-03(config-ext-nacl)#exit
 
# 配置 route-map 引用 ACL,因为 BGP 不能直接引用 ACL
LEAF-SW-03(config)#route-map BGP permit 10
LEAF-SW-03(config-route-map)#match ip address BGP
LEAF-SW-03(config-route-map)#exit                 
 
# 配置 BGP 路由重分发
LEAF-SW-03(config-router)#redistribute ospf 2024 match external 2 route-map BGP 
 
 
 
2、LEAF-SW-04:
 
LEAF-SW-04(config)#router bgp 65024
LEAF-SW-04(config-router)#bgp confederation identifier 100
 
# 与CORE-RT-02建立 iBGP邻居
LEAF-SW-04(config-router)#neighbor 1.1.1.8 remote-as 65024
LEAF-SW-04(config-router)#neighbor 1.1.1.8 update-source Loopback 0
 
1、配置 重分发(将 OSPF中 ‘OE2’类型得路由发布到 BGP,要求过滤私有地址段)
# 配置 ACL ,过滤私有地址段
LEAF-SW-04(config)#ip access-list extended BGP 
LEAF-SW-04(config-ext-nacl)#deny ip 10.0.0.0 0.255.255.255 any 
LEAF-SW-04(config-ext-nacl)#deny ip 172.16.0.0 0.16.255.255 any
LEAF-SW-04(config-ext-nacl)#deny ip 192.168.0.0 0.0.255.255 any
LEAF-SW-04(config-ext-nacl)#exit
 
# 配置 route-map ,关联 ACL
LEAF-SW-04(config)#route-map BGP          
LEAF-SW-04(config-route-map)#match ip address BGP
LEAF-SW-04(config-route-map)#exit
 
# 配置 BGP 路由重分发
LEAF-SW-04(config)#router bgp 65024
LEAF-SW-04(config-router)#redistribute ospf 2024 match external 2 route-map BGP
LEAF-SW-04(config-router)#exit
 
 
 
3、CORE-RT-01:
CORE-RT-01(config)#router bgp 65013
CORE-RT-01(config-router)#bgp confederation identifier 100
 
# 与 LEAF-SW-03 建立 iBGP邻居(BGP联邦)
CORE-RT-01(config-router)#neighbor 1.1.1.3 remote-as 65013
CORE-RT-01(config-router)#neighbor 1.1.1.3 update-source Loopback 0
 
# 与 CORE-RT-02 建立 eBGP邻居(BGP联邦)
CORE-RT-01(config-router)#bgp confederation peers 65024
CORE-RT-01(config-router)#neighbor 1.1.1.8 remote-as 65024
CORE-RT-01(config-router)#neighbor 1.1.1.8 update-source Loopback 0
CORE-RT-01(config-router)#neighbor 1.1.1.8 ebgp-multihop 2
 
# 与 EDGE-RT-01 建立 eBGP 邻居
CORE-RT-01(config-router)#neighbor 101.47.24.2 remote-as 8888    //就一条(没有少输入)
·路由通告:(通告进 BGP 的路由必须要在 IGP路由表中 真实存在)
 
# 通告 Null0 路由
CORE-RT-01(config-router)#network 193.16.25.0 mask 255.255.255.252 
 
# 通告 Loopback0 路由
CORE-RT-01(config-router)#network 1.1.1.7 mask 255.255.255.255
 
# 查看 BGP 路由表:
do show bgp
 
 
 
 
4、CORE-RT-02:
CORE-RT-02(config)#router bgp 65024
CORE-RT-02(config-router)#bgp confederation identifier 100
 
# 与 LEAF-SW-04 建立 iBGP邻居(BGP联邦)
CORE-RT-02(config-router)#neighbor 1.1.1.4 remote-as 65024
CORE-RT-02(config-router)#neighbor 1.1.1.4 update-source Loopback 0
 
# 与 CORE-RT-01 建立 eBGP邻居(BGP联邦)
CORE-RT-02(config-router)#bgp confederation peers 65013
CORE-RT-02(config-router)#neighbor 1.1.1.7 remote-as 65013
CORE-RT-02(config-router)#neighbor 1.1.1.7 update-source Loopback 0
CORE-RT-02(config-router)#neighbor 1.1.1.7 ebgp-multihop 2
 
# 与 EDGE-RT-01 建立 eBGP 邻居:
CORE-RT-02(config-router)#neighbor 102.47.24.2 remote-as 8888
 
·路由通告:
# 通告 Null0 路由
CORE-RT-02(config-router)#network 193.16.25.0 mask 255.255.255.252 
 
# 通告 Loopback0 路由
CORE-RT-02(config-router)#network 1.1.1.8 mask 255.255.255.255
 
 
 
5、EDGE-RT-01:
EDGE-RT-01(config)#router bgp 8888
 
# 与 CORE-RT-01 建立 eBGP 邻居
EDGE-RT-01(config-router)#neighbor 101.47.24.1 remote-as 100    //题目没有要求使用 Loopback 接口,那么就使用 Gig接口IP地址
 
# 与 CORE-RT-02 建立 eBGP 邻居
EDGE-RT-01(config-router)#neighbor 102.47.24.1 remote-as 100
 
# 与 EDGE-RT-02 建立 eBGP 邻居
EDGE-RT-01(config-router)#neighbor 201.102.22.1 remote-as 200
 
# 与 EDGE-RT-03 建立 eBGP 邻居
EDGE-RT-01(config-router)#neighbor 211.34.33.1 remote-as 300
 
# 与 EDGE-RT-04 建立 eBGP 邻居
EDGE-RT-01(config-router)#neighbor 211.34.44.1 remote-as 300 
·路由通告:
 
# 查看所有接口信息:
EDGE-RT-01(config)#do show ip int br
 
# 通告所有接口:
EDGE-RT-01(config)#router bgp 8888
EDGE-RT-01(config-router)#network 10.255.255.0 mask 255.255.255.0 
EDGE-RT-01(config-router)#network 101.47.24.0 mask 255.255.255.0 
EDGE-RT-01(config-router)#network 102.47.24.0 mask 255.255.255.0
EDGE-RT-01(config-router)#network 211.34.33.0 mask 255.255.255.0
EDGE-RT-01(config-router)#network 211.34.44.0 mask 255.255.255.0
EDGE-RT-01(config-router)#network 201.102.22.0 mask 255.255.255.0
EDGE-RT-01(config-router)#network 1.1.1.9 mask 255.255.255.255
 
# 查看 BGP 路由表:
EDGE-RT-01(config-router)#do show bgp
 
 
 
6、EDGE-RT-02:
EDGE-RT-02(config)#router bgp 200
 
# 与 EDGE-RT-01 建立 eBGP 邻居
EDGE-RT-02(config-router)#neighbor 201.102.22.2 remote-as 8888
·路由通告:
# 通告 Loopback0
EDGE-RT-02(config)#router bgp 200
EDGE-RT-02(config-router)#network 1.1.1.10 mask 255.255.255.255
 
 
 
7、EDGE-RT-03:
EDGE-RT-03(config)#router bgp 300
 
# 与 EDGE-RT-01 建立 eBGP 邻居
EDGE-RT-03(config-router)#neighbor 211.34.33.2 remote-as 8888
 
# 与 EDGE-RT-05 建立 iBGP 邻居
EDGE-RT-03(config-router)#neighbor 35.16.19.2 remote-as 300
·路由通告:
EDGE-RT-03(config)#router bgp 300
 
# 通告 Gig0/1:
EDGE-RT-03(config-router)#network 35.16.19.0 mask 255.255.255.0
 
# 通告 Loopback0:
EDGE-RT-03(config-router)#network 1.1.1.11 mask 255.255.255.255
 
 
 
8、EDGE-RT-04:
EDGE-RT-04(config)#router bgp 300
 
# 与 EDGE-RT-01 建立 eBGP 邻居
EDGE-RT-04(config-router)#neighbor 211.34.44.2 remote-as 8888
 
# 与 EDGE-RT-05 建立 iBGP 邻居
EDGE-RT-04(config-router)#neighbor 45.19.16.2 remote-as 300
·路由通告:
EDGE-RT-04(config)#router bgp 300
 
# 通告 Gig0/1
EDGE-RT-04(config-router)#network 45.19.16.0 mask 255.255.255.0
 
# 通告 Loopback0
EDGE-RT-04(config-router)#network 1.1.1.12 mask 255.255.255.255
 
 
 
9、EDGE-RT-05(配置 BGP 反射器):
EDGE-RT-05(config)#router bgp 300
 
# 与 EDGE-RT-03 建立 iBGP 邻居
EDGE-RT-05(config-router)#neighbor 35.16.19.1 remote-as 300
 
# 与 EDGE-RT-03 建立 iBGP 邻居
EDGE-RT-05(config-router)#neighbor 45.19.16.1 remote-as 300
 
# 与 EDGE-FW 建立 iBGP 邻居
EDGE-RT-05(config-router)#neighbor 188.20.24.102 remote-as 300
·配置 BGP反射器:
# 配置 BGP 反射器
EDGE-RT-05(config-router)#neighbor 35.16.19.1 route-reflector-client     //设置 EDGE-RT-03 为 BGP反射器 客户端
EDGE-RT-05(config-router)#neighbor 45.19.16.1 route-reflector-client     //设置 EDGE-RT-04 为 BGP反射器 客户端
EDGE-RT-05(config-router)#neighbor 188.20.24.102 route-reflector-client  //设置 EDGE-FW 为 BGP反射器客户端
·路由通告:
 
EDGE-RT-05(config)#router bgp 300
 
# 通告 Gig0/3
EDGE-RT-05(config-router)#network 188.20.24.0 mask 255.255.255.0
 
# 通告 Loopback0
EDGE-RT-05(config-router)#network 1.1.1.13 mask 255.255.255.255
 
 
 
10、EDGE-FW:(配置完 ASA防火墙高可用后)【完成04 - ASA防火墙 基础配置后】
# 与 EDGE-RT-05 建立 iBGP 邻居
EDGE-FW(config)# router bgp 300
EDGE-FW(config-router)# address-family ipv4 unicast 
EDGE-FW(config-router-af)# neighbor 188.20.24.1 remote-as 300
·路由通告:
EDGE-FW(config)# router bgp 300
EDGE-FW(config-router)# address-family ipv4 unicast 
EDGE-FW(config-router-af)# network 199.61.52.100 mask 255.255.255.255 
 
 
 
 
六、对于 BGP 的微调:
 
1、将 从 eBGP 接收的 路由,在传输给 iBGP时,将其下一跳设为自身:
 
(1)CORE-RT-01:
CORE-RT-01(config)#router bgp 65013
CORE-RT-01(config-router)#neighbor 1.1.1.3 next-hop-self 
 
 
(2)CORE-RT-02:
CORE-RT-02(config)#router bgp 65024
CORE-RT-02(config-router)#neighbor 1.1.1.4 next-hop-self 
 
 
 
(3)EDGE-RT-03:
EDGE-RT-03(config)#router bgp 300
EDGE-RT-03(config-router)#neighbor 35.16.19.2 next-hop-self 
 
 
 
(4)EDGE-RT-04:
EDGE-RT-04(config)#router bgp 300
EDGE-RT-04(config-router)#neighbor 45.19.16.2 next-hop-self