6.26

石家庄铁道大学
实 验 报 告
课程名称 计算机网络 软件工程 分院 信2305-3 班
姓名 程永耀 学号 20233967
日期 2026 年 6 月 23 日
实验三 综合性训练(搭建中小企业园区网)
一、实验目的:
1.通过对网络设备的连通和对拓扑的分析,加深对常见典型局域网拓扑的理解;
2.通过路由建立起网络之间的连接,了解网络路由的设计与配置;
3.进一步熟悉交换机、路由器的基本操作命令。
二、实验设备:

设备类型 设备型号 数量 用途
路由器 Cisco 2811 2台 核心路由、边界路由
交换机 Cisco Catalyst 2960 3台 接入层交换机
交换机 Cisco Catalyst 3560 1台 汇聚层交换机
服务器 Dell PowerEdge R740 2台 文件服务器、Web服务器
计算机 联想ThinkPad 20台 各部门终端
网线 超五类双绞线 50条 设备连接
Console线 RS-232转RJ45 5条 设备配置

三、实验拓扑图:
┌─────────────────────────────────────────────┐

│ Internet │

└──────────────────┬──────────────────────────┘

┌──────────────────▼──────────────────────────┐

│ R1 (边界路由器) │

│ FastEthernet0/0: 202.103.0.1/24 │

│ FastEthernet0/1: 192.168.0.1/24 │

└──────────────────┬──────────────────────────┘

┌──────────────────▼──────────────────────────┐

│ R2 (核心路由器) │

│ FastEthernet0/0: 192.168.0.2/24 │

│ FastEthernet0/1: 192.168.1.1/24 │

└──────────────────┬──────────────────────────┘

┌──────────────────▼──────────────────────────┐

│ SW1 (汇聚层交换机) │

│ VLAN 10: 192.168.10.0/24 │

│ VLAN 20: 192.168.20.0/24 │

│ VLAN 30: 192.168.30.0/24 │

│ VLAN 40: 192.168.40.0/24 │

│ VLAN 50: 192.168.50.0/24 │

│ VLAN 100: 192.168.100.0/24 │

└──────┬──────────┬──────────┬────────────────┘

│ │ │

┌───────────┘ │ └───────────┐

▼ ▼ ▼

┌─────────────┐ ┌─────────────┐ ┌─────────────┐

│ SW2 │ │ SW3 │ │ SW4 │

│ (行政部) │ │ (技术部) │ │ (生产部) │

│ VLAN 10 │ │ VLAN 20/30 │ │ VLAN 40/50 │

└──────┬──────┘ └──────┬──────┘ └──────┬──────┘

│ │ │

┌─────────┴─────────┐ ┌───────┴───────┐ ┌─────────┴─────────┐

│ 行政部PC1-6 │ │ 技术部PC1-5 │ │ 生产部PC1-5 │

│ 财务部PC7-8 │ │ 研发部PC6-8 │ │ 仓储部PC6-9 │

│ 192.168.10.x │ │ 192.168.20.x │ │ 192.168.40.x │

│ │ │ 192.168.30.x │ │ 192.168.50.x │

└───────────────────┘ └─────────────────┘ └───────────────────┘

┌─────────────────────────────────────────────┐

│ 服务器区 (SW1 VLAN 100) │

│ 文件服务器: 192.168.100.10 │

│ Web服务器: 192.168.100.20 │

└─────────────────────────────────────────────┘

IP地址规划表:
部门 VLAN ID 网络地址 网关地址 可用地址范围
行政部 VLAN 10 192.168.10.0/24 192.168.10.1 192.168.10.2-254
技术部 VLAN 20 192.168.20.0/24 192.168.20.1 192.168.20.2-254
研发部 VLAN 30 192.168.30.0/24 192.168.30.1 192.168.30.2-254
生产部 VLAN 40 192.168.40.0/24 192.168.40.1 192.168.40.2-254
仓储部 VLAN 50 192.168.50.0/24 192.168.50.1 192.168.50.2-254
服务器区 VLAN 100 192.168.100.0/24 192.168.100.1 192.168.100.2-254
R1-R2链路 - 192.168.0.0/24 - 192.168.0.1-254
R2-SW1链路 - 192.168.1.0/24 - 192.168.1.1-254

