2022年思科交换机中文配置手册借鉴

上传人:ni****g 文档编号:567308830 上传时间:2024-07-19 格式:PDF 页数:16 大小:147.05KB
返回 下载 相关 举报
2022年思科交换机中文配置手册借鉴_第1页
第1页 / 共16页
2022年思科交换机中文配置手册借鉴_第2页
第2页 / 共16页
2022年思科交换机中文配置手册借鉴_第3页
第3页 / 共16页
2022年思科交换机中文配置手册借鉴_第4页
第4页 / 共16页
2022年思科交换机中文配置手册借鉴_第5页
第5页 / 共16页
点击查看更多>>
资源描述

《2022年思科交换机中文配置手册借鉴》由会员分享,可在线阅读,更多相关《2022年思科交换机中文配置手册借鉴(16页珍藏版)》请在金锄头文库上搜索。

1、3560 客户中文配置手册第 1 章 概述1-1 1.1 概述1-1 1.2 初次访问设备1-2 1.2.1 通过 Console 口访问设备1-2 第 2 章 命令行方式访问设备2-1 2.1.1 命令行模式2-1 2.1.2 基本设置命令2-1 2.2 通过 Console 口进入命令行接口2-2 2.3 通过 Telnet 进入命令行接口2-2 第 3 章 接口配置3-1 3.1 概述3-1 3.2 二层口配置3-1 3.2.1 配置端口速率及双工模式3-1 3.3 配置一组端口3-2 3.4 配置三层口3-3 3.5 监控及维护端口3-5 3.5.1 监控端口和控制器的状态3-5 3.

2、5.2 刷新、重置端口及计数器3-7 3.5.3 关闭和打开端口3-8 3.6 交换机端口镜像配置3-9 3.6.1 创建一个本地SPAN 会话3-10 3.7 以太通道端口组(Ethernet Port Groups)3-11 第 4 章 配置 VLAN 4-12 4.1 简介4-12 4.2 可支持的 VLAN 4-12 4.3 配置正常范围的VLAN 4-12 4.3.1 删除 VLAN 4-14 4.3.2 将端口分配给一个VLAN 4-15 4.4 配置 VLAN Trunks 4-16 4.5 配置 VTP DOMAIN 4-18 4.6 配置 VLAN 接口地址4-18 第 5

3、章 交换机 HSRP 配置5-1 第 6 章 路由协议配置6-3 6.1.1 静态路由6-3 6.1.2 RIP 路由6-3 6.1.3 OSPF 路由6-5 第 1 章概述1.1 概述3560 交换机是支持二层、三层功能的交换机,共分为EMI,SMI 两个版本Enhanced Multilayer Software Image增强多层软件镜像软件(EMI) ?EMI 提供了一组更加丰富的企业级功能,包括基于硬件的高级IP 单播和多播路由。名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - -

4、第 1 页,共 16 页 - - - - - - - - - ?支持双机热备 (HSRP),OSPF 路由功能 . Standard Multilayer Software Image标准多层软件镜像软件(SMI) ?SMI 功能集包括高级QoS、 速率限制、 访问控制列表 (ACL) , 以及基本的静态和路由信息协议(RIP)路由功能支持 VLAN 到 1005 个 VLAN 支持 VLAN ID 从 1 到 4094 ( IEEE 802.1Q 标准)支持 ISL 及 IEEE 802.1Q 封装安全支持 IOS 标准的密码保护静态 MAC 地址映射标准及扩展的访问列表支持,对于路由端口支

5、持入出双向的访问列表,对于二层端口支持入的访问列表支持基于 VLAN 的访问列表3 层支持(需要多层交换的IOS)HSRP IP 路由协议o RIPversions 1 and 2 o OSPF o IGRP 及 EIGRP o BGPVersion 4 支持以下 SFP模块 : 1000BASE-T SFP: 铜线最长100 m 1000BASE-SX SFP: 光纤最长 1804 feet (550 m) 1000BASE-LX/LH SFP: 光纤最长 32,808 feet (6 miles or 10 km) 1000BASE-ZX SFP: 光纤最长 328,084 feet (6

6、2 miles or 100 km) 管理从用户与设备交互的特点来分,访问设备的方式可以分为命令行方式和Web 方式。l 命令行方式:包括从Console 口登录进行访问和通过Telnet 登录进行访问;l Web 方式:包括通过HTTP 进行的普通Web 访问。1.2 初次访问设备1.2.1 通过 Console 口访问设备用户接收到除去包装的新设备后一般通过Console 口第一次登录设备并开始对设备进行配置,过程如下:第一步:建立本地配置环境,只需将计算机(或终端)的串口通过标准RS-232 电缆与此 Catalyst 3560设备的 Console 口连接第二步: 在计算机上运行终端仿

