HCIP 综合实验-2

时间:    分类: 实验   标签: 没有

增强分析和配置中小型企业网络的综合能力

  • 本实验模拟了一个企业网络场景,其中R1 为公司总部的路由,交换机SW1、SW2、SW3 、SW4 ,服务器,终端等设备组成了公司总部的园区网,R2、R3、R4 为公司分部的路由器。
  • 公司总部的园区网划分了不同的VLAN。为了防止二层冗余网络中的环路及提高交换机的防攻击性,每台交换机都需要运行RSTP协议,同时还配置RSTP保护功能。
  • 在公司总部网络中,R1、SW1、SW2 运行OSPF 路由协议,并需要通过OSPF认证功能来提高安全性。由于种种原因,SW3、SW4 不能运行OSPF路由协议,所以网络管理员需要将用户网络段的路由引入OSPF进程,在路由引入的同时还需要实现路由聚合。
  • 公司分部网络使用了 IS-IS路由协议作为IGP,公司总部网络与公司分部网络之间通过 BGP 路由协议实现互通,这些要求在实现步骤中进行具体的说明。

2025-03-16T08:02:14.png

基本配置

R1:

undo terminal monitor
sys
user-interface con 0
idle-timeout 0 0
q
sysname R1
int loop 0
ip add 1.1.1.1 24
int g0/0/0
ip add 192.168.15.1 24
int g0/0/1
ip add 192.168.16.1 24
int g0/0/2
ip add 192.168.12.1 24
int g0/0/3
ip add 192.168.13.1 24
q

R2:

undo terminal monitor
sys
user-interface con 0
idle-timeout 0 0
q
sysname R2
int loop 0
ip add 2.2.2.2 24
int g0/0/0
ip add 192.168.12.2 24
int g0/0/1
ip add 192.168.24.2 24
q

R3:

undo terminal monitor
sys
user-interface con 0
idle-timeout 0 0
q
sysname R3
int loop 0
ip add 3.3.3.3 24
int g0/0/1
ip add 192.168.13.3 24
int g0/0/2
ip add 192.168.34.3 24
q

R4:

undo terminal monitor
sys
user-interface con 0
idle-timeout 0 0
q
sysname R4
int loop 0
ip add 4.4.4.4 24
int loop 1
ip add 44.44.44.44 24
int g0/0/1
ip add 192.168.24.4 24
int g0/0/2
ip add 192.168.34.4 24
q

SW1:

undo terminal monitor
sys
user-interface con 0
idle-timeout 0 0
q
sysname SW1
vlan batch 10 20 30 51 52 110 120 130
int vlanif 20
ip add 50.1.10.1 24
int vlanif 51
ip add 192.168.15.5 24
int vlanif 52
ip add 192.168.56.5 24
q

SW2:

undo terminal monitor
sys
user-interface con 0
idle-timeout 0 0
q
sysname SW2
vlan batch 10 20 30 61 62 110 120 130
int vlanif 110 
ip add 60.1.10.1 24
int vlanif 120
ip add 60.1.20.1 24
int vlanif 130
ip add 60.2.30.1 24
int vlanif 61
ip add 192.168.16.6 24
int vlanif 62
ip add 192.168.56.6 24
q

SW3:

undo terminal monitor
sys
user-interface con 0
idle-timeout 0 0
q
sysname SW3
vlan batch 10 20 30 110 120 130

SW4:

undo terminal monitor
sys
user-interface con 0
idle-timeout 0 0
q
sysname SW4
vlan batch 10 20 30 110 120 130

一、交换部分

1.接口配置为 Access 、Trunk
配置SW1 和SW3 相连接的接口为 access端口,允许VLAN 20 通过
配置SW1 和SW4的接口, 配置SW2 和SW3的接口, 配置SW2和SW4的接口,为Trunk端口,允许VLAN 10、 VLAN 20、VLAN 30、VLAN 110、VLAN 120、VLAN 130通过。

SW1:

int g0/0/2
port link-type access
port default vlan 20
int g0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20 30 110 120 130

SW2

int g0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20 30 110 120 130
int g0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20 30 110 120 130

SW3:

int g0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20 30 110 120 130
int g0/0/2
port link-type access
port default vlan 20

SW4:

int g0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20 30 110 120 130
int g0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20 30 110 120 130
q

在SW1 和SW2 上将两个接口划分到相应的VLAN 中

SW1:

int g0/0/1
port link-type access
port default vlan 52
int g0/0/4
port link-type access
port default vlan 51

SW2:

int g0/0/1
port link-type access
port default vlan 62
int g0/0/4
port link-type access
port default vlan 61

配置完成后在SW1 SW2 上查看VLAN 信息
<SW1>display vlan

2025-03-16T08:06:59.png

<SW1>display ip int bri

2025-03-16T08:07:29.png

<SW2>display ip int bri

2025-03-16T08:07:59.png

Server 2是属于VLAN 110 的,要求Server 2无论从哪个端口接入 SW4 都必须属于VLAN 110,为此,基于MAC地址将Server 2 添加进VLAN 100