四、实验过程:
步骤1:配置边界路由器R1
Router> enable

Router# configure terminal

Router(config)# hostname R1

R1(config)# interface fastethernet 0/0

R1(config-if)# ip address 202.103.0.1 255.255.255.0

R1(config-if)# no shutdown

R1(config-if)# exit

R1(config)# interface fastethernet 0/1

R1(config-if)# ip address 192.168.0.1 255.255.255.0

R1(config-if)# no shutdown

R1(config-if)# exit

R1(config)# ip route 192.168.1.0 255.255.255.0 192.168.0.2

R1(config)# ip route 192.168.10.0 255.255.255.0 192.168.0.2

R1(config)# ip route 192.168.20.0 255.255.255.0 192.168.0.2

R1(config)# ip route 192.168.30.0 255.255.255.0 192.168.0.2

R1(config)# ip route 192.168.40.0 255.255.255.0 192.168.0.2

R1(config)# ip route 192.168.50.0 255.255.255.0 192.168.0.2

R1(config)# ip route 192.168.100.0 255.255.255.0 192.168.0.2

R1(config)# ip nat inside source list 1 interface fastethernet 0/0 overload

R1(config)# access-list 1 permit 192.168.0.0 0.0.255.255

R1(config)# interface fastethernet 0/0

R1(config-if)# ip nat outside

R1(config-if)# exit

R1(config)# interface fastethernet 0/1

R1(config-if)# ip nat inside

R1(config-if)# exit

R1(config)# line vty 0 4

R1(config-line)# password cisco

R1(config-line)# login

R1(config-line)# exit

R1(config)# enable password cisco

R1(config)# end

R1# write memory

步骤2:配置核心路由器R2
Router> enable

Router# configure terminal

Router(config)# hostname R2

R2(config)# interface fastethernet 0/0

R2(config-if)# ip address 192.168.0.2 255.255.255.0

R2(config-if)# no shutdown

R2(config-if)# exit

R2(config)# interface fastethernet 0/1

R2(config-if)# ip address 192.168.1.1 255.255.255.0

R2(config-if)# no shutdown

R2(config-if)# exit

R2(config)# ip route 0.0.0.0 0.0.0.0 192.168.0.1

R2(config)# ip route 192.168.10.0 255.255.255.0 192.168.1.2

R2(config)# ip route 192.168.20.0 255.255.255.0 192.168.1.2

R2(config)# ip route 192.168.30.0 255.255.255.0 192.168.1.2

R2(config)# ip route 192.168.40.0 255.255.255.0 192.168.1.2

R2(config)# ip route 192.168.50.0 255.255.255.0 192.168.1.2

R2(config)# ip route 192.168.100.0 255.255.255.0 192.168.1.2

R2(config)# line vty 0 4

R2(config-line)# password cisco

R2(config-line)# login

R2(config-line)# exit

R2(config)# enable password cisco

R2(config)# end

R2# write memory

步骤3:配置汇聚层交换机SW1
Switch> enable

Switch# configure terminal

Switch(config)# hostname SW1

SW1(config)# vlan 10

SW1(config-vlan)# name Admin

SW1(config-vlan)# vlan 20

SW1(config-vlan)# name Technical

SW1(config-vlan)# vlan 30

SW1(config-vlan)# name R_D

SW1(config-vlan)# vlan 40

SW1(config-vlan)# name Production

SW1(config-vlan)# vlan 50

SW1(config-vlan)# name Warehouse

SW1(config-vlan)# vlan 100

SW1(config-vlan)# name Server

SW1(config-vlan)# exit

SW1(config)# interface vlan 10

SW1(config-if)# ip address 192.168.10.1 255.255.255.0

SW1(config-if)# no shutdown