7、真程序(如 WinXP 的超级终端等) ,设置终端通信参数为9600bps 、8 位数据位、 1 位停止位、无奇偶校验和无流量控制,如图1-1 至图 1-3 所示。图 1-1 新建连接图 1-2 连接端口设置名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 16 页 - - - - - - - - - 图 1-3 端口通信参数设置第四步: Catalyst 3560设备上电自检,出现命令行提示符,如: Switch 。此时用户已经进入到设备命令行配置接口的用户模式,从这里开

8、始就可以参考本手册其余章节对设备进行配置。第 2 章命令行方式访问设备如果用户通过Console 口登录,或者通过Telne 从设备管理口登录都将进入到设备的命令行接口,对系统的配置和交互都通过命令行的方式进行。2.1.1 命令行模式命令行接口提供的命令行视图和各视图的功能特性、进入各视图的命令等的细则如表2-1 所示。表 2-1 命令视图功能特性列表模式功能提示符进入命令退出命令非特权模式查看CISCO 设备的简单运行状态Switch 开机时自动进入特权模式配置系统参数,升级 IOS 软件,备份配置文件Switch# 在非特权模式下键入 ENABLE quit 返回非特权模式全局模式CISC

9、O 交换机大部分配置都是在这个模式下进行Switch(config)# 在特权模式下键入configure terminal quit 返回特权模式监控模式升级 IOS 系统软件Switch :开机时摁住面板上的 MODE 键约 5 秒钟2.1.2 基本设置命令基本设置命令任务命令全局设置config terminal 设置访问用户及密码Username username password password 设置特权密码enable secret password 设置路由器名Hostname name 设置静态路由ip route destination subnet-mask next-h

10、op 启动 IP 路由ip routing 启动 IPX 路由ipx routing 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 16 页 - - - - - - - - - 端口设置interface type slot/number 设置 IP 地址ip address address subnet-mask 设置 IPX 网络ipx network network 激活端口no shutdown 物理线路设置line type number 启动登录进程logi

11、n local|tacacs server 设置登录密码Password password 显示命令任务命令查看版本及引导信息show version 查看运行设置show running-config 查看开机设置show startup-config 显示端口信息show interface type slot/number 显示路由信息show ip route 2.2 通过 Console 口进入命令行接口详细内容请参见“1.2.1 通过 Console 口访问设备”。2.3 通过 Telnet 进入命令行接口Telnet 协议在 TCP/IP 协议族中属于应用层协议,通过网络提供远程

12、登录和虚拟终端功能。CATALYST 3560向用户提供 Telnet 服务,第一步:在计算机上运行Telnet 程序,键入CATALYST 3560 设备管理IP 地址Switchenable Switch#conf t Switch(config)# interface vlan 1 Switch(config-if)#ip address 10.1.1.20 255.255.255.0 Switch(config-if)#no shutdown Switch(config-if)#exit Switch(config)#line vty 0 4 Switch(config line)#l

13、ogin Switch(config line)#password cisco 如图 2-1 所示。图 2-1 与 CATALYST 3560 建立 Telnet 连接& 说明:图 2-1 中的 IP 地址为 CATALYST 3560 设备 IP 地址,即 vlan1 的接口地址第 3 章接口配置3.1 概述Catalyst 3560支持的以太网接口说明请见下表。表 3-1 Catalyst 3560接口说明项目说明接口类型FE电接口:符合100Base-TX 物理层规范GE 电接口: 1000Base-TX 物理层规范工作速率FE 电接口可以选择10Mbit/s 、100Mbit/s两种速

