CCNA实验手册 下载本文

内容发布更新时间 : 2024/5/4 10:18:02星期一 下面是文章的全部内容请认真阅读。

TFTP_SERVER=192.168.10.102 //设置 TFTP 服务器地址 rommon 5 >

TFTP_FILE=c2600_new.bin //设置源文件名 rommon 6 > TFTPDNLD //进行 TFTP 拷贝 注:这里要确保 TFTP SERVER 是打开的,且已存放有 c2600_new.bin 文件。 四、 通过 xmodem 升级 CISCO 交换机的 IOS 映像文件 系统崩溃或是无法通过正常启动时,可以使用 xmodem 通信协议进行拷贝(通过 console 口控制交换机主 机一端打开超级终端,配置方法如下图所示 在交换机上配置: switch: flash_init //进行 flash 的初始化 switch: load_helper //初始帮助文件的导入 switch: dir flash: //察看 flash 的状态 百思学网络,领先科技 -31- HTTP://WWW.BESTXUE.CN

switch: copy xmodem: flash:c2950_new.bin //以 xmodem 方式拷贝文件配置超级终端默认参数

选择 '传输'-'发送文件'选项

百思学网络,领先科技 -32- HTTP://WWW.BESTXUE.CN 选择使用的协议 xmodem 、 确定后开始传送文件,传输完成后重新启动设备即完成拷贝 除了使用超级终端外,也可以用 secure CRT,选择 transfer→“send xmodem”: 找到 IOS 映像文件,点 send(发送)即可

百思学网络,领先科技 -33- HTTP://WWW.BESTXUE.CN

实验9. 交换机 VLAN、 TRUNK 、VTP 配置 1〃 配置 CISCO 二层交换机

的 IP 地址(catalyst 2950 为例) SW1(config)#int vlan 1 //进入管理接口 interface vlan 1 SW1(config-if)#ip address 11.1.1.2 255.255.255.0 //配置 IP 地址 SW1(config-if)#no shutdown SW1(config-if)#exit SW1(config)#ip default-gateway 11.1.1.1 //配置网关,可通过 show run 查看所配置的 IP 地址: SW1#show int vlan 1 Vlan1 is up, line protocol is up Hardware is CPU Interface, address is 0008.20ff.6400 (bia 0008.20ff.6400) Internet address is 11.1.1.2/24 2〃配置交换机的端口速度和双工(Speed and Duplex) SW1(config)#interface fa0/1 SW1(config-if)#speed {10 | 100 | auto} //10M/100M/自适应 SW1(config-if)#duplex {auto | full | half} //自适应/全双工/半双工 一般情况下,交换机两端的端口速度和双工要匹配,这样通信质量才能得到保证,在相同厂家的产品(比如说 Cisco 的交换机互连)中端口协商不用配置一般不会有什么问题,可以通过 show

interface 查看端口的 速度和双工。通常在不同厂家的产品中(比如说 Cisco 和华为互连)如果通过查看发现端口速度和双工不 匹配,可以通过手工配置来解决。如图:

通过 show interface 查看端口的速度和双工: SW1#show interfaces fastEthernet 0/24 FastEthernet0/24 is up, line protocol is up (connected) Hardware is Fast Ethernet, address is

0008.20ff.6418 (bia 0008.20ff.6418) MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set Keepalive set (10 sec) Full-duplex, 100Mb/s, media type is 100BaseTX input flow-control is unsupported output flow-control is unsupported ARP type: ARPA, ARP Timeout 04:00:00 Last input 00:00:03, output 00:00:00, output hang never 注:CISCO 交换机端口默认值:Auto-duplex, Auto-speed, media type is 100BaseTX Cisco 设备配置端口速度(speed)和双工(duplex)命令: SW1(config)#interface fastEthernet 0/24 SW1(config-if)#speed ? 10 Force 10 Mbps operation ----------------------------注:强制速度为 10M

百思学网络,领先科技 -34- HTTP://WWW.BESTXUE.CN

