思科网络设备实验

实验一:路由器连接交换机
拓扑结构图
   
二、实验目的
实现路由交换的连接通信
操作过程
路由器配置:
 
en
conf t
host R1
no ip domain-lookup
line con 0
exec-timeout 0 0
loggin sync
exit
int f0/1
ip add 192.168.1.1 255.255.255.0
no sh

交换机配置
 
en
conf t
host SW1
no ip domain-lookup
line con 0
exec-timeout 0 0
loggin sync
exit
int vlan 1
ip add 192.168.1.10 255.255.255.0
no sh
测试:
     
在路由器上ping 192.168.1.10可以ping通,试验成功!


实验二、路由器或者交换机的密码设置和验证
一、拓扑结构图
   
二、实验目的
验证密码的使用顺序
操作过程
   
路由器配置:
en
conf t
host R1
no ip domain-lookup
enable password 123
enable secret 456
line con 0
exec-timeout 0 0
loggin sync
password 789
login
exit
do wr

四、验证密码的登录顺序
打开模拟PC,选择Desktop-->terminal-->确定
 
备注:默认情况下先输入console口密码,之后输入密文密码!!

实验三、实现设备的远程管理
实验拓扑图
   
二、实验目的
能够实现在企业中远程管理网络设备
三、实验步骤
路由器配置(备注:路由器中的任意两个端口都不能够在同一个网段!)
 
en
conf t
host R1
no ip domain-lookup
enable sec 87654321
line vty 0 1
password 12345678
login
exit
int f0/0
ip add 192.168.2.1 255.255.255.0
no sh
int f0/1
ip add 192.168.1.1 255.255.255.0
no sh
end


交换机配置
 
en
conf t
host SW1
no ip domain-lookup
enable sec 87654321
line vty 0 1
password 12345678
login
exit
int vlan 1
ip add 192.168.1.10 255.255.255.0
no sh
end


PC2:ip-->192.168.1.100
PC3:ip-->192.168.1.101
PC4:ip-->192.168.1.102
测试
   1.
在PC2上打开Command Prompt,输入telnet 192.168.1.10,先输入VTY密码,成功之后,输入交换机密文密码
在PC3上打开Command Prompt,输入telnet 192.168.1.10,先输入VTY密码,成功之后,输入交换机密文密码
在PC4上打开Command Prompt,输入telnet 192.168.1.10,回车后直接退出(在PC2和PC3没有退出的情况下)
备注:当PC3输入exit退出远程连接时,此时PC4可以远程管理了
2.跨网络远程管理设备需要配置网关!
网关地址是离终端设备最近的路由器接口
备注: 其中ping的返回值TTL(生存周期)
每经过一个路由器或者一个网段TTL会自动减1
直到TTL值为0,那么此数据包将会被丢弃
将所有的PC配置网关,从而实现PC234能够远程管理路由器R1
问题:PC1能否远程管理交换机?----不能!
原因:交换机没有配置网关,数据包只能从PC1到交换机,数据包返回时只能到达R1的F0/1接口
解决办法:在交换机上配置网关:SW1(config)#ip default-gateway 192.168.1.1


实验四、路由器(实践)和交换机(总结)密码恢复
一、实验拓扑图
二、实验目的
工作过程中很常见设备的密码被忘记,通过绕过配置文件来破解
三、实验过程(路由器为例)
第一步:设置密码
 
en
conf t
no ip domain-lookup
host R1
ena sec 123456
do wr
end
第二步:重启破解密码
1.重启后在#没有显示完成前,按下Ctrl+break
2. confreg 0x2142
备注:修改配置寄存器的值,从而绕过保存好的配置文件
reset
备注:重启设备
3. 破解密码
  
en
copy startup-config running-config
conf t
ena sec 123
config-register 0x2102
do wr
end
reload
4.验证重启后输入新的密码,能够进入则实验成功!!


五、通过TFTP和FTP更新IOS
一、拓扑结构图(两个实验用一个图)
 