2025-03-16T08:08:25.png

SW4:

vlan 110
mac-vlan mac-address 5489-98AC-57B2
int e0/0/1
port hybrid untagged vlan all
mac-vlan enable

查看<SW4>display mac-vlan vlan 110

2025-03-16T08:09:22.png


2.Mux VLAN
公司总部园区中,公司员工和公司客户都可以访问公司的服务器,公司内部员工之间也可以互相交流,但与公司客户之间是隔离的,不能够相互访问。公司客户与客户之间不能互访,客户与公司员工也不能互访。这样的需求可以通过Mux VLAN 来实现:在交换机SW 3 上,配置Server 1 所在的VLAN20 为主VLAN,配置公司员工 PC1 和PC2 所在的VLAN 10 为互通从VLAN,配置公司客户PC3 和PC4所在的VLAN 30 为隔离从VLAN。

SW3:

vlan 20
mux-vlan 
subordinate group 10
subordinate separate 30

int e0/0/1
port link-type access
port default vlan 20
port mux-vlan enable 
int e0/0/2
port link-type access
port default vlan 10
port mux-vlan enable 
int e0/0/3
port link-type access
port default vlan 10
port mux-vlan enable 
int e0/0/4
port link-type access
port default vlan 30
port mux-vlan enable 
int e0/0/5
port link-type access
port default vlan 30
port mux-vlan enable
q

配置完成后,查看Mux VLAN信息

2025-03-16T08:10:51.png

用 ping 相互测试一下
PC1 能ping通PC2,Server, 但不能 ping 通PC3 PC4

2025-03-16T08:11:13.png


3.配置RSTP 协议
为了防止公司总部园区网的二层环路,配置所有的交换机工作在RSTP模式。
SW1 为根交换机,SW2为备份根交换机。

SW1:

stp mode rstp
stp root primary

SW2:

stp mode rstp
stp root secondary

SW3:

stp mode rstp

SW4:

stp mode rstp

配置完成后查看 display stp

2025-03-16T08:13:19.png

为了提高网络的稳定性,可以配置RSTP的根保护功能,使得无论网络发生什么变化,根交换机的角色都不会改变。根保护是指定端口的特性,当端口角色是指定端口时,根保护功能才能生效。

<SW2>display stp brief

2025-03-16T08:14:22.png

SW2:

int g0/0/2
stp root-protection 
int g0/0/3
stp root-protection

SW2的g0/0/4 端口是连接的上行路由器,SW3 SW4的指定端口连接的是PC或服务器,因此这些端口无需配置根保护功能。

如果有攻击者伪造拓扑变化 BPDU报文来恶意攻击二层网络,则交换机在短时间内会收到大量的拓扑变化BPDU报文,这会给交换机的处理工作造成很大的负担。为此,可以通过配置TC-BPDU 保护功能来解决这个问题。

SW1:

stp tc-protection 
stp tc-protection threshold 2

SW2:

stp tc-protection 
stp tc-protection threshold 2

SW3:

stp tc-protection 
stp tc-protection threshold 2

SW4:

stp tc-protection 
stp tc-protection threshold 2

交换机在单位时间内,允许在收到 TC-BPDU 报文后立即进行地址表项删除操作的最大次数为 2 次。

为了加快收敛速度,将交换机SW3 和SW4连接 PC 服务器的端口配置为边缘端口。

SW3:

int e0/0/1
stp edged-port enable 
int e0/0/2
stp edged-port enable 
int e0/0/3
stp edged-port enable 
int e0/0/4
stp edged-port enable 
int e0/0/5
stp edged-port enable 

SW4:

int e0/0/1
stp edged-port enable

交换机的配置工作已经基本完成。


二、路由部分

1.配置 OSPF路由协议

在R1 、SW1和SW2 上配置OSPF

R1:

ospf router-id 1.1.1.1
area 0
network 1.1.1.1 0.0.0.0
network 192.168.15.1 0.0.0.0
network 192.168.16.1 0.0.0.0

SW1:

ospf router-id 5.5.5.5
area 0
network 192.168.15.5 0.0.0.0
network 192.168.56.5 0.0.0.0

SW2:

ospf router-id 6.6.6.6
area 0
network 192.168.16.6 0.0.0.0
network 192.168.56.6 0.0.0.0

在R1 上查看邻居的建立 <R1>display ospf peer brief

2025-03-16T08:17:50.png

OSPF 路由引入

将SW1 上的 VLAN 20 所对应的网段作为外部路由引入OSPF 进程,并进行路由聚合。
将SW2 上VLAN 110 、VLAN 120和VLAN 130 引入进来,并对VLAN 110 、VLAN 120进行路由聚合,VLAN 130 不聚合。

SW1:

ospf
import-route direct
asbr-summary 50.1.0.0 255.255.0.0

SW2:

ospf
import-route direct
asbr-summary 60.1.0.0 255.255.224.0

在R1 上查看效果

2025-03-16T08:19:12.png