100 Force 100 Mbps operation---------------------------注〆强制速度为 100M auto Enable AUTO speed configuration -----------------注〆速度自动协议(默认值) SW1(config-if)#duplex ? auto Enable AUTO duplex configuration ----------------注〆自动协商双工 full Force full duplex operation ---------------------------注〆强制为全双工 half Force half-duplex operation --------------------------注〆强制为半双工 3.设置永久 MAC 地址不过期

SW1(config)#mac-address-table static mac_addr {vlan vlan_id} [interface int1 [int2 ... int15]]

SW1(config)#mac-address-table static 1111.1111.a111 vlan 1 interface f0/1 配置后 show mac-address-table 可以看到静态添加的 MAC 地址 1111.1111.a111 SW1#show mac-address-table Vlan Mac Address Type Ports ---- ----------- -------- ----- All 000f.72db.4ec0 STATIC CPU 1 1111.1111.a111 STATIC Fa0/1

4〃管理 MAC 地址表 SW1#show mac-address-table Mac Address Table

------------------------------------------- Vlan Mac Address Type Ports ---- ----------- -------- ----- All 000f.72db.4ec0 STATIC CPU 1 0000.0c3f.0b05 DYNAMIC Fa0/12 1 0030.94e6.391d DYNAMIC Fa0/11 1 00e0.b05a.5bfe DYNAMIC Fa0/10 1 1111.1111.a111 STATIC Fa0/1 5.设置交换机端口的访问模式(三种) access /dynamic / trunk SW1(config-if)#switchport mode ? access Set trunking mode to

ACCESS unconditionally dynamic Set trunking mode to dynamically negotiate access or trunk mode trunk Set trunking mode to TRUNK unconditionally SW1(config)#int

fastEthernet 0/1 SW1(config-if)#switchport mode access //设置 FA0/1 为 ACCESS 模式 SW1(config-if)#switchport mode trunk //设置 FA0/1 为 TRUNK 模式

SW1(config-if)#switchport mode dynamic auto //设置 FA0/1 为自动直协商模式(默认) 交换机 TRUNK 端口配置: 1)一般交换机与交换机相连接的端口要设置为 trunk 模式 2 )如果是梳心交换机与非网管的交换机相连,梳心交换机端口设置为 access 模式 如下图:

CISCO CISCO

百思学网络,领先科技 -35- HTTP://WWW.BESTXUE.CN

配置 SW1: SW1(config)#int f0/24 SW1(config-if)#no shutdown SW1(config-if)#switchport mode trunk //设置 Fa0/24 为 TRUNK 模式 配置 SW2: SW2(config)#int f0/24 SW2(config-if)#no shutdown SW2(config-if)#switchport mode trunk //设置 FA0/24 为 TRUNK 模式 验证 TRUNK 命令:

Show interface trunk

Show interface f0/24 switchport

SW1#sho run int f0/24 interface FastEthernet0/24 switchport mode trunk SW1#show int trunk Port Mode Encapsulation Status Native vlan Fa0/24 on 802.1q trunking 1

SW1#show int f0/24 switchport Name: Fa0/24 Switchport: Enabled Administrative Mode: trunk Operational Mode: trunk Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: dot1q Negotiation of Trunking: On Access Mode VLAN: 1 (default) Trunking Native Mode VLAN: 1 (default) Voice VLAN: none Administrative private-vlan host-association: none Administrative private-vlan mapping: none Administrative private-vlan trunk native VLAN: none Administrative private-vlan trunk encapsulation: dot1q Administrative private-vlan trunk normal VLANs: none Administrative private-vlan trunk private VLANs: none Operational private-vlan: none Trunking VLANs Enabled: ALL Pruning VLANs Enabled: 2-1001 Capture Mode Disabled Capture VLANs Allowed: ALL Protected: falseAppliance trust: none SW1# SW2: SW2#sho run int f0/24 interface FastEthernet0/24 switchport mode trunk end SW2#show int trunk Port Mode Encapsulation Status Native vlan Fa0/24 on 802.1q trunking 1

