实验十二 小型校园网的设计与组建
12.1 实验目的
计算机网络是一门实践性较强的技术,课堂教学应该和实践环节紧密结合。计算机网络
实验培养学生具有独立进行计算机网络架构和设计能力,提高学生的网络设备使用水平,以
及将理论与实践相结合的能力。
12.2 实验环境及设备
2 台路由器、2 台交换机、3 台 PC 机
12.3 实验的内容和要求
根据要求,设计并搭建一个校园网。要求进行子网划分和结构设计,并将网络结构建立
起来。最后完成网络设备的调试。
12.4 实验说明
某大学分为总校和分校,为该校设计校园网,总校有一个局域网共 20 台计算机,分校
由 VLAN 划分为两个局域网,分别有 10 台计算机。该校被分配了一个 C 类网段 210.100.10.0,
总校和分校各有一台路由器及一台交换机。请进行网络设计,将总校和分校各个局域网连接
起来。
根据要求,设计 IP 地址分配表,设计网络结构,画出网络拓扑图。
根据设计搭建网络结构。
配置网络设备,完成网络调试。
提示:
1)使用 IP 子网掩码的原理设计 IP 地址分配表。
2)用到的设备为两台路由器,以及两台交换机。
思考:
1)要使总校局域网能够与分校两个局域网通信,如何配置静态路由?
2) 如果分校两个局域网分别有 20 台主机,交换机快速以太网口是否够用?如不够用,则
如何解决该问题?
一、实验设计
IP 地址分配表
网段
总校
网络号
210.100.10.32
路由器之间 210.100.10.64
210.100.10.96
分校网段 1
分校网段 2
210.100.10.128
网络拓扑图
子网掩码
子网号 起始 IP 地址
结束 IP 地址
255.255.255.224
255.255.255.224
255.255.255.224
255.255.255.224
001
010
011
100
210.100.10.33
210.100.10.65
210.100.10.97
210.100.10.129
210.100.10.62
210.100.10.94
210.100.10.126
210.100.10.158
二、实验配置
(一)本人做分校的交换机和路由器配置
分校交换机配置
SwitchA>enable 14
Password:
Switcha#configure terminal !进入全局配置模式
SwitchA(config)#
SwitchA(config)#vlan 10
SwitchA(config-vlan)#exit
SwitchA(config)#vlan 20
SwitchA(config-vlan)#exit
switchA(config)#interface range fastEthernet 0/1-10
switchA(config-if-range)#switchport access vlan 10
SwitchA(config-if)#exit
SwitchA(config)#interface range fastethernet 0/11-20
SwitchA(config-if-range)#switchaport access vlan 20
SwitchA(config-if)#exit
SwitchA(config)#interface fastethernet 0/24
SwitchA(config-if)#switchaport mode trunk
SwitchA(config-if)#end
SwitchA#show vlan
//对 switchA 的配置进行验证
VLAN Name
---- -------------------------------- --------- -------------------------------
1
10
default
network2
active
active
Status
Ports
Fa0/23,Fa0/24
Fa0/1 ,Fa0/2 ,Fa0/3 ,Fa0/4
Fa0/5 ,Fa0/6 ,Fa0/7 ,Fa0/8
Fa0/9 ,Fa0/10,Fa0/24
Fa0/11,Fa0/12,Fa0/13,Fa0/14
Fa0/15,Fa0/16,Fa0/17,Fa0/18
Fa0/19,Fa0/20,Fa0/24
20
network3
active
SwitchA#
Press RETURN to get started!
分校路由器配置
R2632>en 14
Password:
R2632#con
Enter configuration commands, one per line. End with CNTL/Z.
R2632#con
Enter configuration commands, one per line. End with CNTL/Z.
R2632(config)#interface serial 4/0
R2632(config-if)#ip address 210.100.10.66 255.255.255.224
R2632(config-if)#clock rate 64000
R2632(config-if)#no shutdown
R2632(config-if)#exit
R2632(config)#interface fastEthernet 3/0
R2632(config-if)#no ip address
R2632(config-if)#no shutdown
R2632(config-if)#exit
R2632(config)#interface fastEthernet 3/0.10
R2632(config-subif)#no ip address
R2632(config-subif)#exit
R2632(config)#interface fastEthernet 3/0.10
R2632(config-subif)#encapsulation dot1Q 10
R2632(config-subif)#ip address 210.100.10.97 255.255.255.224
R2632(config-subif)#exit
R2632(config)#interface fastEthernet 3/0.20
R2632(config-subif)#encapsulation dot1Q 20
R2632(config-subif)#ip address 210.100.10.129 255.255.255.224
R2632(config-subif)#end
R2632#
Configured from console by console
//对分校路由器配置验证
OK?
IP-Address(Pri)
210.100.10.66/27
no address
210.100.10.129/27
210.100.10.97/27
no address
no address
no address
R2632#show ip interface brief
Interface
serial 4/0
serial 4/1
FastEthernet 3/0.20
FastEthernet 3/0.10
FastEthernet 3/0
FastEthernet 3/1
Null 0
R2632#con
Enter configuration commands, one per line. End with CNTL/Z.
R2632(config)#ip route 210.100.10.32 255.255.255.224 210.100.10.65
R2632(config)#end
R2632#
Configured from console by console
YES
YES
YES
YES
YES
YES
YES
R2632#show ip route
Status
UP
DOWN
UP
UP
DOWN
DOWN
UP
Codes: C - connected, S - static, R - RIP
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
* - candidate default
210.100.10.32/27 [1/0] via 210.100.10.65
210.100.10.64/27 is directly connected, serial 4/0
210.100.10.66/32 is local host.
210.100.10.96/27 is directly connected, FastEthernet 3/0.10
210.100.10.97/32 is local host.
210.100.10.128/27 is directly connected, FastEthernet 3/0.20
210.100.10.129/32 is local host.
Gateway of last resort is no set
S
C
C
C
C
C
C
R2632#
R2632 CON0 is now available
Press RETURN to get started
小组另一成员做主校交换机和路由器配置
主校交换机配置
switchA>en 14
Password:
switchA#show vlan
VLAN Name
---- -------------------------------- --------- -------------------------------
1
default
active
Status
Ports
Fa0/1 ,Fa0/2 ,Fa0/3 ,Fa0/4
Fa0/5 ,Fa0/6 ,Fa0/7 ,Fa0/8
Fa0/9 ,Fa0/10,Fa0/11,Fa0/12
Fa0/13,Fa0/14,Fa0/15,Fa0/16
Fa0/17,Fa0/18,Fa0/19,Fa0/20
Fa0/21,Fa0/22,Fa0/23,Fa0/24
switchA#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
switchA(config)#vlan 30
switchA(config-vlan)#exit
switchA(config)#exit
switchA#configure
Enter configuration commands, one per line. End with CNTL/Z.
//创建 vlan
switchA(config)#interface range fastEthernet 0/1-20 //将 1-20 端口划入 vlan30 中
switchA(config-if-range)#switchport access vlan 30
switchA(config-if-range)#exit
Switch (config)# interface fastethernet 0/24
Switch (config-if)# switchport mode trunk !配置 trunk 端口
Switch (config-if)# end
switchA(config)#exit
switchA#show vlan
VLAN Name
---- -------------------------------- --------- -------------------------------
1
//对 switchA 的配置进行验证
default
Status
Ports
active
Fa0/21,Fa0/22,Fa0/23,Fa0/24,
30
VLAN0030
active
Fa0/1 ,Fa0/2 ,Fa0/3 ,Fa0/4
Fa0/5 ,Fa0/6 ,Fa0/7 ,Fa0/8
Fa0/9 ,Fa0/10,Fa0/11,Fa0/12
Fa0/13,Fa0/14,Fa0/15,Fa0/16
Fa0/17,Fa0/18,Fa0/19,Fa0/20
Fa0/24
switchA#
Press RETURN to get started!
主校路由器配置
//查看路由器的端口
R2632>en 14
Password:
R2632#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R2632(config)#show ip interface brief
Interface
serial 4/0
serial 4/1
FastEthernet 3/0
FastEthernet 3/1
Null 0
R2632(config)#interface fastEthernet 3/0.30
R2632(config-subif)#encapsulation dot1Q 30
R2632(config-subif)#ip address 210.100.10.33 255.255.255.224
R2632(config-subif)#exit
R2632(config)#show ip interface brief
IP-Address(Pri)
no address
no address
no address
no address
no address
OK?
YES
YES
YES
YES
YES
Status
DOWN
DOWN
DOWN
DOWN
UP
Interface
serial 4/0
serial 4/1
FastEthernet 3/0.30
FastEthernet 3/0
FastEthernet 3/1
Null 0
R2632(config)#exit
R2632#
Configured from console by console
IP-Address(Pri)
no address
no address
210.100.10.33/27
no address
no address
no address
OK?
YES
YES
YES
YES
YES
YES
Status
DOWN
DOWN
DOWN
DOWN
DOWN
UP
R2632#con
Enter configuration commands, one per line. End with CNTL/Z.
R2632(config)#interface serial 4/0
R2632(config-if)#ip ad
R2632(config-if)#ip address 210.100.10.65 255.255.255.224//设置交换机 ip 地址和子网掩
码
R2632(config-if)#no shutdown
R2632(config-if)#end
R2632#
Configured from console by console
R2632#show ip interface brief
Interface
serial 4/0
serial 4/1
FastEthernet 3/0.30
FastEthernet 3/0
FastEthernet 3/1
Null 0
R2632#con
Enter configuration commands, one per line. End with CNTL/Z.
R2632(config)#ip route 210.100.10.96 255.255.255.224 210.100.10.66
路由表
R2632(config)#ip route 210.100.10.128 255.255.255.224 210.100.10.66
R2632(config)#end
R2632#
Configured from console by console
IP-Address(Pri)
210.100.10.65/27
no address
210.100.10.33/27
no address
no address
no address
DOWN
DOWN
UP
Status
UP
DOWN
UP
// 写 入 静 态
OK?
YES
YES
YES
YES
YES
YES
R2632#show ip route
//对主校路由器配置验证
Codes: C - connected, S - static, R - RIP
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
* - candidate default
Gateway of last resort is no set
C
C
C
C
S
S
R2632#
210.100.10.32/27 is directly connected, FastEthernet 3/0.30
210.100.10.33/32 is local host.
210.100.10.64/27 is directly connected, serial 4/0
210.100.10.65/32 is local host.
210.100.10.96/27 [1/0] via 210.100.10.66
210.100.10.128/27 [1/0] via 210.100.10.66
三、实验测试
主校 IP:(pc1)
分校 pc2