Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2073733
  • 博文数量: 433
  • 博客积分: 4775
  • 博客等级: 上校
  • 技术积分: 8054
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-19 16:15
文章存档

2014年(9)

2013年(20)

2012年(77)

2011年(323)

2009年(4)

分类: 系统运维

2011-10-20 00:26:57

Cisco Catalyst以太局域网交换机的二层以太网接口都是交换端口(Switch Pory,具体参见本章前面的4.1.2节)。交换端口包括访问端口(access port)、中继端口(trunk port)和隧道端口(tunnel port)三种。本节及以下几个小节将分别介绍与访问端口、中继端口及相关配置。本节介绍的二层访问端口的配置方法。

1. 配置一个接口作为二层访问端口

一个访问端口仅可属于,并且承载一个VLAN内的通信(除非被配置成语音VLAN端口),一般用于连接计算机。访问端口上接收和发送的通信是不带VLAN标记的本地格式,到达一个访问端口的通信是假定来自分配到该端口的VLAN

【注意】如果你分配一个接口到一个不存在的VLAN中,接口将不工作,直到你在VLAN数据库中建立该VLAN

可按照42-7所示的步骤为二层访问端口配置接口(自特权模式开始)。

4-7  为二层访问端口配置接口的步骤

 

命令

用途说明

Step 1 

Switch(config)# interface {fastethernet | gigabitethernet | tengigabitethernet} slot/port

指定要配置的接口,进入接口配置模式。

Step 2 

Switch(config-if)# shutdown

(可选)关闭接口以阻止通信流,直到配置完成。

Step 3 

Switch(config-if)# switchport

为二层交换配置接口。在你可以键入带有关键字的switchport命令之前,你必须键入一次不带任何参数的switchport命令,以配置接口作为二层端口。仅在以前为该接口键入了no switchport命令时才需要。

Step 4 

Switch(config-if)# switchport mode access

配置接口作为二层访问端口。如果不执行本步操作,则仅把接口配置为二层交换端口。

Step 5 

Switch(config-if)# switchport access vlan vlan_num

把接口置于一个VLAN中。如果仅需要把接口配置为交换端口,则不需要执行此步。

Step 6 

Switch(config-if)# no shutdown

激活接口(仅在接口处于关闭状态时需要)。

Step 7 

Switch(config-if)# end

退出接口配置模式

Step 8 

Switch# show running-config interface {fastethernet | gigabitethernet} slot/port

显示在运行配置中的指定接口配置

Step 9 

Switch# show interfaces [{fastethernet | gigabitethernet | tengigabitethernet} slot/port] switchport

显示指定接口的交换端口配置

以下示例显示如何配置Fast Ethernet interface 5/6作为VLAN 200的访问端口。

Switch# configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)# interface fastethernet 5/6

Switch(config-if)# shutdown

Switch(config-if)# switchport mode access

Switch(config-if)# switchport access vlan 200

Switch(config-if)# no shutdown

Switch(config-if)# end

Switch# exit

以下示例显示了如何校验运行配置中的指定接口配置。

Switch# show running-config interface fastethernet 5/6

Building configuration...

!

Current configuration :33 bytes

interface FastEthernet 5/6

 switchport access vlan 200

 switchport mode access

end

以下示例显示如何校验交换指定接口的端口配置。

Switch# show running-config interface fastethernet 5/6 switchport

Name:Fa5/6

Switchport:Enabled

Administrative Mode:dynamic auto

Operational Mode:static access

Administrative Trunking Encapsulation:negotiate

Operational Trunking Encapsulation:native

Negotiation of Trunking:On

Access Mode VLAN:1 (default)

Trunking Native Mode VLAN:1 (default)

Administrative private-vlan host-association:none

Administrative private-vlan mapping:none

Operational private-vlan:none

Trunking VLANs Enabled:ALL

Pruning VLANs Enabled:2-1001

Switch#

2. 配置MAC地址表通告

在把接口配置成二层访问端口后,为了发送SNMP捕获通告,则需要使用MAC地址表通告功能。12.2(33)SXH及以后版本IOS,你可以按照表4-8所示步骤来配置MAC地址表表通告功能(注意,此功能主要是Catalyst 6500及高端系列交换机上进行的,默认的交换机名称为“Router”

4-8  配置MAC地址通告的步骤

 

用途说明

启用发送MAC地址表动态变化通告功能。

(可选)可以设置最小的设置改变发送间隔,取值范围为0~ 2,147,483,647秒,默认为1秒。

(可选)在历史缓存中设置保存条目数量,取值范围为0~ 500,默认为1

使用no格式命令可恢复到默认设置,不发送任何改变信息。

Step 2 

Router(config)# interface type  slot/port

选择要配置的LAN接口,并进入接口配置模式。

Step 3 

Router(config-if)# snmp trap mac-notification change [added | removed]

指定与以上LAN端口关联的MAC地址,在MAC地址表中添加或者删除条目时启用SNMP捕获信息

MAC地址表中添加条目时触发SNMP消息发送,则使用addedMAC地址表中删除条目时触发,则选择removed选项。

MAC地址,如果不指定模块/插槽(slot)号和端口(port)号,则显示所有接口的MAC地址表配置。

以下示例显示了如何配置在Fast Ethernet ports 5/75/8接口的MAC地址表中添加条目时触发SNMP动态添加通告消息。改变通告发送频率不超过5秒,缓存中保存的历史条目为25个。

Router# configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)# mac-address-table notification change interval 5 history 25

Router(config)# interface fastethernet 5/7

Router(config-if)# snmp trap mac-notification change added

Router(config-if)# end

Router(config)# interface fastethernet 5/8

Router(config-if)# snmp trap mac-notification change added

Router(config-if)# end

Router# exit

本文摘自《(CiscoH3C交换机配置与管理完全手册)》第四章
阅读(1822) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~