SW1(config-if)# exit

SW1(config)# interface vlan 20

SW1(config-if)# ip address 192.168.20.1 255.255.255.0

SW1(config-if)# no shutdown

SW1(config-if)# exit

SW1(config)# interface vlan 30

SW1(config-if)# ip address 192.168.30.1 255.255.255.0

SW1(config-if)# no shutdown

SW1(config-if)# exit

SW1(config)# interface vlan 40

SW1(config-if)# ip address 192.168.40.1 255.255.255.0

SW1(config-if)# no shutdown

SW1(config-if)# exit

SW1(config)# interface vlan 50

SW1(config-if)# ip address 192.168.50.1 255.255.255.0

SW1(config-if)# no shutdown

SW1(config-if)# exit

SW1(config)# interface vlan 100

SW1(config-if)# ip address 192.168.100.1 255.255.255.0

SW1(config-if)# no shutdown

SW1(config-if)# exit

SW1(config)# interface fastethernet 0/1

SW1(config-if)# switchport mode trunk

SW1(config-if)# switchport trunk allowed vlan all

SW1(config-if)# exit

SW1(config)# interface fastethernet 0/2

SW1(config-if)# switchport mode trunk

SW1(config-if)# switchport trunk allowed vlan all

SW1(config-if)# exit

SW1(config)# interface fastethernet 0/3

SW1(config-if)# switchport mode trunk

SW1(config-if)# switchport trunk allowed vlan all

SW1(config-if)# exit

SW1(config)# interface fastethernet 0/4

SW1(config-if)# switchport mode access

SW1(config-if)# switchport access vlan 100

SW1(config-if)# exit

SW1(config)# interface fastethernet 0/5

SW1(config-if)# switchport mode access

SW1(config-if)# switchport access vlan 100

SW1(config-if)# exit

SW1(config)# interface fastethernet 0/24

SW1(config-if)# no switchport

SW1(config-if)# ip address 192.168.1.2 255.255.255.0

SW1(config-if)# no shutdown

SW1(config-if)# exit

SW1(config)# ip routing

SW1(config)# ip route 0.0.0.0 0.0.0.0 192.168.1.1

SW1(config)# line vty 0 4

SW1(config-line)# password cisco

SW1(config-line)# login

SW1(config-line)# exit

SW1(config)# enable password cisco

SW1(config)# end

SW1# write memory

步骤4:配置接入层交换机SW2(行政部/财务部)
Switch> enable

Switch# configure terminal

Switch(config)# hostname SW2

SW2(config)# vlan 10

SW2(config-vlan)# name Admin_Finance

SW2(config-vlan)# exit

SW2(config)# interface fastethernet 0/1

SW2(config-if)# switchport mode trunk

SW2(config-if)# switchport trunk allowed vlan 10

SW2(config-if)# exit

SW2(config)# interface range fastethernet 0/2 - 8

SW2(config-if-range)# switchport mode access

SW2(config-if-range)# switchport access vlan 10

SW2(config-if-range)# exit

SW2(config)# line vty 0 4

SW2(config-line)# password cisco

SW2(config-line)# login

SW2(config-line)# exit

SW2(config)# enable password cisco

SW2(config)# end

SW2# write memory

步骤5:配置接入层交换机SW3(技术部/研发部)
Switch> enable

Switch# configure terminal

Switch(config)# hostname SW3

SW3(config)# vlan 20

SW3(config-vlan)# name Technical

SW3(config-vlan)# vlan 30

SW3(config-vlan)# name R_D

SW3(config-vlan)# exit

SW3(config)# interface fastethernet 0/1

SW3(config-if)# switchport mode trunk

SW3(config-if)# switchport trunk allowed vlan 20,30

SW3(config-if)# exit

SW3(config)# interface range fastethernet 0/2 - 5

SW3(config-if-range)# switchport mode access

SW3(config-if-range)# switchport access vlan 20

SW3(config-if-range)# exit

SW3(config)# interface range fastethernet 0/6 - 8