二、实验目的
更新IOS系统,从而提供更多的功能
三、实验过程
1.TFTP
第一步骤:
设置路由器和服务器PC的IP地址
1>服务器PC的IP地址:192.168.1.2
2>配置路由器
               
en
conf t
int f0/0
ip add 192.168.1.1 255.255.255.0
no sh
end
del flash:c2800nm-advipservicesk9-mz.124-15.T1.bin
备注:由于Flash中的空间有限,所以先删除原有IOS
copy tftp flash: //将TFTP上的数据下载到flash
Address or name of remote host []?----服务器IP
Source filename []?----源文件名称
Destination filename [源文件名称]?----目标文件名称(直接回车)
     
第二步骤:输入dir flash:查看flash中的内容,验证是否升级成功!

2.FTP
第一步骤: 利用上个实验的环境,IP配置略
第二步骤: 因为FTP需要用户名密码验证
所以要配置访问服务器时要用的用户名和密码
此用户名(zhenggang)和密码(123)事先在服务器PC上创建
路由器配置如下:
特权模式下
del flash:c2800nm-advipservicesk9-mz.151-4.M4.bin
Router(config)#ip ftp username zhenggang
Router(config)#ip ftp password 123
备注:腾出足够空间
copy ftp flash: 
Address or name of remote host []?----服务器IP
Source filename []?c2800nm-advipservicesk9-mz.124-15.T1.bin
Destination filename [上一行输入的名字]?----目标文件名称(直接回车)
 
第三步骤:输入dir flash:查看flash中的内容,验证是否升级成功!



VLAN配置
实验拓扑图
    
实验目的
   配置wlan
实验过程
   配置交换机:
  1.创建vlan
   
   
  2.将端口配置到vlan
   
实验验证
   

七、EtherChannel(以太网通道)基本配置
实验
1. 拓扑结构图
  
2.实验目的
3.实验过程
  
SW1
en
conf t
no ip domain-lookup
host SW1
int port-channel 1
int range f0/23 - 24
sw mo acc
sw mo trunk
speed 100
duplex full
channel-protocol lacp
channel-group 1 mode active
exit
port-channel load-balance src-ip


SW2
 
en
conf t
no ip domain-lookup
host SW2
int port-channel 1
int range f0/23 - 24
sw mo acc
sw mo trunk
speed 100
duplex full
channel-protocol lacp
channel-group 1 mode active
exit
port-channel load-balance dst-ip
验证

八、ping实验
Arp -a
 
Arp -d
 
arp -s ip mac    验证:
 

Ping   pian  -a  ip
 
Ping  -l  l  ip   Ping  -n  n  ip
 

Ping -t ip
 

九、单臂路由实验
一、实验拓扑图
   
二、实验目的
实现不同vlan之间的数据通信
三、实验过程
SW1配置
 
en
conf t
host SW1
no ip domain-lookup
vlan 10
vlan 20
exit
int f0/1
sw mo acc
sw acc vlan 10
int f0/2
sw mo acc
sw acc vlan 20
int f0/24
sw mo acc
sw mo tr


R1配置
 
 
Router#conf t
Router(config)#host R1
R1(config)#no ip domain-lookup
int f0/0
no shut
int f0/0.10
encapsulation dot1Q 10
ip add 192.168.1.1 255.255.255.0
encapsulation dot1Q 20
ip add 192.168.2.1 255.255.255.0


PC1:192.168.1.10/网关:192.168.1.1
PC2:192.168.2.10/网关:192.168.2.1
测试:两台主机能够通信


路由器上配置DHCP,使得不同vlan的主机自动获得地址
R1>en
R1#conf t
R1(config)#ip dhcp pool vlan10
R1(dhcp-config)#network 192.168.1.0 255.255.255.0
R1(dhcp-config)#default-router 192.168.1.1
R1(dhcp-config)#dns-server 114.114.114.114
R1(dhcp-config)#exit
R1(config)#ip dhcp excluded-address 192.168.1.2
R1(config)#ip dhcp excluded-address 192.168.1.4