14、率名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 16 页 - - - - - - - - - GE 电接口可以选择10Mbit/s 、100Mbit/s 、1000Mbit/s三种速率工作模式自动协商模式3.2 二层口配置3560 的所有端口缺省的端口都是二层口,如果此端口已经配置成三层端口的话,则需要用 switchport来使其成为二层端口。3.2.1 配置端口速率及双工模式1. 可以配置快速以太口的速率为10/100Mbps及千兆以太口的速率为10/100/100

15、0-Mbps; 但对于 SFP 端口则不能配置速率及双工模式,有时可以配置nonegotiate, 当需要联接不支持自适应的其它千兆端口时表 3-2 管理口配置命令目的Step 1 configure terminal 进入配置状态 . Step 2 interface interface-id 进入端口配置状态. Step 3 speed 10 | 100 | 1000 | auto | nonegotiate 设置端口速率注 1000 只工作在千兆口 . GBIC 模块只工作在1000 Mbps 下. nonegotiate 只能在这些GBIC 上用1000BASE-SX, -LX, an

16、d -ZX GBIC. Step 4 duplex auto | full | half 设置全双工或半双工. Step 5 end 退出Step 6 show interfaces interface-id 显示有关配置情况Step 7 copy running-config startup-config 保存Switch# configure terminal Switch(config)# interface fastethernet0/3 Switch(config-if)# speed 10 Switch(config-if)# duplex half 3.3 配置一组端口命令目的S

17、tep 1 configure terminal 进入配置状态Step 2 interface range port-range 进入组配置状态Step 3 可以使用平时的端口配置命令进行配置Step 4 end 退回Step 5 show interfaces interface-id 验证配置Step 6 copy running-config startup-config 保存见以下例子 : Switch# configure terminal Switch(config)# interface range fastethernet0/1 - 5 Switch(config-if-ran

18、ge)# no shutdown Switch(config-if-range)# 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 16 页 - - - - - - - - - *Oct 6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up *Oct 6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/2, changed s

19、tate to up *Oct 6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to up *Oct 6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/4, changed state to up *Oct 6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/5, changed state to up *Oct 6 08:24:36: %LINEPROTO-5-UPDOWN: Line protoc

20、ol on Interface FastEthernet0/05, changed state to up *Oct 6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up *Oct 6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up 以下的例子显示使用句号来配置不同类型端口的组: Switch# configure

21、terminal Switch(config)# interface range fastethernet0/1 - 3, gigabitethernet0/1 - 2 Switch(config-if-range)# no shutdown Switch(config-if-range)# *Oct 6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up *Oct 6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet0/2, changed state

22、 to up *Oct 6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to up *Oct 6 08:29:28: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to up *Oct 6 08:29:28: %LINK-3-UPDOWN: Interface GigabitEthernet0/2, changed state to up *Oct 6 08:29:29: %LINEPROTO-5-UPDOWN: Line prot

23、ocol on Interface GigabitEthernet0/ 1, changed state to up *Oct 6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/ 2, changed state to up *Oct 6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/ 3, changed state to up 3.4 配置三层口Catalyst 3560支持三种类型的三层端口:

24、SVIs: 即 interface vlan Note 当生成一个interface Vlan时,只有当把某一物理端口分配给它时才能被激活三层以太网通道口(EtherChannel ): :以太通道由被路由端口组成。以太通道端口接口在“配置以太通道”中被描述。 . 路由口:路由口是指某一物理端口在端口配置状态下用no switchport命令生成的端口所有的三层都需要IP 地址以实现路由交换配置步骤如下:命令目的Step 1 configure terminal 进入配置状态Step 2 interface fastethernet | gigabitethernet interface-id

25、 | vlan vlan-id | port-channel 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 16 页 - - - - - - - - - port-channel-number 进入端口配置状态Step 3 no switchport 把物理端口变成三层口Step 4 ip address ip_address subnet_mask 配置 IP 地址和掩码Step 5 no shutdown 激活端口Step 6 End 退出Step 7 show i