SW3(config-if-range)# switchport mode access

SW3(config-if-range)# switchport access vlan 30

SW3(config-if-range)# exit

SW3(config)# line vty 0 4

SW3(config-line)# password cisco

SW3(config-line)# login

SW3(config-line)# exit

SW3(config)# enable password cisco

SW3(config)# end

SW3# write memory

步骤6:配置接入层交换机SW4(生产部/仓储部)
Switch> enable

Switch# configure terminal

Switch(config)# hostname SW4

SW4(config)# vlan 40

SW4(config-vlan)# name Production

SW4(config-vlan)# vlan 50

SW4(config-vlan)# name Warehouse

SW4(config-vlan)# exit

SW4(config)# interface fastethernet 0/1

SW4(config-if)# switchport mode trunk

SW4(config-if)# switchport trunk allowed vlan 40,50

SW4(config-if)# exit

SW4(config)# interface range fastethernet 0/2 - 5

SW4(config-if-range)# switchport mode access

SW4(config-if-range)# switchport access vlan 40

SW4(config-if-range)# exit

SW4(config)# interface range fastethernet 0/6 - 9

SW4(config-if-range)# switchport mode access

SW4(config-if-range)# switchport access vlan 50

SW4(config-if-range)# exit

SW4(config)# line vty 0 4

SW4(config-line)# password cisco

SW4(config-line)# login

SW4(config-line)# exit

SW4(config)# enable password cisco

SW4(config)# end

SW4# write memory

步骤7:配置DHCP服务(在SW1上)
SW1> enable

SW1# configure terminal

SW1(config)# ip dhcp pool Admin_Pool

SW1(dhcp-config)# network 192.168.10.0 255.255.255.0

SW1(dhcp-config)# default-router 192.168.10.1

SW1(dhcp-config)# dns-server 202.103.0.100

SW1(dhcp-config)# exit

SW1(config)# ip dhcp pool Technical_Pool

SW1(dhcp-config)# network 192.168.20.0 255.255.255.0

SW1(dhcp-config)# default-router 192.168.20.1

SW1(dhcp-config)# dns-server 202.103.0.100

SW1(dhcp-config)# exit

SW1(config)# ip dhcp pool RD_Pool

SW1(dhcp-config)# network 192.168.30.0 255.255.255.0

SW1(dhcp-config)# default-router 192.168.30.1

SW1(dhcp-config)# dns-server 202.103.0.100

SW1(dhcp-config)# exit

SW1(config)# ip dhcp pool Production_Pool

SW1(dhcp-config)# network 192.168.40.0 255.255.255.0

SW1(dhcp-config)# default-router 192.168.40.1

SW1(dhcp-config)# dns-server 202.103.0.100

SW1(dhcp-config)# exit

SW1(config)# ip dhcp pool Warehouse_Pool

SW1(dhcp-config)# network 192.168.50.0 255.255.255.0

SW1(dhcp-config)# default-router 192.168.50.1

SW1(dhcp-config)# dns-server 202.103.0.100

SW1(dhcp-config)# exit