R1(config)#ip dhcp pool vlan20
R1(dhcp-config)#network 192.168.2.0 255.255.255.0
R1(dhcp-config)#default-router 192.168.2.1
R1(dhcp-config)#dns-server 114.114.114.114
R1(dhcp-config)#exit
R1(config)#ip dhcp excluded-address 192.168.2.2 192.168.2.3
客户端测试:vlan10和vlan20的主机选择自动获得IP,查看结果。
 






                        十、路由器配置dhcp
实验拓扑图
 
二、实验目的
路由器上配置DHCP,使得不同vlan的主机自动获得地址
三、实验过程
en
conf t
ip dhcp pool vlan10
network 192.168.1.0 255.255.255.0
default-router 192.168.1.1
dns-server 114.114.114.114
exit
ip dhcp excluded-address 192.168.1.2
ip dhcp excluded-address 192.168.1.4
ip dhcp pool vlan20
network 192.168.2.0 255.255.255.0
default-router 192.168.2.1
dns-server 114.114.114.114
exit
ip dhcp excluded-address 192.168.2.2 192.168.2.3
 
四、客户端测试:vlan10和vlan20的主机选择自动获得IP,查看结果。
 
 






十一、VTP实验
拓扑结构图
   
二.实验目的
  Vtp数据同步
三.实验过程
SW1
 
en
conf t
host SW1
no ip domain-lookup
int vlan 1
ip add 192.168.1.1 255.255.255.0
no sh
int f0/24
sw mo acc
sw mo tr
exit
vtp domain abc
vtp mode server
vtp password 123
vtp version 2




SW2
 
en
conf t
host SW2
no ip domain-lookup 
int vlan 1
ip add 192.168.1.2 255.255.255.0
no sh
int range f0/23 -24
sw mo acc
sw mo tr
exit
vtp domain abc
vtp mode transparent
vtp password 123
vtp version 2


SW3
 
en
conf t
host SW3
no ip domain-lookup 
int vlan 1
ip add 192.168.1.3 255.255.255.0
no sh
int f0/23
sw mo acc
sw mo tr
exit
vtp domain abc
vtp mode client 
vtp password 123
vtp version 2


验证:
SW1:
 
vlan database 
vlan 10 name HR
vlan 20 name CAIWU
exit


SW2:
使用sh vlan brief命令查看vlan是否同步过来(没有!!)
 
在本地创建vlan,看是否成功!
 
vlan database 
vlan 100 name zhg
exit
sh vlan brief 
显示部分结果
VLAN Name    Status    Ports
---- ----    --------- ------
100  zhg     active  


SW3:
SW3#sh vlan brief 
显示部分结果
 
VLAN Name    Status    Ports
---- ------  --------- -----
10   HR      active    
20   CAIWU   active
证明数据已经同步了,验证是否能够本地创建
 
vlan database 
vlan 200 name test
Apply not allowed when device is in CLIENT state.(设备是客户端状态不能被创建)
exit
SW3#


最后在每台交换机观察sh vtp status
 
 
 






十二、三层交换实现不同vlan之间的通信
拓扑结构图
   
二.实验目的
三.实验过程
SW-2L:
 
en
conf t
no ip domain-lookup
host SW-2L
vlan 2
vlan 3
exit
int range f0/6 - 10
sw mo acc
sw acc vlan 2
int range f0/11 - 15
sw mo acc
sw acc vlan 3
int f0/24
sw mo acc
sw mo tr


SW-3L
 
en
conf t
no ip domain-lookup
ip routing
host SW-3L
vlan 2
vlan 3
exit
int f0/24
sw mo acc
sw mo tr
int vlan 1
ip add 192.168.1.1 255.255.255.0
no sh
int vlan 2
ip add 192.168.2.1 255.255.255.0
no sh
int vlan 3
ip add 192.168.3.1 255.255.255.0
no sh


按照图例配置客户端的IP地址和网关地址
验证:实现不同vlan的主机通信(ping)
 
之后在三层交换机查看路由表
 