26、nterfaces interface-idshow ip interface interface-idshow running-config interface interface-id 验证配置Step 8 copy running-config startup-config 保存配置配置举例如下:Switch# configure terminal Enter configuration commands, one per line. End with CNTL/Z. Switch(config)# interface gigabitethernet0/2 Switch(config-i

27、f)# no switchport Switch(config-if)# ip address 192.20.135.21 255.255.255.0 Switch(config-if)# no shutdown Switch(config-if)# end 3.5 监控及维护端口3.5.1 监控端口和控制器的状态主要命令见下表:Show Commands for Interfaces Command 目的show interfaces interface-id 显示所有端口或某一端口的状态和配置. show interfaces interface-id status err-disable

28、d 显示一系列端口的状态或错误关闭的状态show interfaces interface-id switchport 显示二层端口的状态,可以用来决定此口是否为二层或三层口。show interfaces interface-id description 显示端口描述show ip interface interface-id 显示所有或某一端口的IP 可用性状态show running-config interface interface-id 显示当前配置中的端口配置情况show version 显示软硬件等情况举例如下 : Switch# show interfaces status

29、Port Name Status Vlan Duplex Speed Type Gi0/1 connected routed a-full a-100 10/100/1000Base TX Gi0/2 wce server 20.20.2 disabled routed auto auto 10/100/1000Base TX Gi0/3 ip wccp web-cache notconnect routed auto auto 10/100/1000Base TX Gi0/4 notconnect routed auto auto 10/100/1000Base TX 名师资料总结 - -

30、-精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 16 页 - - - - - - - - - Gi0/5 notconnect routed auto auto 10/100/1000Base TX Gi0/6 disabled routed auto auto 10/100/1000Base TX Gi0/7 disabled routed auto auto 10/100/1000Base TX Gi0/8 disabled routed auto 100 10/100/1000Base

31、TX Gi0/9 notconnect routed auto auto 10/100/1000Base TX Gi0/10 notconnect routed auto auto 10/100/1000Base TX Gi0/11 disabled routed auto auto unknown Gi0/12 notconnect routed auto auto unknown Switch# show interfaces fastethernet 0/1 switchport Name: Fa0/1 Switchport: Enabled Administrative Mode: s

32、tatic access Operational Mode: down Administrative Trunking Encapsulation: dot1q Negotiation of Trunking: Off Access Mode VLAN: 1 (default) Trunking Native Mode VLAN: 1 (default) Trunking VLANs Enabled: ALL Pruning VLANs Enabled: 2-1001 Protected: false Unknown unicast blocked: disabled Unknown mult

33、icast blocked: disabled Voice VLAN: dot1p (Inactive) Appliance trust: 5 Switch# show running-config interface fastethernet0/2 Building configuration. Current configuration : 131 bytes ! interface FastEthernet0/2 switchport mode access switchport protected no ip address mls qos cos 7 mls qos cos over

34、ride end 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 8 页,共 16 页 - - - - - - - - - 3.5.2 刷新、重置端口及计数器Clear 命令目的clear counters interface-id 清除端口计数器 . clear interface interface-id 重置某一端口的硬件逻辑clear line number | console 0 | vty number 重置异步串口的硬件逻辑Note clear counters 命令只

35、清除用show interface所显示的计数,不影响用snmp 得到的计数举例如下:Switch# clear counters fastethernet0/5 Clear show interface counters on this interface confirm y Switch# *Sep 30 08:42:55: %CLEAR-5-COUNTERS: Clear counter on interface FastEthernet0/5 by vty1 (171.69.115.10) 可使用 clear interface 或 clear line 命令来清除或重置某一端口或串口

36、,在大部分情况下并不需要这样做: Switch# clear interface fastethernet0/5 3.5.3 关闭和打开端口命令目的Step 1 configure terminal 进入配置状态Step 2 interface vlan vlan-id | fastethernet | gigabitethernet interface-id | port-channel port-channel-number 选择要关闭的端口Step 3 Shutdown 关闭Step 4 End 退出Step 5 show running-config 验证使用 no shutdown

37、命令重新打开端口. 举例如下 : Switch# configure terminal Switch(config)# interface fastethernet0/5 Switch(config-if)# shutdown Switch(config-if)# *Sep 30 08:33:47: %LINK-5-CHANGED: Interface FastEthernet0/5, changed state to a administratively down Switch# configure terminal Switch(config)# interface fastetherne