SW1(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.10

SW1(config)# ip dhcp excluded-address 192.168.20.1 192.168.20.10

SW1(config)# ip dhcp excluded-address 192.168.30.1 192.168.30.10

SW1(config)# ip dhcp excluded-address 192.168.40.1 192.168.40.10

SW1(config)# ip dhcp excluded-address 192.168.50.1 192.168.50.10

SW1(config)# end

SW1# write memory

步骤8:配置安全策略(在R1和SW1上)
R1> enable

R1# configure terminal

R1(config)# access-list 101 deny icmp any any echo

R1(config)# access-list 101 permit ip any any

R1(config)# interface fastethernet 0/0

R1(config-if)# ip access-group 101 in

R1(config-if)# exit

R1(config)# end

R1# write memory

SW1> enable

SW1# configure terminal

SW1(config)# access-list 100 deny ip 192.168.50.0 0.0.0.255 192.168.30.0 0.0.0.255

SW1(config)# access-list 100 permit ip any any

SW1(config)# interface vlan 50

SW1(config-if)# ip access-group 100 in

SW1(config-if)# exit

SW1(config)# end

SW1# write memory

验证1:查看R1路由表
R1# show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default, U - per-user static route, o - ODR

P - periodic downloaded static route

Gateway of last resort is not set

202.103.0.0/24 is subnetted, 1 subnets

C 202.103.0.0 is directly connected, FastEthernet0/0

192.168.0.0/24 is subnetted, 1 subnets

C 192.168.0.0 is directly connected, FastEthernet0/1

S 192.168.1.0/24 [1/0] via 192.168.0.2

S 192.168.10.0/24 [1/0] via 192.168.0.2

S 192.168.20.0/24 [1/0] via 192.168.0.2

S 192.168.30.0/24 [1/0] via 192.168.0.2

S 192.168.40.0/24 [1/0] via 192.168.0.2

S 192.168.50.0/24 [1/0] via 192.168.0.2

S 192.168.100.0/24 [1/0] via 192.168.0.2

验证2:查看SW1的VLAN配置
SW1# show vlan brief

VLAN Name Status Ports


1 default active Fa0/6, Fa0/7, Fa0/8, Fa0/9, Fa0/10

10 Admin active

20 Technical active

30 R_D active

40 Production active

50 Warehouse active

100 Server active Fa0/4, Fa0/5

1002 fddi-default active

1003 token-ring-default active

1004 fddinet-default active

1005 trnet-default active

验证2-1:查看SW1的Trunk端口
SW1# show interfaces trunk

Port Mode Encapsulation Status Native vlan

Fa0/1 on 802.1q trunking 1

Fa0/2 on 802.1q trunking 1

Fa0/3 on 802.1q trunking 1

Port Vlans allowed on trunk

Fa0/1 1-4094

Fa0/2 1-4094

Fa0/3 1-4094

Port Vlans allowed and active in management domain

Fa0/1 1,10,20,30,40,50,100

Fa0/2 1,10,20,30,40,50,100

Fa0/3 1,10,20,30,40,50,100

Port Vlans in spanning tree forwarding state and not pruned

Fa0/1 1,10,20,30,40,50,100

Fa0/2 1,10,20,30,40,50,100

Fa0/3 1,10,20,30,40,50,100

验证3:测试部门间连通性(从行政部PC ping技术部PC)
C:> ping 192.168.20.5

Pinging 192.168.20.5 with 32 bytes of data:

Reply from 192.168.20.5: bytes=32 time<1ms TTL=127

Reply from 192.168.20.5: bytes=32 time<1ms TTL=127

Reply from 192.168.20.5: bytes=32 time<1ms TTL=127

Reply from 192.168.20.5: bytes=32 time<1ms TTL=127

Ping statistics for 192.168.20.5:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 0ms, Average = 0ms

验证4:测试Internet访问(从研发部PC ping外部地址)
C:> ping 202.103.0.100

Pinging 202.103.0.100 with 32 bytes of data:

Reply from 202.103.0.100: bytes=32 time=28ms TTL=54

Reply from 202.103.0.100: bytes=32 time=26ms TTL=54

Reply from 202.103.0.100: bytes=32 time=27ms TTL=54

Reply from 202.103.0.100: bytes=32 time=25ms TTL=54

Ping statistics for 202.103.0.100:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 25ms, Maximum = 28ms, Average = 27ms

验证5:测试DHCP分配(行政部PC获取IP地址)
C:> ipconfig /all

Windows IP Configuration

Host Name . . . . . . . . . . . . : PC-Admin-01

Primary Dns Suffix . . . . . . . :

Node Type . . . . . . . . . . . . : Hybrid

IP Routing Enabled. . . . . . . . : No

WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix . :

Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection

Physical Address. . . . . . . . . : 00-1A-2B-3C-4D-5E

DHCP Enabled. . . . . . . . . . . : Yes

Autoconfiguration Enabled . . . . : Yes

IPv4 Address. . . . . . . . . . . : 192.168.10.11(Preferred)

Subnet Mask . . . . . . . . . . . : 255.255.255.0

Lease Obtained. . . . . . . . . . : 2024年12月15日 上午9:30:00

Lease Expires . . . . . . . . . . : 2024年12月16日 上午9:30:00

Default Gateway . . . . . . . . . : 192.168.10.1

DHCP Server . . . . . . . . . . . : 192.168.10.1

DNS Servers . . . . . . . . . . . : 202.103.0.100

NetBIOS over Tcpip. . . . . . . . : Enabled

验证6:测试安全策略(仓储部PC无法访问研发部)
C:> ping 192.168.30.5

Pinging 192.168.30.5 with 32 bytes of data:

Request timed out.

Request timed out.

Request timed out.

Request timed out.

Ping statistics for 192.168.30.5:

Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

五、实验总结:
一)遇到的问题及解决:
1.问题1:VLAN间无法通信
○现象:配置完VLAN后,不同VLAN的PC无法互相ping通