OSPF 区域认证
为了提高网络的安全性,R1 SW1 SW2 需要相互通过认证才能交换路由信息。
做OSPF 的区域认证,简单的明文,密钥为 huawei

R1:

ospf
area 0
authentication-mode simple  huawei

SW1:

ospf
area 0
authentication-mode simple  huawei

SW2:

ospf
area 0
authentication-mode simple  huawei

查看一下 <R1>display ospf brief

2025-03-16T08:20:16.png


2.配置 IS-IS 路由协议
在公司分部 R2 R3 R4 上配置,为了减少IS-IS 邻居关系数量和精简链路状态数据库,R2 R3 R4为 level-2路由器

R2:

isis
network-entity 10.0000.0000.0002.00
is-name R2
is-level level-2
int loo 0
isis enable 
int g0/0/1
isis enable 

R3:

isis
network-entity 10.0000.0000.0003.00
is-name R3
is-level level-2
int loo 0
isis enable 
int g0/0/2
isis enable 

R4:

isis
network-entity 10.0000.0000.0004.00
is-name R4
is-level level-2
int loo 0
isis enable 
int loo 1
isis enable 
int g0/0/1
isis enable 
int g0/0/2
isis enable

在R4 上查看 IS-IS 邻居关系
<R4>display isis peer

2025-03-16T08:21:40.png

<R4>display ip routing-table

2025-03-16T08:22:03.png

R4已经通过 IS-IS 协议获得了R2 R3的loopback 0 网段的路由。


3.配置 BGP 路由协议

在R1、R2、R3、R4 上配置 BGP协议,EBGP邻居关系采用直连物理接口来建立,IBGP 邻居关系采用 loopback 0 接口来建立。

R1:

bgp 100
router-id 1.1.1.1
peer 192.168.12.2 as-number 200
peer 192.168.13.3 as-number 200

R2:

bgp 200
router-id 2.2.2.2
peer 192.168.12.1 as-number 100
peer 4.4.4.4 as-number 200
peer 4.4.4.4 connect-interface LoopBack 0
peer 4.4.4.4 next-hop-local 
peer 3.3.3.3 as-number 200
peer 3.3.3.3  connect-interface LoopBack 0
peer 3.3.3.3  next-hop-local 

R3:

bgp 200
router-id 3.3.3.3
peer 192.168.13.1 as-number 100
peer 4.4.4.4 as-number 200
peer 4.4.4.4 connect-interface LoopBack 0
peer 4.4.4.4 next-hop-local 
peer 2.2.2.2 as-number 200
peer 2.2.2.2  connect-interface LoopBack 0
peer 2.2.2.2  next-hop-local 

R4:

bgp 200
router-id 4.4.4.4
peer 2.2.2.2 as-number 200
peer 2.2.2.2 connect-interface LoopBack 0
peer 3.3.3.3 as-number 200
peer 3.3.3.3 connect-interface LoopBack 0

在R4 上查看 BGP 邻居关系

<R4>display bgp peer

2025-03-16T08:23:43.png

路由引入

为了让公司分部知道公司总部网络的路由,在R1 上将OSPF引入BGP进程

R1:

bgp 100
import-route ospf 1

在R2 上查看 IP 路由表<R2>display ip routing-table

公司总部不希望公司分部访问 60.2.30.0/24 网段,因为这是总部财务部门所属的网段,所以公司总部的网络管理员决定在R1 上使用路由策略在引入OSPF路由时过滤掉这个网段的路由。

R1:

acl 2000
rule permit source 60.2.30.0 0.0.0.255
route-policy 10 deny node 1
if-match acl 2000
route-policy 10 permit node 2
bgp 100
import-route ospf 1 route-policy 10

在R4 上查看一下
<R4>display ip routing-table
可以看到 R4 已经学习不到关于 60.2.30.0/24这个网段的路由了

2025-03-16T08:25:21.png

为了能将公司分部的路由信息通告给公司总部,在R2 和R3 上将IS-IS路由引入到BGP 协议

R2:

bgp 200
import-route isis 1

R3:

bgp 200
import-route isis 1

在R1 上查看路由表
<R1>display ip routing-table
R1通过BGP 接收到了公司分部网络的路由

总部交换机SW1 和SW2 由于没有运行BGP路由协议,所以无法获得公司分部网络的路由。为些,可以R1上通过OSPF 非强制方式下发缺省路由,SW1 和SW2通过该缺省路由来访问公司分部网络。OSPF 非强制下发缺省路由的条件是,IP 路由表中存在非OSPF进程的缺省路由。因此,可以在R2 和R3 上配置BGP下发缺省路由给R1,使R1的路由表中存在一条来自BGP的缺省路由。

R1:

ospf
default-route-advertise

R2:

bgp 200
peer 192.168.12.1 default-route-advertise

R3:

bgp 200
peer 192.168.13.1 default-route-advertise

在SW1 SW2 上查看
<SW1>display ip routing-table

2025-03-16T08:27:04.png





注:本文/图片来源于网络,侵删。
若内容涉及版权问题,请点击 发送邮件 联系删除。

添加新评论