38、t0/5 Switch(config-if)# no shutdown Switch(config-if)# *Sep 30 08:36:00: %LINK-3-UPDOWN: Interface FastEthernet0/5, changed state to up 3.6 交换机端口镜像配置名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 9 页,共 16 页 - - - - - - - - - 端口镜像的数据流程基于端口的镜像是把被镜像端口的进出数据报文完全拷贝一份到镜像端口,

39、这样来进行流量观测或者故障定位。Figure 27-1 Example of Local SPAN Configuration on a Single Switch 3.6.1 创建一个本地SPAN 会话Beginning in privileged EXEC mode, follow these steps to create a SPAN session and specify the source (monitored) ports or VLANs and the destination (monitoring) ports: Command Purpose Step 1 config

40、ure terminal Enter global configuration mode. Step 2 no monitor session session_number | all | local | remote Remove any existing SPAN configuration for the session. For session_number, the range is 1 to 66. Specify all to remove all SPAN sessions, local to remove all local sessions, or remote to re

41、move all remote SPAN sessions. Step 3 monitor session session_number source interface interface-id | vlan vlan-id , | - both | rx | tx Specify the SPAN session and the source port (monitored port). For session_number, the range is 1 to 66. For interface-id, specify the source port or source VLAN to

42、monitor . ? For source interface-id, specify the source port to monitor . Valid interfaces include physical interfaces and port-channel logical interfaces (port-channel port-channel-number). Valid port-channel numbers are 1 to 48. ? For vlan -id, specify the source VLAN to monitor. The range is 1 to

43、 4094 (excluding the RSPAN VLAN). Note A single session can include multiple sources (ports or VLANs), defined in a series of commands, but you cannot combine source ports and source VLANs in one session. (Optional) , | - Specify a series or range of interfaces. Enter a space before and after the co

44、mma; enter a space before and after the hyphen. (Optional) Specify the direction of traffic to monitor. If you do not specify a traffic direction, the SPAN monitors both sent and received traffic. ? both Monitor both received and sent traffic. This is the default. ? rx Monitor received traffic. ? tx

45、 Monitor sent traffic. Note You can use the monitor session session_number source command multiple times to configure multiple source ports. Step 4 monitor session session_number destination interface interface-id , | - encapsulation replicate Specify the SPAN session and the destination port (monit

46、oring port). For session_number , specify the session number entered in step 3. Note For local SPAN, you must use the same session number for the source and destination interfaces. For interface-id, specify the destination port. The destination interface must be a physical port; it cannot be an Ethe

47、rChannel, and it cannot be a VLAN. (Optional) , | - Specify a series or range of interfaces. Enter a space before and after the comma; enter a space before and after the hyphen. (Optional) Enter encapsulation replicate to specify that the destination interface replicates the source interface encapsu

48、lation method. If not selected, the default is to send packets in native form (untagged). Note You can use monitor session session_number destination command multiple times to configure multiple destination ports. Step 5 end Return to privileged EXEC mode. Step 6 show monitor session session_number

49、show running-config Verify the configuration. Step 7 copy running-config startup-config (Optional) Save the configuration in the configuration file. 举例:通过交换机的第2 号口监控第1 号口的流量Switch(config)# monitor session 1 source interface gigabitethernet0/1 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - -

50、名师精心整理 - - - - - - - 第 10 页,共 16 页 - - - - - - - - - Switch(config)# monitor session 1 destination interface gigabitethernet0/2 Switch(config)# end 删除一个 span 会话 : Switch(config)# no monitor session 1 source interface gigabitethernet0/1 Switch(config)# end 3.7 以太通道端口组(Ethernet Port Groups)以太通道端口组提供把多