百思学网络,领先科技 -36- HTTP://WWW.BESTXUE.CN

6.配置 VLAN 1).创建 VLAN SW1(config)#vlan 2 //创建 VLAN2 SW1(config)#name VLAN2 //命名为 VLAN2,默认为 vlan002,命名是可选命令 2).将端口加入 VLAN

SW1(config-if)#switchport mode access //设配端口为 access 模式 SW1(config-if)#switchport access vlan 2 //把端口加到 vlan2 3).检查的命令 Switch#show vlan 例子: 创建 VLAN2 命令为 widom , 创建 VLAN3 命令为 market 把端口 F0/4 加入 VLAN2 SW1#config t

SW1(config)#vlan 2 SW1(config-vlan)#name wisdom SW1(config-vlan)#exit SW1(config)#vlan 3 SW1(config-vlan)#name market SW1(config-vlan)#exit SW1(config)#int fas0/4

SW1(config-if)#switchport mode access SW1(config-if)#switchport access vlan 2 可以同时把多个端口加入到相应 VLAN SW1(config)#interface range fastEthernet 0/10 – 15 //可以同时把多个端口加入到一个 VLAN 里 SW1(config-if-range)#switchport mode access

SW1(config-if-range)#switchport access vlan 3 //把端口 10-15 都加入到 VLAN3 里 SW1#show vlan //检查 VLAN 信息 VLAN Name Status Ports ---- -------------------------------- ---------

------------------------------- 1 default active Fa0/1, Fa0/5, Fa0/6, Fa0/7 Fa0/8, Fa0/9, Fa0/16, Fa0/17 Fa0/18, Fa0/19, Fa0/20, Fa0/21 Fa0/22, Fa0/23, Fa0/24 2 wisdom active Fa0/4 3 market active Fa0/10, Fa0/11, Fa0/12 Fa0/13, Fa0/14, Fa0/15 SW1# 7.配置 VTP----VTP 技术使得在大型的网络里布置多个 VLAN 变得简单. VTP 的配置步骤: 1、配置 Trunk (交换机和交换机相连的端口要设置为 TRUNK) 2、配置 VTP DOMAIN 3、配置 VTP MODE 4、配置 VLAN 5、将端口加入 VLAN 6、检查

百思学网络,领先科技 -37- HTTP://WWW.BESTXUE.CN

Switch#show interface xx/xx switchport //查看相应该接口的 trunk 状态 Switch#show vtp status //查看 vtp 状态 Switch#show vlan //查看 VLAN

配置 SW1: SW1#configure terminal SW1(config)#interface fastEthernet 0/24

SW1(config-if)#switchport mode trunk SW1(config-if)#no shutdown SW1(config-if)#exit SW1(config)#vtp domain wisdom Domain name already set to wisdom. SW1(config)#vtp mode server Device mode already VTP SERVER. SW1(config)#vtp password cisco Setting device VLAN database password to cisco SW1(config)#vtp pruning //配置 VTP 的修剪,只要在 SERVER 端配置就行. Pruning switched on SW1#sho vtp status VTP Version : 2 Configuration Revision : 1 Maximum VLANs supported locally : 64 Number of existing VLANs : 5 VTP Operating Mode : Server VTP Domain Name : wisdom VTP Pruning Mode : Enabled VTP V2 Mode : Disabled VTP Traps Generation : Disabled MD5 digest : 0xE8 0x5A 0x7D 0xB1 0x0E 0xBC 0xEB 0x1F Configuration last modified by 11.1.1.2 at 3-1-93 02:56:31 Local updater ID is 11.1.1.2 on interface Vl1 (lowest numbered VLAN interface found) 创建 VLAN2 VLAN3 VLAN4 VLAN5

SW1(config)#vlan 2 SW1(config-vlan)#vlan 3 SW1(config-vlan)#vlan 4 SW1(config-vlan)#vlan 5 SW1(config-vlan)# 在 SW1 上创建 VLAN 后查看修订版本: SW1#show vtp status

SW2 SW1