SW-3L#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


C    192.168.1.0/24 is directly connected, Vlan1
C    192.168.2.0/24 is directly connected, Vlan2
C    192.168.3.0/24 is directly connected, Vlan3


实验扩展
将SW-3L的f0/23端口设置成为路由端口实现PC3和内部网络数据通信
 
SW-3L(config)#int f0/23
SW-3L(config-if)#no switchport 
SW-3L(config-if)#ip add 192.168.4.1 255.255.255.0
SW-3L(config-if)#no sh


DHCP中继代理:
实验过程
添加一台服务器(属于vlan2,并且给该服务器配置IP:192.168.3.50和网关192.168.3.1)
开启DHCP功能,并且配置相关的网段
在三层交换上的配置
 
SW-3L>en
SW-3L#conf t
SW-3L(config)#int vlan 1
SW-3L(config-if)#ip helper-address 192.168.2.50
SW-3L(config-if)#int vlan 3
SW-3L(config-if)#ip helper-address 192.168.2.50
验证:
 
 
分别将vlan1和vlan3的客户端主机,设置成自动获取IP地址
之后测试网络连通性


 






十三、生成树协议实验报告
拓扑结构图
   
二.实验需求和步骤(参考PPT-P30~31)
  三台交换机相连,配置PVST+负载均衡
SW1成为VLAN 1的根网桥
SW2成为VLAN 2的根网桥
SW3上配置速端口(F0/1~F0/10)
  配置思路
为交换机配置VLAN并配置交换机连接端口为Trunk模式
配置VLAN负载均衡
验证STP信息
配置速端口
三.实验过程
SW1
 
en
conf t
host SW1
no ip domain-lookup
vlan 2
exit
spanning-tree vlan 1 root primary
spanning-tree vlan 2 root secondary
int range f0/23 - 24
sw mo acc
sw mo tr
exit


SW2
 
en
conf t
host SW2
no ip domain-lookup
vlan 2
exit
spanning-tree vlan 2 root primary
spanning-tree vlan 1 root secondary
int range f0/23 - 24
sw mo acc
sw mo tr
exit


SW3
 
en
conf t
host SW3
no ip domain-lookup
vlan 2
exit
int range f0/23 - 24
sw mo acc
sw mo tr
int range f0/1 - 10
spanning-tree portfast
int range f0/6 - 10
sw mo acc
sw acc vlan 2
exit
 






十四、多生成树配置
实验拓扑图
    
实验目的
配置MST实现VLAN负载均衡
实验过程
SW1:
en
conf t
host SW1
no ip domain-lookup
vlan 2
exit
panning-tree mode mst
spanning-tree mst configuration
name xjl
Instance 1 vlan 1
Instance 2 vlan 2
Exit
Spanning-tree mst 1 root primary
Spanning-tree mst 2 root secondary










十五、基于路由的HSRP(热备份路由协议)
拓扑结构图
   
/R1\
PC1--Switch- -Switch--PC2
\R2/
二.实验目的
通过HSRP实现网关的自动切换,使得网络能够不间断通信
三.实验过程
备份组1
R1
 
en
conf t
host R1
no ip domain-lookup
int f0/0
ip add 192.168.1.1 255.255.255.0
standby 1 ip 192.168.1.254
standby 1 priority 200
standby 1 preempt
standby 1 track f1/0
no sh


R2
 
en
conf t
host R2
no ip domaim-lookup
int f0/0
ip add 192.168.1.2 255.255.255.0
standby 1 ip 192.168.1.254
standby 1 priority 195
standby 1 preempt
no sh


备份组2:
R1
 
int f1/0
ip add 192.168.2.1 255.255.255.0
standby 2 ip 192.168.2.254
standby 2 priority 195
standby 2 preempt
no sh


R2
 
int f1/0
ip add 192.168.2.2 255.255.255.0
standby 2 ip 192.168.2.254
standby 2 priority 200
standby 2 preempt
standby 2 track f1/0
no sh




验证
   