51、个交换机端口像一个交换端口对待。这些端口组为交换机之间或交换机和服务器之间提供一条单独的高带宽连接的逻辑端口。以太通道在一个通道中提供穿越链路的负载平衡。如果以太通道中的一个链路失效,流量会自动从失效链路转移到被用链路。你可以把多干道端口加到一个逻辑的干道端口;把多访问端口加到一个逻辑访问端口;或者多隧道端口加到一个逻辑的隧道接口。绝大多数的协议能够在单独或是集合的接口上运行,并且不会意识到在端口组中的物理端口。除了DTP、CDP和 PAgP,这些协议只能在物理接口上运行。当你配置一个以太通道,你创建一个端口通道逻辑接口,并且指派一个接口给以太通道。对于三层接口,你人工创建该逻辑接口:Figu

52、re 33-1 Typical EtherChannel Configuration 举例:把交换机A,B 的 1,2 号口添加到同一个组5 里面SwitchA# configure terminal SwitchA (config)# interface range gigabitethernet0/1 -2 SwitchA (config-if-range)# switchport mode access SwitchA (config-if-range)# switchport access vlan 10 SwitchA (config-if-range)# channel-group

53、 5 mode ON Switch(config-if-range)# end SwitchB# configure terminal SwitchB(config)# interface range gigabitethernet0/1 -2 SwitchB(config-if-range)# switchport mode access SwitchB(config-if-range)# switchport access vlan 10 SwitchB(config-if-range)# channel-group 5 mode ON SwitchB(config-if-range)#

54、end 第 4 章配置 VLAN 4.1 简介VLAN(Virtual Local Area Network) ,是一种通过将局域网内的设备逻辑地而不是物理地划分成一个个网段从而实现虚拟工作组的技术。IEEE 于 1999 年颁布了用以标准化VLAN 实现方案的IEEE 802.1Q 协议标准草案。VLAN 技术允许网络管理者将一个物理的LAN 逻辑地划分成不同的广播域(或称虚拟LAN,即 VLAN) ,每一个 VLAN 都包含一组有着相同需求的计算机,由于VLAN 是逻辑地而不是物理地划分,所以同一个VLAN内的各个计算机无须被放置在同一个物理空间里,即这些计算机不一定属于同一个物理LAN

55、网段。VLAN 的优势在于VLAN 内部的广播和单播流量不会被转发到其它VLAN 中,从而有助于控制网络流量、减少设备投资、简化网络管理、提高网络安全性。4.2 可支持的 VLAN Catalyst 3560交换机支持1005 个 VLAN,可以分别是VTPclient, server , 及 transparent modes. VLAN号可以从 1 到 4094. VLAN 号 1002 到 1005 保留给令牌环及FDDI VLAN. VTP 只能学习到普通范围的VLAN, 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - -

56、名师精心整理 - - - - - - - 第 11 页,共 16 页 - - - - - - - - - 即从 VLAN 到 1 到 1005; VLAN 号大于 1005 属于扩展 VLAN,不存在 VLAN数据庫中。交换机必须配置成VTP 透明模式当需要生成VLAN 号从 1006 到 4094. 本交换机支持基于每一VLAN 的生成树 (PVST),最多支持 128 个生成树。本交换机支持ISL 及 IEEE 802.1Q trunk 二种封装。4.3 配置正常范围的VLAN VLAN 号 1, 1002 到 1005 是自动生成的不能被去掉。VLAN 号 1 到 1005 的配置被写到

57、文件vlan.dat 中, 可以用 show vlan 命令查看,vlan.dat 文件存放在NVRAM 中. 命令目的Step 1 configure terminal 进入配置状态Step 2 vlan vlan-id 输入一个VLAN 号, 然后进入 vlan 配置状态,可以输入一个新的VLAN号或旧的来进行修改。Step 3 name vlan-name (可选 )输入一个 VLAN 名,如果没有配置VLAN 名,缺省的名字是VLAN 号前面用 0 填满的 4 位数,如 VLAN0004 是 VLAN4 的缺省名字Step 4 mtu mtu-size (可选 ) 改变 MTU 大小S

58、tep 5 end 退出Step 6 show vlan name vlan-name | id vlan-id 验证Step 7 copy running-config startup config (可选 ) 保存配置用 no vlan name 或 no vlan mtu 退回到缺省的vlan 配置状态举例如下 : Switch# configure terminal Switch(config)# vlan 20 Switch(config-vlan)# name test20 Switch(config-vlan)# end 也可以在 VLAN 状态下,进行VLAN 配置 : 命令目