百思学网络,领先科技 -38- HTTP://WWW.BESTXUE.CN

VTP Version : 2 Configuration Revision : 5 Maximum VLANs supported locally : 128 Number of existing VLANs : 9 VTP Operating Mode : Server VTP Domain Name : wisdom VTP Pruning Mode : Enabled VTP V2 Mode : Disabled VTP Traps Generation : Disabled MD5 digest : 0x9C 0x64 0xD6 0x44 0x5E 0x54 0x9E 0xFC Configuration last modified by 11.1.1.2 at 3-1-93 02:59:04 Local updater ID is 11.1.1.2 on interface Vl1 (lowest numbered VLAN interface found) 在交换机 SW1 上检查已创建的 VLAN SW1#sho vlan VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa0/1, Fa0/5, Fa0/6, Fa0/7 Fa0/8, Fa0/9, Fa0/16, Fa0/17 Fa0/18, Fa0/19, Fa0/20, Fa0/21 Fa0/22, Fa0/23, Fa0/24 2 VLAN0002 active 3 VLAN0003 active 4 VLAN0004 active 5 VLAN0005 active

检查 trunk 端口: SW1#show interfaces fastEthernet 0/24 switchport Name: Fa0/24 Switchport: Enabled Administrative Mode: trunk Operational Mode: trunk

Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: dot1q Negotiation of Trunking: On Access Mode VLAN: 1 (default) Trunking Native Mode VLAN: 1 (default) Voice VLAN: none Administrative private-vlan

host-association: none Administrative private-vlan mapping: none Administrative

private-vlan trunk native VLAN: none Administrative private-vlan trunk encapsulation: dot1q Administrative private-vlan trunk normal VLANs: none Administrative private-vlan trunk private VLANs: none

Operational private-vlan: none Trunking VLANs Enabled: ALL Pruning VLANs Enabled:

百思学网络,领先科技 -39- HTTP://WWW.BESTXUE.CN

2-1001 Capture Mode Disabled Capture VLANs Allowed: ALL Protected: false Appliance trust: none 配置 SW2: Switch# Switch#config t Enter configuration commands, one per line. End with CNTL/Z. SW2(config)#hostname SW2 SW2(config)#int fastEthernet 0/24 SW2(config-if)#switchport mode trunk SW2(config-if)#exit SW2(config)#vtp domain wisdom Changing VTP domain name from test to wisdom SW2(config)#vtp mode client Setting device to VTP CLIENT mode. SW2(config)#vtp password cisco Setting device VLAN database password to cisco SW2(config)# 查看 F0/24 的 trunk 状态: SW2#show interfaces fastEthernet 0/24 switchport Name: Fa0/24 Switchport: Enabled Administrative Mode: trunk Operational Mode: trunk Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: dot1q Negotiation of Trunking: On Access Mode VLAN: 1 (default) Trunking Native Mode VLAN: 1 (default) Voice VLAN: none Administrative private-vlan host-association: none Administrative private-vlan mapping: none Administrative private-vlan trunk native VLAN: none Administrative private-vlan trunk encapsulation: dot1q Administrative private-vlan trunk normal VLANs: none Administrative private-vlan trunk private VLANs: none Operational private-vlan: none Trunking VLANs Enabled: ALL Pruning VLANs Enabled: 2-1001 Capture Mode Disabled Capture VLANs Allowed: ALL Protected: false Appliance trust: none 查看 VTP 状态: SW2#show vtp status VTP Version : 2 百思学网络,领先科技 -40- HTTP://WWW.BESTXUE.CN

Configuration Revision : 5 Maximum VLANs supported locally : 128 Number of existing VLANs : 9 VTP Operating Mode : Client VTP Domain Name : wisdom VTP Pruning Mode : Enabled VTP V2 Mode : Disabled VTP Traps Generation : Disabled MD5 digest : 0x9C 0x64 0xD6 0x44 0x5E 0x54 0x9E 0xFC Configuration last modified by 11.1.1.2 at 3-1-93 02:59:04 ----------此处可以看到 SW2 的 VLAN 信息是从 SW1-11.1.1.2 同步过来的 SW2#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active 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 2 VLAN0002 active 3 VLAN0003 active 4 VLAN0004 active 5 VLAN0005 active