十六、基于vlan的热备份路由协议
实验拓扑图
   
 
二、实验目的
利用STP和HSRP解决网络的环路和数据通信的备份(虚拟网关)
三、实验过程
基本配置
1.所有交换机配置vlan10和vlan20
2.SW-2L-01(02)对应的端口加到vlan
3.交换机的链接端口配置中继链路
4.三层交换配置vlan10和vlan20的IP地址
SW-3L-01
 
En
vlan database
vlan 10
vlan 20
exit
conf t
ip routing
host SW-3L-01
int vlan 10
ip add 192.168.10.1 255.255.255.0
no sh
int vlan 20
ip add 192.168.20.1 255.255.255.0
no sh
int range f0/21 - 24
sw mo acc
sw mo tr
exit


SW-3L-02
 
en
vlan database
vlan 10
vlan 20
exit
conf t
ip routing
host SW-3L-02
int vlan 10
ip add 192.168.10.2 255.255.255.0
no sh
int vlan 20
ip add 192.168.20.2 255.255.255.0
no sh
int range f0/21 - 24
sw mo acc
sw mo tr
exit


SW-2L-01
en
vlan database
vlan 10
vlan 20
exit
conf t
host SW-2L-01
int range f0/1 - 10
sw mo acc
sw acc vlan 10
int range f0/11 - 20
sw mo acc
sw acc vlan 20
int range f0/23 - 24
sw mo acc
sw mo tr
exit


SW-2L-02
 
en
vlan database
vlan 10
vlan 20
exit
conf t
host SW-2L-02
int range f0/1 - 10
sw mo acc
sw acc vlan 10
int range f0/11 - 20
sw mo acc
sw acc vlan 20
int range f0/23 - 24
sw mo acc
sw mo tr
exit


生成树配置
SW-3L-01
 
SW-3L-01(config)#spanning-tree vlan 10 root primary
SW-3L-01(config)#spanning-tree vlan 20 root secondary


SW-3L-02
SW-3L-02(config)#spanning-tree vlan 20 root primary
SW-3L-02(config)#spanning-tree vlan 10 root secondary


设置HSRP
SW-3L-01
 
int vlan 10
standby 10 ip 192.168.10.254
standby 10 priority 200
standby 10 preempt


int vlan 20
standby 20 ip 192.168.20.254
standby 20 priority 150


SW-3L-02
 
int vlan 10
standby 10 ip 192.168.10.254
standby 10 priority 150


int vlan 20
standby 20 ip 192.168.20.254
standby 20 priority 200
standby 20 preempt


四、测试
SW-3L-01#show spanning-tree brief
 
SW-3L-02#show spanning-tree brief
 


SW-3L-01#show standby brief
 
SW-3L-02#show standby brief
 


分析以上实验结果








十七、静态路由
一、实验拓扑图
   
二、实验目的
利用静态路由实现不同网段的数据通信
三、实验过程
基本环境
R1
en
conf t
no Ip domain-lookup
host R1
int f0/1
ip add 192.168.1.1 255.255.255.0
no sh
int f0/0
ip add 192.168.2.1 255.255.255.0
no sh
exit
 
R2
en
conf t
no Ip domain-lookup
host R2
int f0/1
ip add 192.168.3.1 255.255.255.0
no sh
int f0/0
ip add 192.168.2.2 255.255.255.0
no sh
exit


配置PC的IP和网关
PC0 IP:192.168.1.10
网关:192.168.1.1
PC1 IP:192.168.3.10
网关:192.168.3.1


配置静态路由
R1:
ip route 192.168.3.0 255.255.255.0 192.168.2.2
 
R2:
ip route 192.168.1.0 255.255.255.0 192.168.2.1










四、ping验证
 










十八、静态路由进阶
一、实验名称:
静态路由的浮动路由和负载均衡
实验拓扑图:
   
 
三、实验目的:
1.通过浮动路由和负载均衡优化网络环境
2.观察数据流向
四、实验步骤:
R1
en
conf t
int f1/0
ip add 192.168.1.1 255.255.255.0
no sh
int f0/0
ip add 192.168.2.1 255.255.255.0
no sh
int f0/1
ip add 192.168.3.1 255.255.255.0
no sh
exit
 