59、的Step 1 vlan database 进入 VLAN 配置状态Step 2 vlan vlan-id name vlan-name 加入 VLAN 号及 VLAN 名Step 3 vlan vlan-id mtu mtu-size (可选 ) 修改 MTU 大小Step 4 exit 更新 VLAN 数据庫并退出Step 5 show vlan name vlan-name | id vlan-id 验证配置Step 6 copy running-config startup config 保存配置(可选)举例如下:Switch# vlan database Switch(vlan)#

60、vlan 20 name test20 Switch(vlan)# exit 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 12 页,共 16 页 - - - - - - - - - APPLY completed. Exiting. Switch# 4.3.1 删除 VLAN 当删除一个处于VTP 服务器的交换机上删除VLAN 时,则此 VLAN 将在所有相同VTP 的交换机上删除。当在透明模式下删除时,只在当前交换机上删除。注意当删除一个VLAN 时,原来属于此VLAN 的端口

61、将处于非激活的状态,直到将其分配给某一VLAN。命令目的Step 1 configure terminal 进入配置状态Step 2 no vlan vlan-id 删除某一VLAN. Step 3 end 退出Step 4 show vlan brief 验证Step 5 copy running-config startup config 保存也可用 vlan database 进入 VLAN 配置状态,用no vlan vlan-id 来删除。4.3.2 将端口分配给一个VLAN 命令目的Step 1 configure terminal 进入配置状态Step 2 interface i

62、nterface-id 进入要分配的端口Step 3 switchport mode access 定义二层口Step 4 switchport access vlan vlan-id 把端口分配给某一VLAN Step 5 end 退出Step 6 show running-config interface interface-id 验证端口的VLAN 号Step 7 show interfaces interface-id switchport 验证端口的管理模式和VLAN 情况Step 8 copy running-config startup-config 保存配置使用 default

63、 interface interface-id 还原到缺省配置状态。举例如下:Switch# configure terminal Enter configuration commands, one per line. End with CNTL/Z. Switch(config)# interface fastethernet0/1 Switch(config-if)# switchport mode access Switch(config-if)# switchport access vlan 2 Switch(config-if)# end Switch# 名师资料总结 - - -精品

64、资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 13 页,共 16 页 - - - - - - - - - 4.4 配置 VLAN Trunks 以太网端口有二种链路类型:Access 和 Trunk。Access 类型的端口只能属于1 个 VLAN,一般用于连接计算机的端口; Trunk 类型的端口可以属于多个VLAN,可以接收和发送多个VLAN 的报文,一般用于交换机之间连接的端口;这里的trunk 并不是端口干路的概念,即端口汇聚或者链路聚合,而是允许vlan 透传的一个概念。命令目的Step 1 con

65、figure terminal 进入配置状态Step 2 interface interface-id 进入端口配置状态Step 3 switchport trunk encapsulation isl | dot1q | negotiate 配置 trunk 封装 ISL 或802.1Q 或自动协商Step 4 switchport mode dynamic auto | desirable | trunk 配置 二层trunk模式。 dynamic auto 自动协商是否成为trunk dynamic desirable 把端口设置为trunk 如果对方端口是trunk, desirabl

66、e, 或自动模式trunk 设置端口为强制的trunk 方式,而不理会对方端口是否为 trunk Step 5 switchport access vlan vlan-id (可选 ) 指定一个缺省VLAN, 如果此端口不再是trunk Step 6 switchport trunk native vlan vlan-id 指定 802.1Q native VLAN号Step 7 end 退出Step 8 show interfaces interface-id switchport 显示有关 switchport 的配置Step 9 show interfaces interface-id

67、trunk 显示有关 trunk 的配置Step 10 copy running-config startup-config 保存配置举例:Switch# configure terminal Enter configuration commands, one per line. End with CNTL/Z. Switch(config)# interface fastethernet0/4 Switch(config-if)# switchport mode trunk Switch(config-if)# switchport trunk encapsulation dot1q Swi

