>H
!
interfacevlan1
noshutdown
ipaddress192.168.0.138255.255.255.0
!
end
【注意事项】
交换机的管理接口缺省一般是关闭的(shutdown),因此在配置管理接interface
vlan1的IP地址后须用命令“noshutdown”开启该接口。
实验二路由器的基本配置
【实验名称】
如何配置路由器支持Telnet.
【实验目的】
掌握路由器的管理特性,学会配置路由器支持Telnet操作的相关语句.
【背景描述】
假设某学校的网络管理员第一次在设备机房对路由器进行了初次配置后,他希望以后
在办公室或出差时也可以对设备进行远程管理,现要在路由器上做适当配置,使他可以实验这一
功能.
本实验以一台R2624路由器为例,路由器命名为RouterA.一台PC机通过串口(COM)连接到
路由器的控制(CONSOLE)端口,通过网卡(NIC)连接到路由器的fastethernet0端口.假设PC机的
IP地址和网络掩码分别为192.168.0.137,255.255.255.0,配置路由器的fastethernet0端口
的IP地址和网络掩码分别为192.168.0.138,
255.255.255.0.
【实验功能】
使网络管理员可以通过Telnet对路由器进行远程管理.
【实验拓扑】
RouterA
F0/1
Console
192.168.0.138
NICCOM
PC
【实验设备】
R3760(1台)
【实验步骤】
步骤1.在路由器上配置fastethernet0端口的IP地址.
Red-Giant>enable!
进入特权模式
Red-Giant#configureterminal!
进入全局配置模式
Red-Giant(config)#hostnamerouterA!
配置路由器名称为“RouterA”
routerA(config)#interfacefastethernet0!
进入路由器接口配置模式
routerA(config-if)#ipaddress192.168.0.138255.255.255.0!
配置路由器管理接
口IP地址
routerA(config-if)#noshutdown!
开启路由器fastethernet0接口
验证测试:
验证路由器接口fastethernet0的IP地址已经配置和开启
routerA#showipinterfacefastethernet0
或
routerA#showipinterfacebrief
步骤2.配置路由器远程登录密码.
routerA(config)#linevty04!
进入路由器线路配置模式,配置前5个用户登录的密码。
routerA(config-line)#login!
配置远程登录
routerA(config-line)#passwordrg!
设置路由器远程登录密码为“rg”
routerA(config-line)#end!
退出线路配置模式
步骤3.配置路由器特权模式密码.
routerA(config)#enablesecretrg!
设置路由器特权模式密码为“rg”,secret是以密
文方式传输密码信号
或:
routerA(config)#enablepasswordrg!
设置路由器特权模式密码为“rg”,password是
以明文方式传输密码信号
验证测试:
验证从PC机可以通过网线远程登录到路由器上
c:
\telnet192.168.0.138!
从PC机登录到路由器上
步骤4.保存在路由器上所做的配置.
routerA(config)#wr
验证测试:
验证路由器配置已保存
routerA(config)#showstartup-config
或:
routerA(config)#showrun(显示现在的内存中的配置)
【注意事项】
路由器接口缺省是关闭的(shutdown),因此必须在配置接口fastethernet的IP地址后须
用命令”noshutdown”开启该接口.
实验三虚拟局域网VLAN
实验1交换机端口隔离
【实验名称】
交换机端口隔离.
【实验目的】
理解PortVlan的配置.
【背景描述】
假设此交换机是宽带小区城域网中的一台楼道交换机,住户PC1连接在交换机的0/5口;
住户PC2连接在交换机的0/15口.现要实现各家各户的端口隔离.
【实现功能】
通过PORTVLAN实现本交换机端口隔离.(通过虚拟局域网技术可以隔离网络风暴,提
高网络的性能,降低无用的网络开销。
并能提高网络的安全性,保密性。
)
【实现拓扑】
PC1PC2
F0/5
F0/15
Vlan10Vlan20
【实验设备】
S2126(1台)
【实验步骤】
步骤1.在未划VLAN前两台PC互相PING可以通.
switchA#configureterminal!
进入交换机全局配置模式
switchA(config)#vlan10!
创建VLAN10
switchA(config-vlan)#nametest10!
将其命名为test10
switchA(config-vlan)#!
退出VLAN10
switchA(config)#vlan20!
创建VLAN20
switchA(config-vlan)#nametest20!
将其命名为test20
验证测试
switchA#showvlan
步骤2.将接口分配到VLAN.
switchA(config)#interfacefastethernet0/5!
进入fastethernet0/5的接口配置模式。
switchA(config-if)#switchaccessvlan10!
将fastethernet0/5端口加入VLAN10中。
switchA(config-if)#exit
switchA(config)#interfacefastethernet0/15!
进入fastethernet0/15的接口配置模式。
switchA(config-if)#switchaccessvlan20!
将fastethernet0/15端口加入VLAN20中。
步骤3.两台PC互相PING不通.
验证测试
switchA#showvlan
实验2跨交换机实现VLAN
【实验名称】
跨交换机实现VLAN.
【实验目的】
理解VLAN如何跨交换机实现.
_【背景描述】
假设某企业有2个主要部门:
销售部和技术部,其中销售部门的个人计算机系统分散连接在2台交换机上,他们之间需要相互连接通信,但为了数据安全起见,销售部和技术部须要进行相互隔离,现要在交换机上做适当配置来事项这一目标.
【实现功能】
使在同一VLAN里的计算机系统能快乐交换机进行相互通信,而在不同VLAN里的计算机系统不能进行相互通信.
【实验拓扑】
PC1
VLAN10F0/5SwitchASwitchBVLAN10
F0/24F0/24
F0/5
VLAN20F0/15PC3
PC2
【实验设备】
S2126(2台)
【实验步骤】
步骤1.在交换机SwitchA上创建VLAN10,并将0/5端口划分到VLAN10中.
switchA#configureterminal!
进入全局配置模式
switchA(config)#vlan10!
创建VLAN10
switchA(config-vlan)#namesales!
将其命名为sales.
switchA(config-vlan)#exit
switchA(config)#interfacefastethernet0/5!
进入接口配置模式。
switchA(config-if)#switchportaccessvlan10!
将0/5端口划分到VLAN10中
步骤2.在交换机SwitchA上创建VLAN20,并将0/15端口划分到VLAN20中.
switchA#configureterminal!
进入全局配置模式
switchA(config)#vlan20!
创建VLAN20
switchA(config-vlan)#nametechnical!
将其命名为technical.
switchA(config-vlan)#exit
switchA(config)#intErfacefastethernet0/15!
进入接口配置模式。
switchA(config-if)#switchportaccessvlan20!
将0/5端口划分到VLAN20中
验证测试:
验证已创建了VLAN20,并将0/15端口已划分到VLAN20中。
switchA#showvlan
步骤3.在交换机SwitchA上将与SwitchB相连的端口(假设为0/24端口)定义为tagvlan模式.
switchA(config)#interfacefastethernet0/24!
进入接口配置模式
switchA(config-if)#switchportmodetrunk!
将fastethernet0/24端口设为tagvlan模式。
验证测试:
验证fastethernet0/24端口已被设置为tagvlan模式。
switchA#showinterfacesfastethernet0/24switchport
步骤4.在交换机SwitchB上创建VLAN10,并将0/5端口划分到VLAN10中.
SwitchB#configureterminal!
进入全局配置模式
SwitchB(config)#vlan10!
创建VLAN10
SwitchB(config-vlan)#namesales!
将其命名为sales.
SwitchB(config-vlan)#exit
SwitchB(config)#interfacefastethernet0/5!
进入接口配置模式。
SwitchB(config-if)#switchportaccessvlan10!
将0/5端口划分到VLAN10中
步骤5.在交换机SwitchB上将与SwitchA相连的端口(假设为0/24端口)定义为tagvlan模式.
SwitchB(config)#interfacefastethernet0/24!
进入接口配置模式
SwitchB(config-if)#switchportmodetrunk!
将fastethernet0/24端口设为tagvlan模式。
步骤6.验证PC1与PC3能互相通信,但PC2与PC3不能互相通信.
c:
\ping192.168.0.30
【注意事项】
丄台交换机之间相连的端口应该设置为tagvlan模式.
实验3VLAN/802.1Q-VLAN间通信
【实验名称】
VLAN/802.1Q-VLAN间互相通信.
【实验目的】
通过三层交换机实现VLAN间互相通信.
【背景描述】
假设某企业有2个主要部门:
销售部和技术部,其中销售部门的个人计算机系统分散连接在2台交换机上,他们之间需要相互进行通信,销售部和技术部也需要进行相互通讯,现要在交换机上做适当配置来实现这一目标.
【实现功能】
使在同一VLAN里的计算机系统能跨交换机进行相互通信,而在不同VLAN里的计算机系统也能进行相互通信.
【实验拓扑】
PC1
VLAN10F0/5SwitchASwitchBVLAN10
F0/24F0/24
F0/5
VLAN20F0/15PC3
PC2
【实验设备】
S2126(1台),S3550-24(1台)
【实验步骤】
步骤1.在交换机SwitchA上创建VLAN10,并将0/5端口划分到VLAN10中.
switchA#configureterminal!
进入全局配置模式
switchA(config)#vlan10!
创建VLAN10
switchA(config-vlan)#namesales!
将其命名为sales.
switchA(config-vlan)#exit
switchA(config)#interfacefastethernet0/5!
进入接口配置模式。
switchA(config-if)#switchportaccessvlan10!
将0/5端口划分到VLAN10中
步骤2.在交换机SwitchA上创建VLAN20,并将0/15端口划分到VLAN20中.
switchA#configureterminal!
进入全局配置模式
switchA(config)#vlan20!
创建VLAN20
switchA(config-vlan)#nametechnical!
将其命名为technical.
switchA(config-vlan)#exit
switchA(config)#interfacefastethernet0/15!
进入接口配置模式。
switchA(config-if)#switchportaccessvlan20!
将0/5端口划分到VLAN20中
验证测试:
验证已创建了VLAN20,并将0/15端口已划分到VLAN20中。
switchA#showvlan
步骤3.在交换机SwitchA上将与SwitchB相连的端口(假设为0/24端口)定义为tagvlan模式.
switchA(config)#interfacefastethernet0/24!
进入接口配置模式
switchA(config-if)#switchportmodetrunk!
将fastethernet0/24端口设为tagvlan模式。
验证测试:
验证fastethernet0/24端口已被设置为tagvlan模式。
switchA#showinterfacesfastethernet0/24switchport
步骤4.在交换机SwitchB上创建VLAN10,并将0/5端口划分到VLAN10中.
SwitchB#configureterminal!
进入全局配置模式
SwitchB(config)#vlan10!
创建VLAN10
SwitchB(config-vlan)#namesales!
将其命名为sales.
SwitchB(config-vlan)#exit
SwitchB(config)#interfacefastethernet0/5!
进入接口配置模式。
SwitchB(config-if)#switchportaccessvlan10!
将0/5端口划分到VLAN10中
步骤5.在交换机SwitchB上将与SwitchA相连的端口(假设为0/24端口)定义为tagvlan模式.
SwitchB(config)#interfacefastethernet0/24!
进入接口配置模式
SwitchB(config-if)#switchPortmodetrunk!
将fastethernet0/24端口设为tagvlan模式。
步骤6.验证PC1与PC2能互相通信,但PC2与PC3不能互相通信.
c:
\ping192.168.0.30
步骤7.设置三层交换机VLAN间通讯.
switchA(config)#intvlan10!
创建虚拟接口vlan10
switchA(config-if)#ipaddress192.168.10.254255.255.255.0
switchA(config-if)#exit
switchA(config)#intvlan20!
创建虚拟接口vlan20
switchA(config-if)#ipaddress192.168.20.254255.255.255.0
步骤8.将PC1和PC3的默认网关设置为192.168.10.254,ip地址为192.168.10.x,将PC2的默
认网关设置为192.168.20.254,192.168.20.x.
测试结果.不同VLAN内的主机可以互相PING通.
【注意事项】
两台交换机之间相连的端口应该设置为tagvlan模式.
需要设置PC的网关.
实验四静态路由
【实验名称】
静态路由
【实验目的】
掌握通过静态路由方式实现网络的连通性.
【背景描述】
假设校园通过一台路由器连接到校园外的另一台路由器上,现要在路由器上做适当配置,实现校园网内部主机与校园网外部主机的相互通信.
【实现功能】
实现网络的互连互通,从而实现信息的共享和传递.
【实验拓扑】
172.16.1.0/24172.16.2.0/24172.16.3.0/24