R2
en
conf t
int f1/0
ip add 192.168.4.2 255.255.255.0
no sh
int f0/0
ip add 192.168.2.2 255.255.255.0
no sh
int f0/1
ip add 192.168.3.2 255.255.255.0
no sh
exit


PC1
en
conf t
no ip routing
ip default-gateway 192.168.1.1
int f0/0
ip add 192.168.1.10 255.255.255.0
no sh
end


PC2
en
conf t
no ip routing
ip default-gateway 192.168.4.1
int f0/0
ip add 192.168.4.10 255.255.255.0
no sh
end


配置静态路由(负载均衡)
R1
ip route 192.168.4.0 255.255.255.0 192.168.2.2
ip route 192.168.4.0 255.255.255.0 192.168.3.2
exit
 
R2
ip route 192.168.1.0 255.255.255.0 192.168.2.1
ip route 192.168.1.0 255.255.255.0 192.168.3.1
exit
 
测试
 
在R1
1.R1#traceroute ip 192.168.4.10
备注:反复连续运行
最终显示结果可以看出数据是交替往4.0网络传输的
2.R1#show ip route
Codes: C - connected, S - static, 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
  i - IS-IS, su - IS-IS summary, 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(说明默认路由没有配置)


S    192.168.4.0/24 [1/0] via 192.168.3.2, FastEthernet0/0
[1/0] via 192.168.2.2, FastEthernet1/0
C    192.168.1.0/24 is directly connected, FastEthernet2/0
C    192.168.2.0/24 is directly connected, FastEthernet1/0
C    192.168.3.0/24 is directly connected, FastEthernet0/0
 


配置静态路由(浮动路由)
R1
conf t
no ip route 192.168.4.0 255.255.255.0 192.168.3.2
ip route 192.168.4.0 255.255.255.0 192.168.3.2 2
exit
 
R2
conf t
no ip route 192.168.1.0 255.255.255.0 192.168.3.1
ip route 192.168.1.0 255.255.255.0 192.168.3.1 2
Exit
 


测试
 
在R1
1.R1#traceroute ip 192.168.4.10
备注:反复连续运行
最终显示结果可以看出数据是走2.0的网线往4.0网络传输的








十九、静态路由:路由选路
实验拓扑图
   
 
实验过程
R1
en
conf t
no ip domain-lookup
Int f0/0
ip add 192.168.1.2 255.255.255.0
no sh
Int f0/1
ip add 192.168.2.1 255.255.255.0
no sh
exit
ip route 192.168.10.0 255.255.255.0 192.168.2.2
ip route 192.168.20.0 255.255.255.0 192.168.1.1
exit
 
R2
en
conf t
no ip domain-lookup
Int f0/0
ip add 192.168.3.1 255.255.255.0
no sh
Int f0/1
ip add 192.168.1.1 255.255.255.0
no sh
Int f1/0
ip add 192.168.20.2 255.255.255.0
no sh
exit
ip route 192.168.2.0 255.255.255.0 192.168.1.2
ip route 192.168.10.0 255.255.255.0 192.168.1.2
ip route 192.168.30.0 255.255.255.0 192.168.3.2
exit
 
R3
en
conf t
no ip domain-lookup
Int f0/0
ip add 192.168.3.2 255.255.255.0
no sh
Int f0/1
ip add 192.168.2.2 255.255.255.0
no sh
Int f1/0
ip add 192.168.10.2 255.255.255.0
no sh
Int f1/1
ip add 192.168.30.2 255.255.255.0
no sh
exit
ip route 192.168.1.0 255.255.255.0 192.168.2.1
ip route 192.168.20.0 255.255.255.0 192.168.2.1
ip route 192.168.20.0 255.255.255.0 192.168.3.1
exit
 


实验验证
 
 

你可能感兴趣的:(思科网络设备实验)