68、tch(config-if)# end 缺省情况下 trunk 允许所有的VLAN 通过。可以使用switchport trunk allowed vlan remove vlan-list 来去掉某一 VLAN Command Purpose Step 1 configure terminal 进入配置状态Step 2 interface interface-id 进入端口配置Step 3 switchport mode trunk 配置二层口为trunk Step 4 switchport trunk allowed vlan add | all | except | remove vla

69、n-list ( 可选 ) 配置trunk 允许的 VLAN. 使用 add, all, except, remove关健字Step 5 end 退出Step 6 show interfaces interface-id switchport 验证 VLAN 配置情况 . Step 7 copy running-config startup-config 保存配置名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 14 页,共 16 页 - - - - - - - - - 回到允许所有V

70、LAN 通过时 , 可用 no switchport trunk allowed vlan 端口配置命令 . 举例如下 : Switch(config)# interface fastethernet0/1 Switch(config-if)# switchport trunk allowed vlan remove 2 Switch(config-if)# end 4.5 配置 VTP DOMAIN VTP DOMAIN 称为管理域。 交换 VTP 更新信息的所有交换机必须配置为相同的管理域。如果所有的交换机都以中继线相连,那么只要在核心交换机上设置一个管理域,网络上所有的交换机都加入该域,

71、这样管理域里所有的交换机就能够了解彼此的VLAN 列表。switch#vlan database 进入 VLAN 配置模式switch (vlan)#vtp domain COM 设置 VTP 管理域名称COM switch (vlan)#vtp server 设置交换机为服务器模式switch #vlan database 进入 VLAN配置模式switch (vlan)#vtp domain COM 设置 VTP 管理域名称COM switch (vlan)#vtp Client 设置交换机为客户端模式switch #vlan database 进入 VLAN配置模式switch (vla

72、n)#vtp domain COM 设置 VTP 管理域名称COM switch (vlan)#vtp Client 设置交换机为客户端模式switch #vlan database 进入 VLAN配置模式switch (vlan)#vtp domain COM 设置 VTP 管理域名称COM switch (vlan)#vtp Client 设置交换机为客户端模式注意:这里设置核心交换机为Server 模式是指允许在该交换机上创建、修改、删除VLAN 及其他一些对整个 VTP 域的配置参数,同步本VTP 域中其他交换机传递来的最新的VLAN 信息; Client 模式是指本交换机不能创建、删

73、除、修改VLAN 配置,也不能在NVRAM 中存储 VLAN 配置,但可同步由本VTP 域中其他交换机传递来的VLAN 信息。4.6 配置 VLAN 接口地址到这里, VLAN 已经基本划分完毕。但是,VLAN 间如何实现三层(网络层)交换呢?这时就要给各VLAN分配网络( IP)地址了。给VLAN 分配 IP 地址分两种情况,其一,给VLAN 所有的节点分配静态IP 地址;其二,给 VLAN 所有的节点分配动态IP 地址。下面就这两种情况分别介绍。假设给 VLAN COUNTER 分配的接口Ip 地址为 172.16.58.1/24,网络地址为: 172.16.58.0 ,VLAN MARK

74、ET 分配的接口Ip 地址为 172.16.59.1/24 ,网络地址为:172.16.59.0 ,VLAN MANAGING 分配接口 Ip 地址为 172.16.60.1/24, 网络地址为172.16.60.0 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 15 页,共 16 页 - - - - - - - - - (1) 给 VLAN 所有的节点分配静态IP 地址。首先在核心交换机上分别设置各VLAN 的接口 IP 地址。核心交换机将vlan 做为一种接口对待,就象路由器上

75、的一样,如下所示:switch(config)#interface vlan 10 switch (config-if)#ip address 172.16.58.1 255.255.255.0 VLAN10接口 IP switch (config)#interface vlan 11 switch (config-if)#ip address 172.16.59.1 255.255.255.0 VLAN11接口 IP switch (config)#interface vlan 12 switch (config-if)#ip address 172.16.60.1 255.255.255.0 VLAN12接口 IP 再在各接入 VLAN 的计算机上设置与所属VLAN 的网络地址一致的IP 地址, 并且把默认网关设置为该VLAN的接口地址。这样,所有的VLAN 也可以互访了。名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 16 页,共 16 页 - - - - - - - - -

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 建筑/环境 > 施工组织

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号