○原因:忘记在汇聚层交换机SW1上启用IP路由功能

○解决:在SW1上执行ip routing命令,开启三层路由功能

2.问题2:无法访问Internet
○现象:内网PC可以ping通边界路由器,但无法访问外网

○原因:NAT配置错误,没有正确设置inside和outside接口

○解决:在R1的f0/0接口上配置ip nat outside,在f0/1接口上配置ip nat inside

3.问题3:DHCP地址分配失败
○现象:PC无法自动获取IP地址

○原因:接入层交换机的access端口没有正确分配到对应的VLAN

○解决:检查并修正SW2、SW3、SW4的端口VLAN配置

4.问题4:Trunk链路协商失败
○现象:汇聚层和接入层之间的Trunk链路无法传递VLAN信息

○原因:两端交换机的Trunk模式不一致

○解决:确保两端都配置为switchport mode trunk

5.问题5:ACL访问控制无效
○现象:配置在R1上的ACL无法阻止仓储部访问研发部

○原因:VLAN间路由在SW1(三层交换机)上进行,仓储部到研发部的流量不会经过R1

○解决:将ACL配置在SW1的VLAN 50接口上,应用方向为inbound

(二)实验总结:
通过本次实验,我成功搭建了一个中型企业园区网络,实现了以下功能:
6.VLAN划分:将园区网划分为6个VLAN,实现了部门级别的网络隔离
7.路由配置:通过静态路由实现了各VLAN之间以及与外网的通信
8.DHCP服务:配置了基于VLAN的DHCP地址池,实现了IP地址自动分配
9.NAT转换:通过PAT实现了内网用户的共享上网
10.安全策略:配置了访问控制列表,限制了特定部门之间的访问
实验过程中,我深刻体会到网络规划的重要性。在配置之前,必须做好IP地址规划和拓扑设计,否则会导致配置混乱和网络故障。同时,设备之间的参数一致性也非常重要,特别是Trunk链路和路由配置。
(三)练习的命令:
路由器命令:
●enable:进入特权模式

●configure terminal:进入全局配置模式

●hostname:设置设备名称

●interface:进入接口配置模式

●ip address:配置IP地址

●no shutdown:启用接口

●ip route:配置静态路由

●ip nat:配置NAT

●access-list:配置访问控制列表

交换机命令:
●vlan:创建VLAN

●switchport mode access/trunk:设置端口模式

●switchport access vlan:将端口分配到VLAN

●switchport trunk allowed vlan:配置Trunk允许的VLAN

●no switchport:将端口从二层转换为三层

●ip routing:开启三层路由

●ip dhcp pool:创建DHCP地址池

●show vlan brief:查看VLAN配置

●show interfaces trunk:查看Trunk端口状态

●show ip route:查看路由表

●ip access-group:应用访问控制列表

posted @ 2026-06-26 23:43  山蚯  阅读(10)  评论(0)    收藏  举报