6.4
实验三 综合性训练(搭建中小企业园区网)
一、实验目的:
1.通过对网络设备的连通和对拓扑的分析,加深对常见典型局域网拓扑的理解;
2.通过路由建立起网络之间的连接,了解网络路由的设计与配置;
3.进一步熟悉交换机、路由器的基本操作命令。
二、实验设备:
计算机、三层交换机、路由器、外网服务器
三、实验拓扑图:
四、实验过程:
步骤1:在4台交换机上创建vlan10/20/30,分别命名为yewubu,caiwubu,zonghebu 四台交换机:
Switch0
Switch>enable
Switch#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#name yewubu
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#name caiwubu
Switch(config-vlan)#exit
Switch(config)#vlan 30
Switch(config-vlan)#name zonghebu
Switch(config-vlan)#exit
(四台交换机代码相同)
步骤2:在交换机s2_01,s2_02(二层交换机)上分别将6-10端口,11-15端口,16-20端口分别划分到vlan10,20,30中 两台二层交换机(下面)//这里可以只将连接主机的端口分配给相应的vlan即可【可以使用2960(有24个端口)】
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int range fa0/6-10
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#exit
Switch(config)#int range fa0/11-15
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 20
Switch(config-if-range)#exit
Switch(config)#int range fa0/16-20
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 30
Switch(config-if-range)#exit
Switch(config)#
(两台交换机代码相同)
步骤3:把s2_01,s2_02连s3_01,s3_02的端口设置都为Trunk模式(8个端口) 四台交换机
Switch(config)#
Switch(config)#interface FastEthernet0/1
Switch(config-if)#
Switch(config-if)#switchport mode trunk
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Switch(config-if)#exit
Switch(config)#interface FastEthernet0/2
Switch(config-if)#
Switch(config-if)#switchport mode trunk
步骤4:将两台三层交换机之间的fa0/3,fa0/4端口配置为聚合端口 两台三层交换机(上面)
Switch(config)#int range fa0/1-2
Switch(config-if-range)#channel-group 1 mode on
Switch(config-if-range)#
Creating a port-channel interface Port-channel 1
%LINK-5-CHANGED: Interface Port-channel1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up
Switch(config-if-range)#exit
Switch(config)#int port-channel 1
Switch(config-if)#switchport mode trunk
Command rejected: An interface whose trunk encapsulation is "Auto" can not be configured to "trunk" mode.
Switch(config-if)#exit
Show vlan
步骤5:在四台交换机上配置RSTP,指定s3_01和s3-02分别为根网桥和备份网桥(生成树协议) 四台交换机
其中两台二层交换机:
spanning-tree mode pvst
剩余的两台三层交换机:
Switch(config)#spanning-tree mode pvst
Switch(config)#spanning-tree vlan 10,20,30 priority 16384
Switch#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.9609.ECB3
Cost 9
Port 27(Port-channel1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 00E0.F726.8751
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/3 Desg FWD 19 128.3 P2p
Fa0/4 Desg FWD 19 128.4 P2p
Po1 Root FWD 9 128.27 Shr
VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 16394
Address 00E0.F726.8751
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 16394 (priority 16384 sys-id-ext 10)
Address 00E0.F726.8751
--More--
步骤6:在接入交换机的access链路上实现端口安全,最大连接数量为4个,当违例产生时,将关闭端口并发送一个Trap通知 两台二层交换机(下面)
Switch(config)#int range fa0/6-20
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport port-security
Switch(config-if-range)#switchport port-security maximum 4
Switch(config-if-range)#switchport port-security violation shutdown
步骤7:在三层交换机上配置SVI实现vlan间的路由 两台三层交换机(上面)
左边
Switch(config-if)#int vlan 10
Switch(config-if)#ip address 192.168.10.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#int vlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
Switch(config-if)#ip address 192.168.20.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#int vlan 30
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan30, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to up
Switch(config-if)#ip address 192.168.30.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
右边
Switch(config)#int vlan 10
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
Switch(config-if)#ip address 192.168.10.2 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#int vlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
Switch(config-if)#ip address 192.168.20.2 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#int vlan 30
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan30, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to up
Switch(config-if)#ip address 192.168.30.2 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
步骤8:在三层交换机的路由端口,Ra和Rb及模拟Internet的路由上配置接口IP地址 两台三层交换机(上面)和路由器 其中两台三层交换机
左边
Switch(config)#int fa0/24
Switch(config-if)#no switchport
Switch(config-if)#ip address 10.1.1.2 255.255.255.0
Switch(config-if)#no shutdown
右边
Switch(config)#int fa0/24
Switch(config-if)#no switchport
Switch(config-if)#ip address 20.2.2.2 255.255.255.0
Switch(config-if)#no shutdown
Ra路由器
Router(config)#int fa0/0
Router(config-if)#ip address 10.1.1.1 255.255.255.0
Router(config-if)#clock rate 64000
Router(config)#interface FastEthernet1/0
Router(config-if)#ip address 20.2.2.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up
Router(config)#interface Serial2/0
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#no shutdown
Rb路由器
Router>enable
Router#
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface Serial2/0
Router(config-if)#ip address 192.168.1.2 255.255.255.0
Router(config-if)#ip address 192.168.1.2 255.255.255.0
Router(config-if)#clock rate 64000
This command applies only to DCE interfaces
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface Serial2/0, changed state to up
Router(config-if)#exit
Router(config)#interface FastEthernet0/0
Router(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to up
ip address 201.10.8.1 255.255.255.0
Router(config-if)#ip address 201.10.8.1 255.255.255.0
Router(config-if)#no shutdown
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· DeepSeek在M芯片Mac上本地化部署