配置第二层接口
这些部分描述了缺省接口配置以及那些你可以在大多数物理接口上配置的可选项:
缺省第二层以太网接口配置
配置接口速度和双工模式
配置IEEE802.3X流控制
为一个接口添加一个描述
注意:进入接口配置模式以后,如果接口在第三层模式,你必须输入不带任何参数
(interface) switchport 以把该接口放入第二层模式。这样会关闭接口并重新起用他,并产生消息给已经连接着的接口。
同时,当你用这个命令把接口放入第二层模式时,你也删除了接口上的所有第三层特征。
缺省第二层以太接口配置
图9-1显示了第二层以太接口缺省配置。需要更多的被列在表中的Vlan参数的详细信息,请看“配置Vlans”。
需要详细的控制端口流量的信息,请看“配置基于端口的流量控制”
表9-1:缺省第二层以太接口配置
| 缺省设置 |
运作模式 | 第二层或交换模式 (switchport command). 注意 路由模式 (no switchport command) 只有当交换机装有EMI时才是一个可用模式。所有的Catalyst 3550G交换机交货时已装有EMI。Catalyst 3550FESwitch交货时要么是标准多层软件映像(SMI)要么是预装EMI的。你可以定购EMI升级包,升级Catalyst3550从SMI到EMI。 |
允许的 VLAN 范围 | VLANs 1 - 4094. |
缺省 VLAN (给访问端口) | VLAN 1. |
本地 VLAN (给802.1Q干道) | VLAN 1. |
VLAN 中继 | 动态可用的交换端口模式 (支持 DTP). |
端口启用状态 | 所有端口都被启用 |
端口描述 | 没有定义 |
速度 | 自适应 |
双工模式 | 自适应 |
流控制 | 对于10/100/1000 Mb/s端口流控制收为关闭off, 发为期望 desired。而对于10/100 Mb/s 端口, 发总是关闭off。 |
以太通道 (端口聚合协议PAgP) | |
端口阻塞 (未知多播和未知单播流量) | |
广播,多播和单播风暴控制 | 禁用。 请看 “缺省风暴控制配置”。 |
受保护 | 禁用。 请看“ 配置受保护端口”部分 |
端口安全 | 禁用 请看“缺省端口安全配置”部分 |
速端口 | 禁用 |
it55.com
配置接口速度和双工模式
这个部分描述怎样配置接口速度和双工模式:
配置方针
设置接口速度和双工参数
配置方针
当配置一个接口速度和双工模式时,注意这些方针:
如果线路两端支持自动协商,我们强烈建议使用缺省自动协商设置。
如果一端接口支持自动协商而另一端不支持,需在两个接口上配置双工和速度;不要在支持的一方使用auto设置
注意:GigaStack-to-GigaStack串联连接运行在半双工模式,而GigaStack-to-GigaStack点到点连接运行在全双工模式。
小心:改变接口速度和双工模式的配置,在重配置期间可能会关闭并重启该接口。
设置接口速度和双工模式
你可以在快速以太(10/100-Mbps)和千兆以太(10/100/1000-Mbps)上配置接口速度;
你无法在千兆接口转发器接口(GBIC)上配置速度。
你可以配置在任何没有设置自动协商的快速或千兆接口上配置双工模式;你无法在GBIC上配置双工模式。 vd;k;l www.it55.com rdfg
因为以太网中的主要约束是冲突,全双工通讯是一个有效的解决方案。
通常,10-Mbps端口运行在半双工模式,这就意味着该站点要么接收要么发送。
在全双工模式模式,两个站点能够在同一时间接收和发送。
当包同时在两个方向上流动时,10-Mbps接口的有效以太带宽会翻一倍到20Mbps,快速以太接口会到200Mbps,而G接口会到2Gbps。
注意:你无法在GBIC上配置速度和双工模式,
但是,如果被连接的设备不支持自动协商,你可以在某些GBICs上配置速度为不协商(nonegotiate)。
从特权模式开始,以下的步骤为物理接口设定速度和双工模式:
| 命令 | 目的 |
Step 1 | configure terminal | 进入全局配置模式 |
Step 2 | interface interface-id | 进入接口配置模式,并确认物理接口 |
Step 3 | speed {10 | 100 | 1000 | auto | nonegotiate} | 为接口输入适当的接口参数, 或者输入 auto 或 nonegotiate. 注意 1000关键字只针对10/100/1000 Mbps 的端口有效. nonegotiate 关键字只针对1000BASE-SX, -LX, and -ZX GBIC 端口有效. |
Step 4 | duplex {auto | full | half} | 为接口输入双工参数 |
Step 5 | end | 返回特权模式 |
Step 6 | | 显示接口配置的速度和双工模式 |
Step 7 | copy running-config startup-config | (可选) 保存你的条目到配置文件 |
http://www.it55.com/
用no speed和no duplex接口配置命令使接口返回缺省速度和双工设置(autonegotiate)。为了返回所有的接口缺省设置,使用命令
(interface) default interface interface-id
这个例子显示了在fastethernet interface 0/3口上怎样设定接口速度为10Mbps和半双工模式,并确认这个配置:
Switch# configure terminal it55.com
Switch(config)# interface fastethernet0/3 www.it55.com
Switch(config-if)# speed 10 免费资源www.it55.com
Switch(config-if)# duplex half 45398 www.it55.com it55学习IT知识,享受IT生活 4dfkjn
Switch(config-if)# end it55.com
Switch# show interfaces fastethernet0/3 it55.com
FastEthernet0/3 is up, line protocol is down 45398 www.it55.com it55学习IT知识,享受IT生活 4dfkjn
Hardware is Fast Ethernet, address is 0000.0000.0003 (bia 0000.0000.0003) 免费资源www.it55.com
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, it55.com
reliability 255/255, txload 1/255, rxload 1/255 www.it55.com在线教程
Encapsulation ARPA, loopback not set vd;k;l www.it55.com rdfg
Keepalive set (10 sec) sflj www.it55.com kg^&fgd
Half-duplex, 10Mb/s 免费资源www.it55.com
IT资讯之家 www.it55.com
配置IEEE802.3X流控制
流控制在直连的以太端口上启用,在拥塞期间允许另一端拥塞的节点暂停链路运作来控制
流量速率。如果一个端口发生拥塞并且不能接收任何更多的流量,他将通知对端端口停止发送直到这种拥塞情况消失。
当本地设备在他本地检测到了任何拥塞,他能够发送一个暂停帧通知链路伙伴或者远程设备已发生拥塞。
紧随收到暂停帧之后,远程设备停止发送任何数据包,这样防止在拥塞期间丢弃任何一个数据包
注意:你不能在一个交换机上即配置IEEE802.3X流控制又配置QoS。在一个接口上配置流控制之前,用命令禁用交换机上的QoS。
流控制可以用两种方式设计,对称和不对称。对称设计适合于点到点的链路,而不对称设计适合于辐射型节点连接。
辐射型节点中中心路由器可以中断末端系统,而反之就不行。用命令设置接口的发送或接收暂停帧为on,off或desired。
(interface) flowcontrol {receive | send}{on | off | desired}
缺省快速以太端口是receive off和send off。
注意:在Catalyst3550交换机上,G端口能够接收和发送暂停帧;快速以太端口只能够接收暂停帧。 it55.com
因此,对快速以太端口来说,只能用send off来描述其状态。
这些规则应用于设备上的流控制:
receive on (or desired) 和 send on:流控制运行在两个方向;本地和远程设备都能够发送暂停帧来显示链路拥塞。
receive on (or desired) 和 send desired:如果连接设备支持流控制,那么该端口就能接收暂停帧和发送暂停帧
receive on (or desired) 和 send off:该端口不能发送暂停帧但是能够和一个期望或能够发送暂停帧的连接设备一起运作;
该端口可以接收暂停帧。
receive off 和 send on:如果远程设备支持流控制,该端口就发送暂停帧;但是该端口不支持来自于远程设备的暂停帧。
receive off 和send desired:如果连接的设备支持流控制,而该端口不能够接收暂停帧但能发送暂停帧。
receive off 和 send off:流控制不任何一个方向上执行。
在拥塞事件中,没有指示给链路伙伴,并且没有暂停帧在两个方向上被发送或接收。
注意:更多的关于命令配置的详情以及接口配置模式中的flowcontol命令给本地和远程的端口所带来的结果,
免费资源www.it55.com
在
Catalyst 3550 Multilayer Switch Command Reference。
从特权模式开始,以下这些步骤在接口上配置流控制:
| Command | Purpose |
Step 1 | configure terminal | 进入全局配置模式 |
Step 2 | no mls qos | 禁用交换机上的QoS |
Step 3 | interface interface-id | 进入接口配置模式以配置物理接口 |
Step 4 | flowcontrol {receive | send} {on | off | desired} | 为端口配置流控制模式 注意 send 关键字不能用于10/100 Mbps接口. |
Step 5 | end | 返回特权模式 |
Step 6 | show interfaces interface-id | 确认端口流控制配置 |
Step 7 | copy running-config startup-config | (可选) 把条目保存到配置文件中 |
45398 www.it55.com it55学习IT知识,享受IT生活 4dfkjn
要禁用流控制,使用:
(interface) flowcontrol receive off
(interface) flowcontrol send off
这个例子展示怎样关闭G 0/1上的所有流控制并显示结果:
Switch# configure terminal 免费资源www.it55.com
Switch(config)# interface gigabitethernet0/1 45398 www.it55.com it55学习IT知识,享受IT生活 4dfkjn
Switch(config-if)# flowcontrol receive off 45398 www.it55.com it55学习IT知识,享受IT生活 4dfkjn
Switch(config-if)# flowcontrol send off 45398 www.it55.com it55学习IT知识,享受IT生活 4dfkjn
Switch(config-if)# end 免费资源www.it55.com
Switch# show interfaces gigabitethernet0/1 vd;k;l www.it55.com rdfg
it55.com
GigabitEthernet0/1 is up, line protocol is down 免费资源www.it55.com
Hardware is Gigabit Ethernet, address is 0002.4b29.2e01 (bia 0002.4b29.2e01) www.it55.com在线教程
MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec, it55.com
reliability 255/255, txload 1/255, rxload 1/255 vd;k;l www.it55.com rdfg
Encapsulation ARPA, loopback not set www.it55.com
Keepalive set (10 sec) vd;k;l www.it55.com rdfg
Auto-duplex, Auto-speed http://www.it55.com/
input flow-control is off, output flow-control is off sflj www.it55.com kg^&fgd
为接口添加一个描述
你可以在一个接口上添加一段描述来帮助你记忆该接口的功能。该描述用以下的命令来显示:
(exec) show configuration
(exec) show running-config
(exec) show interface
从特权模式开始,以下步骤为给一个接口添加一段描述:
| Command | Purpose |
Step 1 | configure terminal | 进入全局配置模式 |
Step 2 | interface interface-id | 进入接口配置模式,该接口是你想添加一段描述的接口。 |
Step 3 | description string | 为一个接口添加一段描述(上限为240个字符) |
Step 4 | end | 返回特权模式 |
Step 5 | show interfaces interface-id description or show running-config | 确认你的条目 |
Step 6 | copy running-config startup-config | (可选) 保存你的条目到配置文件中 |
it55.com
删除接口描述用命令:
(interface) no description
这个例子展示怎样给快速以太接口0/4添加一段描述并确认该描述:
Switch# config terminal www.it55.com在线教程
45398 www.it55.com it55学习IT知识,享受IT生活 4dfkjn
Enter configuration commands, one per line. End with CNTL/Z. 免费资源www.it55.com
Switch(config)# interface fastethernet0/4 www.it55.com在线教程
Switch(config-if)# description Connects to Marketing http://www.it55.com/
Switch(config-if)# end www.it55.com
Switch# show interfaces fastethernet0/4 description vd;k;l www.it55.com rdfg
www.it55.com
Interface Status Protocol Description 免费资源www.it55.com
Fa0/4 up down Connects to Marketing sflj www.it55.com kg^&fgd
监控和维护第二层接口
你可以执行这几节中的任务来监控和维护接口:
监视接口和控制器状态
清空和重置接口和计数器
关闭和重起接口
监视接口和控制器状态
在特权模式输入命令会立即显示关于该端口的信息,包括软件和硬件的版本,控制器状态,和接口的统计信息。
表9-2列出了一些接口监控命令。
(你可以在特权模式中用show ?命令显示所有的show命令)这些命令的完全描述在
Cisco IOS Interface Command Reference for Release 12.1。
表9-2: 接口的show命令
Command | |
show interfaces [interface-id] | 显示所有接口或指定接口的状态和配置情况 |
show interfaces interface-id status [err-disabled] | 显示接口状态或一个在错误禁用状态的接口列表 |
show interfaces [interface-id] switchport | 显示交换端口(非路由端口)的管理和运行状态 你可以用这个命令派段一个端口实路由还是交换模式 |
show interfaces [interface-id] description | 显示在一个接口上或所有接口上配置的描述信息和端口状态 |
show running-config | 显示内存理的运行配置文件 |
show version | 显示配置文件的硬件配置, 软件版本, 名称 和源 ,以及引导映像(boot images)。 |
vd;k;l www.it55.com rdfg
这个例子展示了怎么显示所有接口状态的命令:
Switch# show interfaces status IT资讯之家 www.it55.com
www.it55.com
Port Name Status Vlan Duplex Speed Type IT资讯之家 www.it55.com
Gi0/1 CubeA connected 1 a-full a-100 10/100/1000BaseTX IT资讯之家 www.it55.com
Gi0/2 CubeE notconnect 1 auto auto 10/100/1000BaseTX IT资讯之家 www.it55.com
Gi0/3 CubeF disabled 1 auto auto 10/100/1000BaseTX it55.com
Gi0/4 CubeG notconnect 1 auto auto 10/100/1000BaseTX 免费资源www.it55.com
Gi0/5 CubeH notconnect routed auto auto 10/100/1000BaseTX it55.com
Gi0/6 CubeI notconnect routed auto auto 10/100/1000BaseTX 免费资源www.it55.com
Gi0/7 CubeJ connected 1 a-full a-100 10/100/1000BaseTX sflj www.it55.com kg^&fgd
Gi0/8 CubeK notconnect 1 auto auto 10/100/1000BaseTX www.it55.com
Gi0/9 CubeL disabled 1 auto auto 10/100/1000BaseTX http://www.it55.com/
Gi0/10 CubeB notconnect routed auto auto 10/100/1000BaseTX www.it55.com
Gi0/11 CubeC notconnect 1 auto auto unknown www.it55.com在线教程
Gi0/12 CubeD notconnect 1 auto auto unknown vd;k;l www.it55.com rdfg
这个例子展示怎样显示交换端口的状态:
Switch# show interfaces switchport http://www.it55.com/
免费资源www.it55.com
Name: Gi0/1 IT资讯之家 www.it55.com
Switchport: Enabled IT资讯之家 www.it55.com
Administrative Mode: dynamic desirable www.it55.com
Operational Mode: static access www.it55.com在线教程
Administrative Trunking Encapsulation: negotiate sflj www.it55.com kg^&fgd
Operational Trunking Encapsulation: native http://www.it55.com/
Negotiation of Trunking: On www.it55.com
Access Mode VLAN: 1 (default) it55.com
Trunking Native Mode VLAN: 1 (default) IT资讯之家 www.it55.com
Trunking VLANs Enabled: ALL www.it55.com
Pruning VLANs Enabled: 2-1001 www.it55.com
http://www.it55.com/
Protected: True 免费资源www.it55.com
Unknown unicast blocked: disabled www.it55.com在线教程
Unknown multicast blocked: disabled sflj www.it55.com kg^&fgd
免费资源www.it55.com
Voice VLAN: none (Inactive) vd;k;l www.it55.com rdfg
Appliance trust: none http://www.it55.com/
45398 www.it55.com it55学习IT知识,享受IT生活 4dfkjn
Name: Gi0/2 IT资讯之家 www.it55.com
Switchport: Enabled IT资讯之家 www.it55.com
Administrative Mode: dynamic desirable 免费资源www.it55.com
Operational Mode: down 免费资源www.it55.com
Administrative Trunking Encapsulation: negotiate vd;k;l www.it55.com rdfg
Negotiation of Trunking: On 45398 www.it55.com it55学习IT知识,享受IT生活 4dfkjn
Access Mode VLAN: 1 (default) sflj www.it55.com kg^&fgd
Trunking Native Mode VLAN: 1 (default) 45398 www.it55.com it55学习IT知识,享受IT生活 4dfkjn
Trunking VLANs Enabled: ALL it55.com
Pruning VLANs Enabled: 2-1001 it55.com
免费资源www.it55.com
Protected: True 免费资源www.it55.com
Unknown unicast blocked: disabled it55.com
Unknown multicast blocked: disabled it55.com
www.it55.com在线教程
Voice VLAN: none (Inactive) vd;k;l www.it55.com rdfg
Appliance trust: none IT资讯之家 www.it55.com
45398 www.it55.com it55学习IT知识,享受IT生活 4dfkjn
清空和重置接口和计数器
表9-3列出了你可以用来清空计数器和重置接口的特权模式clear命令。
表9-3:接口清除命令
Command | |
clear counters [interface-id] | 清除接口计数器 |
clear interface interface-id | 重置接口的硬件逻辑电路 |
clear line [number | console 0 | vty number] | 在一个异步串行线路上重置接口逻辑电路 |
vd;k;l www.it55.com rdfg
为了清除用show interfaces特权模式命令显示的接口计数,使用特权命令:
(exec) clear counters
从接口清除所有当前接口计数,除非可选变量被指派来清除一个定接口类型,
该特定接口来自于一个特定接口号的唯一接口号。
注意:特权命令clear counters不能清除用SNMP重新收到的计数,只能清除用show interface特权命令显示的计数。
这个例子展示怎样清除和重置千兆口0/5:
Switch# clear counters gigabitethernet0/5 vd;k;l www.it55.com rdfg
Clear "show interface" counters on this interface [confirm] y IT资讯之家 www.it55.com
Switch# www.it55.com在线教程
*Sep 30 08:42:55: %CLEAR-5-COUNTERS: Clear counter on interface GigabitEthernet0/5 http://www.it55.com/
by vty1 (171.69.115.10) IT资讯之家 www.it55.com
清除和重置一个接口或一个串行线路,用命令:
(interface) clear interface
(interface) clear line
在绝大多数环境中,你不必清除一个接口或串行线路的硬件逻辑电路。
这个例子显示怎样清除和重置G接口0/5:
Switch# clear interface gigabitethernet0/5
关闭和重启接口
关闭一个特定接口会禁用所有功能并且所有监控命令显示标注这个接口不可用。
通过动态路由协议给信息被发给其他的网络服务服务设备。
这个接口在所有路由更新中不被监控。
从特权模式开始,以下这些步骤关闭一个接口:
| Command | Purpose |
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 | 确认你的条目 |
www.it55.com 重启该接口用命令:
(interface) no shutdown
这个列子展示怎样关闭千兆以太接口0/5:
Switch# configure terminal www.it55.com在线教程
Switch(config)# interface gigabitethernet0/5 http://www.it55.com/
Switch(config-if)# shutdown 45398 www.it55.com it55学习IT知识,享受IT生活 4dfkjn
Switch(config-if)# sflj www.it55.com kg^&fgd
*Sep 30 08:33:47: %LINK-5-CHANGED:
Interface GigabitEthernet0/5, changed state to a administratively down 45398 www.it55.com it55学习IT知识,享受IT生活 4dfkjn
这个例子展示怎样重启千兆以太接口0/5:
Switch# configure terminal www.it55.com
Switch(config)# interface gigabitethernet0/5 http://www.it55.com/
Switch(config-if)# no shutdown http://www.it55.com/
Switch(config-if)# www.it55.com在线教程
*Sep 30 08:36:00: %LINK-3-UPDOWN: Interface GiogabitEthernet0/5, changed state to up 45398 www.it55.com it55学习IT知识,享受IT生活 4dfkjn
为了确认一个接口是禁用的,输入命令:
(interface) show interface
在千兆以太接口0/1上,一个禁用的接口在show interface命令中被显示为administratively down。
Switch# show interfaces vd;k;l www.it55.com rdfg
GigabitEthernet0/2 is administratively down, line protocol is down sflj www.it55.com kg^&fgd
Hardware is Gigabit Ethernet, address is 0002.4b29.4403 (bia 0002.4b29.4403) it55.com
MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec, www.it55.com
reliability 255/255, txload 1/255, rxload 1/255 www.it55.com
Encapsulation ARPA, loopback not set http://www.it55.com/
Keepalive set (10 sec) IT资讯之家 www.it55.com
Auto-duplex, Auto-speed it55.com
IT资讯之家 www.it55.com
IT资讯之家 www.it55.com