实验结果: SW2 不用配置 VLAN,已同步了 SW1 的 VLAN 信息.实验成功 SW2 同步 VTP SERVER 的 VLAN 后,接下来的操作就是安要求把相应的端口加入到相应的 VLAN

百思学网络,领先科技 -41- HTTP://WWW.BESTXUE.CN

实验10. 配置生成树(Spanning Tree)

本实验只讨论 CST(公共的生成树) 一、实验前先理解生成树决策的 4 个步骤: 二、实验拓扑

1. 实验描述: 由于业务的要求,要有可靠的链路,要对链路实现冗余,但链路的冗余有可能给网络带来广播风暴,重复 帧,MAC 地址表不稳定的问题,Spanning Tree protocol 在可以实现冗余的同时又可以解决以上三个问题. 2.实验 1:验证 CST(公共生成树) CST 是 IEEE 在虚拟局域网上处理生成树的特有方法,这是一种 VLAN 解决方案,称为单一或者公 共生成树。生成树协议运行在 VLAN1 即缺省的 VLAN 上。所有的交换机都举出同一个根网桥,并建立与 该根网桥的关系 CISCO 的交换机默认就启用了生成树 Spanning Tree protocol,不需配置就可以实现链路冗余能力. 实验拓扑:

实验拓扑描述: 在以上交换网络拓扑中只有交换机默认存在的 VLAN1,交换机默认情况下所有端口属于 VLAN1。 根据以上拓扑,也就是只有 VLAN1 存在的情况下我们来验证 CST(公共生成树)建议手工配置 SW1,SW2 的 F0/23,F0/24 接口的 trunk 模式 配置 SW1〆

SW1(config)#int range fastEthernet 0/23 – 24 -----注:进入一个接口范围,同时对多个端口进行配置 SW1(config-if-range)#switchport mode trunk SW1(config-if-range)#no shutdown 配置 SW2〆 SW2(config)#int range fastEthernet 0/23 - 24 SW2(config-if-range)#switchport mode trunk SW2(config-if-range)#no shutdown

百思学网络,领先科技 -42- HTTP://WWW.BESTXUE.CN

在 SW1 上用 show spanning-tree 验证生成树: SW1#show spanning-tree VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 32769 Address 0008.20ff.6400 This bridge is the root ------------------------注: SW1 为根网桥 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec -------------注:根交换机的网桥 ID Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Address 0008.20ff.6400 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 15 ------注: SW1 的网桥 ID Interface Role Sts Cost Prio.Nbr Type Fa0/23 Desg FWD 19

Fa0/24 Desg FWD 19

128.24 P2p

---------------- ---- --- --------- -------- -------------------------------- 128.23 P2p

注: Desg:表示 F0/23 为指定端口 FWD 表示:端口的生树成状态 为转发状态表示 F0/23 到根网桥 的花费为 19 128.23:这里 128 表 示端口优先级,23 表示端口号, 这里可以先不用考虑这个。 ------------------------------- 注: CST 是 IEEE 在虚拟局域网上处理生成树的特有方法,这是一种 VLAN 解决方案,称为单一或者公共生成树。生成树协议运行在 VLAN1 即缺省的 VLAN 上。 在 SW2 上用 show spanning-tree 验证生成树〆

SW2#show spanning-tree VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 32769 -----------------------------注:根交换机的网桥 ID Address 0008.20ff.6400 Cost 19 Port 23 (FastEthernet0/23) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Address 000d.bce7.5940 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 300 ------------------- SW2 的网桥 ID Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- --------------------------------

Fa0/23 Root FWD 19 128.23 P2p Fa0/24 Altn BLK 19 128.24 P2p

注:解释:F0/24 为 altn(后备端口),端口的生成树状态为 BLK(blocking)状态,