交换机 : Cisco Catalyst 3750 系列交换机

与自定义触发配置示例的自动Smartport

2016 年 10 月 27 日 - 机器翻译
其他版本: PDFpdf | 英语 (2015 年 8 月 22 日) | 反馈

简介

本文提供定义了自动Smartport的自定义触发的一完整配置示例。此示例使用根据内置的设备分类器的自定义触发。这是非Cisco设备的分类的一好替代方案,当不可能组织使用唯一标识符(OUIs)时。对使用的另一替代方案内置的设备分类器是触发基于RADIUS属性-值对auto-smart-port= (自定义事件触发)。在本文的范围之外, RADIUS触发是。

注意:更多信息是可用的在自动Smartport配置指南,版本15.0(2)SE

贡献用安德鲁Gossett, Cisco TAC工程师。

先决条件

要求

本文档没有任何特定的要求。

使用的组件

本文档中的信息基于以下软件和硬件版本:

  • Cisco Catalyst 3750-X系列交换机
  • Cisco IOS版本15.2.1E

本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您使用的是真实网络,请确保您已经了解所有命令的潜在影响。

配置

网络图

在本例中, Avaya IP电话在3750X交换机的Gi1/0/1连接。此示例使用内置的设备分类器和链路层发现协议(LLDP)信息从电话为了自动配置端口。

保证配置文件存在

保证设备分类器有所需的设备的内置的配置文件。自版本15.2.1E, 250内置的配置文件。请参阅附录在本文结束时关于详尽列表。配置文件与.tar镜像捆绑在一起。凭您的编码版本,配置文件在存储:

  • flash: <running_ios>/dc_default_profiles.txt
  • flash: dc_profile_dir/dc_default_profiles.txt

如果禁用并且重新授权给设备分类器,您能强制Cisco IOS刷新配置文件列表。在本例中,您要保证Avaya的配置文件存在。

c3750x#dir flash:dc_profile_dir/
Directory of flash:dc_profile_dir/

531 -rwx 143335 Mar 30 2011 02:14:22 +00:00 dc_default_profiles.txt

57671680 bytes total (28816384 bytes free)

c3750x(config)#no macro auto monitor
c3750x(config)#macro auto monitor

c3750x#show macro auto monitor type string Avaya
Valid Type Profile Name min Conf ID
=========== ========= ================== ======== ====
Valid Default Avaya-Device 10 3
Valid Default Avaya-IP-Phone 20 4

Enable (event) LLDP

对于此示例,设备分类器以LLDP帧使用信息。为了使工作的此,必须启用LLDP。

c3750x(config)# lldp run

创建自定义事件触发

一自定义触发的语法是shell触发<trigger_name> <trigger_description>。请使用名称AVAYA_IP_PHONE和此说明:这是为avaya IP电话

c3750x(config)# shell processing full
c3750x(config)# shell trigger AVAYA_IP_PHONE This is for an avaya IP phone

有希望的配置文件的关联触发

此示例配比Avaya IP电话配置文件名称,因此附加触发对该配置文件。

c3750x(config)# macro auto trigger AVAYA_IP_PHONE
c3750x(config-macro-trigger)# profile Avaya-IP-Phone

定义万家乐

宏是自动Smartport实时电源。设备分类器检测,当某种设备根据该分类时连接,并且,您能运用一特定配置。此示例适用于VLAN、语音VLAN和说明端口。当设备删除时,您删除早先应用的配置。此示例容易地被扩展包括服务质量(QoS)和其他安全配置。

c3750x(config)# macro auto execute AVAYA_IP_PHONE  {
if [[ $LINKUP == YES ]]; then
conf t
interface $INTERFACE

macro description $TRIGGER
description ***** AVAYA PHONE *****
switchport access vlan 100
switchport mode access
switchport voice vlan 200
exit
fi
if [[ $LINKUP == NO ]]; then
conf t
interface $INTERFACE
no macro description $TRIGGER
no description ***** no more avaya phone *****
no switchport access vlan 100
no switchport mode access
no switchport voice vlan 200
exit
fi
end
}

全局Enable (event)万家乐处理

对于顺利地触发的事件,必须全局启用宏处理。

注意:默认情况下所有端口有启用的处理。

在您启用宏处理全局前,请务必禁用处理在应该通过没有宏观自动处理的命令排除的端口。

c3750x(config)# macro auto global processing

完整的配置

这是此示例的完整的配置:

c3750x#show run | sec lldp|shell|macro
shell processing full
shell trigger AVAYA_IP_PHONE This is for an avaya IP phone
lldp run
macro auto execute AVAYA_IP_PHONE {
if [[ $LINKUP == YES ]]
then conf t
interface $INTERFACE
macro description $TRIGGER
description ***** AVAYA PHONE *****
switchport access vlan 100
switchport mode access
switchport voice vlan 200
exit
fi
if [[ $LINKUP == NO ]]
then conf t
interface $INTERFACE
no macro description $TRIGGER
no description ***** no more avaya phone *****
no switchport access vlan 100
no switchport mode access
no switchport voice vlan 200
exit
fi
end
macro auto trigger AVAYA_IP_PHONE
profile Avaya-IP-Phone
macro auto global processing

验证

对于所有shell验证,您必须首先启用当前终端会话的思科IOS.sh

c3750x#terminal shell
c3750x#terminal shell trace

为了验证触发和宏功能存在和顺利地映射,请输入此命令:

c3750x#show shell triggers AVAYA_IP_PHONE
User defined triggers
---------------------
Trigger Id: AVAYA_IP_PHONE
Trigger namespace: DEFAULT
Trigger description: This is for an avaya IP phone
Trigger mapping function:
function AVAYA_IP_PHONE_func()
{
if [[ $LINKUP == YES ]]
then conf t
interface $INTERFACE
macro description $TRIGGER
description ***** AVAYA PHONE *****
switchport access vlan 100
switchport mode access
switchport voice vlan 200
exit
fi
if [[ $LINKUP == NO ]]
then conf t
interface $INTERFACE
no macro description $TRIGGER
no description ***** no more avaya phone *****
no switchport access vlan 100
no switchport mode access
no switchport voice vlan 200
exit
fi
end
}

当端口用Avaya IP电话来联机时,此事件顺序显示:

%LINK-3-UPDOWN: Interface GigabitEthernet1/0/1, changed state to up
%AUTOSMARTPORT-5-INSERT: Device Avaya-IP-Phone detected on interface
GigabitEthernet1/0/1,
executed AVAYA_IP_PHONE

为了验证设备正确地分类作为Avaya IP电话,请输入此命令:

c3750x#show macro auto monitor device interface g1/0/1
Summary:

MAC_Address Port_Id Profile Name Device Name
============== ========== =============================== =======================
(device mac ) Gi1/0/1 Avaya-IP-Phone AVAYA, INC

为了验证宏观配置顺利地应用,请输入此命令:

c3750x# show run interface g1/0/1
!
interface GigabitEthernet1/0/1
description ***** AVAYA PHONE *****
switchport access vlan 100
switchport mode access
switchport voice vlan 200
macro description AVAYA_IP_PHONE
spanning-tree portfast
end

故障排除

目前没有针对此配置的故障排除信息。

附录

这是内置的设备分类器配置文件自版本15.2.1E :

c3750x#show macro auto monitor type
Valid Type Profile Name min Conf ID
=========== ========= ================== ======== ====
Valid Default Apple-Device 10 0
Valid Default Apple-iDevice 10 1
Valid Default Aruba-Device 10 2
Valid Default Avaya-Device 10 3
Valid Default Avaya-IP-Phone 20 4
Valid Default Brother-Device 10 5
Valid Default Brother-HL-3040CN-series 30 6
Valid Default Brother-HL-5370DW-series 30 7
Valid Default Brother-MFC-8890DW 30 8
Valid Default Brother-MFC-9010CN 30 9
Valid Default Canon-Device 10 10
Valid Default Canon-MF4690 30 11
Valid Default Cisco-Device 10 12
Valid Default Cisco-Router 10 13
Valid Default Cisco-Switch 20 14
Valid Default Cisco-TelePresence 30 15
Valid Default Cisco-IP-Camera 20 16
Valid Default Router 10 17
Valid Default Cisco-IP-Phone 20 18
Valid Default IP-Phone 20 19
Valid Default Cisco-IP-Phone-7902 70 20
Valid Default Cisco-IP-Phone-7905 70 21
Valid Default Cisco-IP-Phone-7906 70 22
Valid Default Cisco-IP-Phone-7910 70 23
Valid Default Cisco-IP-Phone-7911 70 24
Valid Default Cisco-IP-Phone-7912 70 25
Valid Default Cisco-IP-Phone-7940 70 26
Valid Default Cisco-IP-Phone-7941 70 27
Valid Default Cisco-IP-Phone-7942 70 28
Valid Default Cisco-IP-Phone-7945 70 29
Valid Default Cisco-IP-Phone-7945G 70 30
Valid Default Cisco-IP-Phone-7960 70 31
Valid Default Cisco-IP-Phone-7961 70 32
Valid Default Cisco-IP-Phone-7962 70 33
Valid Default Cisco-IP-Phone-7965 70 34
Valid Default Cisco-IP-Phone-7970 70 35
Valid Default Cisco-IP-Phone-7971 70 36
Valid Default Cisco-IP-Phone-7975 70 37
Valid Default Cisco-IP-Phone-7985 70 38
Valid Default Cisco-IP-Phone-9971 70 39
Valid Default Cisco-IP-Phone-9951 70 40
Valid Default Cisco-IP-Phone-8961 70 41
Valid Default Cisco-IP-Phone-8941 70 42
Valid Default Cisco-IP-Phone-8945 70 43
Valid Default Cisco-WLC 20 44
Valid Default Cisco-WLC-2100-Series 40 45
Valid Default Cisco-WLC-4400-Series 40 46
Valid Default Cisco-WLC-5500-Series 40 47
Valid Default Cisco-DMP 20 48
Valid Default Cisco-DMP-4400 70 49
Valid Default Cisco-DMP-4310 70 50
Valid Default Cisco-DMP-4305 70 51
Valid Default DLink-Device 10 52
Valid Default Enterasys-Device 10 53
Valid Default HP-Device 10 54
Valid Default HP-JetDirect-Printer 30 55
Valid Default HP-LaserJet-1022n 30 56
Valid Default HP-LaserJet-5100-Series 30 57
Valid Default HP-LaserJet-5200 30 58
Valid Default HP-LaserJet-8150-Series 30 59
Valid Default HP-LaserJet-9000-Series 30 60
Valid Default HP-LaserJet-M3027-MFP 30 61
Valid Default HP-LaserJet-M3035-MFP 30 62
Valid Default HP-LaserJet-M4345-MFP 30 63
Valid Default HP-LaserJet-P1505n 30 64
Valid Default HP-LaserJet-P2035n 30 65
Valid Default HP-LaserJet-P3005 30 66
Valid Default HP-LaserJet-P3010-Series 30 67
Valid Default HP-LaserJet-P4014 30 68
Valid Default HP-LaserJet-P4015 30 69
Valid Default HP-LaserJet-2420 30 70
Valid Default HP-LaserJet-2430 30 71
Valid Default HP-LaserJet-4250 30 72
Valid Default HP-LaserJet-4345-mfp 30 73
Valid Default HP-LaserJet-4350 30 74
Valid Default HP-Color-LaserJet-2500 30 75
Valid Default HP-Color-LaserJet-5550 30 76
Valid Default HP-Color-LaserJet-9500 30 77
Valid Default HP-Color-LaserJet-2600n 30 78
Valid Default HP-Color-LaserJet-3000 30 79
Valid Default HP-Color-LaserJet-3600 30 80
Valid Default HP-Color-LaserJet-3800 30 81
Valid Default HP-Color-LaserJet-4500 30 82
Valid Default HP-Color-LaserJet-4700 30 83
Valid Default HP-Color-LaserJet-CM4730-MFP 30 84
Valid Default HP-Color-LaserJet-CM6030-MFP 30 85
Valid Default HP-Color-LaserJet-CP3505 30 86
Valid Default HP-Color-LaserJet-CP3525 30 87
Valid Default HP-Color-LaserJet-CP4020-Series 30 88
Valid Default HP-Color-LaserJet-CP5520-Series 30 89
Valid Default Lexmark-Device 10 90
Valid Default Lexmark-Printer-E260dn 30 91
Valid Default Lexmark-T522 30 92
Valid Default Lexmark-T630 30 93
Valid Default Lexmark-T642 30 94
Valid Default Lexmark-T654 30 95
Valid Default Microsoft-Device 10 96
Valid Default Netgear-Device 10 97
Valid Default NintendoWII 10 98
Valid Default Nortel-Device 10 99
Valid Default Nortel-IP-Phone-2000-Series 20 100
Valid Default SonyPS3 10 101
Valid Default XBOX360 20 102
Valid Default Xerox-Device 10 103
Valid Default Xerox-Printer-Phaser3250 30 104
Valid Default Xerox-DocuColor-8080-Digital-Press 30 105
Valid Default Xerox-FaxCentre-2218 30 106
Valid Default Xerox-Igen4-Press 30 107
Valid Default Xerox-Phaser-3200mfp 30 108
Valid Default Xerox-Phaser-3300mfp 30 109
Valid Default Xerox-Phaser-3500dn 30 110
Valid Default Xerox-Phaser-3600 30 111
Valid Default Xerox-Phaser-3635mfp 30 112
Valid Default Xerox-Phaser-4600 30 113
Valid Default Xerox-Phaser-4620 30 114
Valid Default Xerox-Phaser-5550dt 30 115
Valid Default Xerox-Phaser-6010n 30 116
Valid Default Xerox-Phaser-6110 30 117
Valid Default Xerox-Phaser-6110mfp 30 118
Valid Default Xerox-Phaser-6115mfp 30 119
Valid Default Xerox-Phaser-6128mfp-n 30 120
Valid Default Xerox-Phaser-6130n 30 121
Valid Default Xerox-Phaser-6140dn 30 122
Valid Default Xerox-Phaser-6180mfp-d 30 123
Valid Default Xerox-Phaser-6280dn 30 124
Valid Default Xerox-Phaser-6280n 30 125
Valid Default Xerox-Phaser-6360dx 30 126
Valid Default Xerox-Phaser-6360n 30 127
Valid Default Xerox-Phaser-6500dn 30 128
Valid Default Xerox-Phaser-6500n 30 129
Valid Default Xerox-Phaser-6700dx 30 130
Valid Default Xerox-Phaser-7400dx 30 131
Valid Default Xerox-Phaser-7400dxf 30 132
Valid Default Xerox-Phaser-7500dt 30 133
Valid Default Xerox-Phaser-7500dx 30 134
Valid Default Xerox-Phaser-7760dx 30 135
Valid Default Xerox-Phaser-7760dx-Pcl-5c 30 136
Valid Default Xerox-Phaser-7760gx 30 137
Valid Default Xerox-Phaser-8500n 30 138
Valid Default Xerox-Phaser-8550dp 30 139
Valid Default Xerox-Phaser-8550dt 30 140
Valid Default Xerox-Phaser-8560 30 141
Valid Default Xerox-Phaser-8560dn 30 142
Valid Default Xerox-Phaser-8560dx 30 143
Valid Default Xerox-Phaser-8860 30 144
Valid Default Xerox-Phaser-8860mfp 30 145
Valid Default Xerox-WorkCentre-3045ni 30 146
Valid Default Xerox-WorkCentre-3210 30 147
Valid Default Xerox-WorkCentre-3220 30 148
Valid Default Xerox-WorkCentre-3550 30 149
Valid Default Xerox-WorkCentre-4118-Series 30 150
Valid Default Xerox-WorkCentre-4250 30 151
Valid Default Xerox-WorkCentre-4260 30 152
Valid Default Xerox-WorkCentre-5020-dn 30 153
Valid Default Xerox-WorkCentre-5030 30 154
Valid Default Xerox-WorkCentre-5135 30 155
Valid Default Xerox-WorkCentre-5225 30 156
Valid Default Xerox-WorkCentre-5225a 30 157
Valid Default Xerox-WorkCentre-5632 30 158
Valid Default Xerox-WorkCentre-5655 30 159
Valid Default Xerox-WorkCentre-5675 30 160
Valid Default Xerox-WorkCentre-5687 30 161
Valid Default Xerox-WorkCentre-5735 30 162
Valid Default Xerox-WorkCentre-5755 30 163
Valid Default Xerox-WorkCentre-5765 30 164
Valid Default Xerox-WorkCentre-5790 30 165
Valid Default Xerox-WorkCentre-6015n 30 166
Valid Default Xerox-WorkCentre-6400s 30 167
Valid Default Xerox-WorkCentre-6400x 30 168
Valid Default Xerox-WorkCentre-6400xf 30 169
Valid Default Xerox-WorkCentre-6505dn 30 170
Valid Default Xerox-WorkCentre-6505n 30 171
Valid Default Xerox-WorkCentre-7120 30 172
Valid Default Xerox-WorkCentre-7132-Multifunction-Syst 30 173
Valid Default Xerox-WorkCentre-7242 30 174
Valid Default Xerox-WorkCentre-7345 30 175
Valid Default Xerox-WorkCentre-7346 30 176
Valid Default Xerox-WorkCentre-7428 30 177
Valid Default Xerox-WorkCentre-7435 30 178
Valid Default Xerox-WorkCentre-7535 30 179
Valid Default Xerox-WorkCentre-7556 30 180
Valid Default Xerox-WorkCentre-7675 30 181
Valid Default Xerox-WorkCentre-7755 30 182
Valid Default Xerox-WorkCentre-7775 30 183
Valid Default Xerox-WorkCentre-M118 30 184
Valid Default Xerox-WorkCentre-M20 30 185
Valid Default Xerox-WorkCentre-M20i 30 186
Valid Default Xerox-WorkCentre-Pro-133 30 187
Valid Default Xerox-WorkCentre-Pro-C3545 30 188
Valid Default Xerox-4127 30 189
Valid Default Xerox-700-Digital-Color-Press 30 190
Valid Default Xerox-Color-1000-Press 30 191
Valid Default Xerox-Color-560 30 192
Valid Default Xerox-ColorQube-8570dn 30 193
Valid Default Xerox-ColorQube-8570dt 30 194
Valid Default Xerox-ColorQube-8570dx 30 195
Valid Default Xerox-ColorQube-8700X 30 196
Valid Default Xerox-ColorQube-8870 30 197
Valid Default Xerox-ColorQube-9202 30 198
Valid Default Xerox-ColorQube-9203 30 199
Valid Default Xerox-ColorQube-9301 30 200
Valid Default Aruba-AP 20 201
Valid Default Cisco-Access-Point 10 202
Valid Default Cisco-IP-Conference-Station-7935 70 203
Valid Default Cisco-IP-Conference-Station-7936 70 204
Valid Default Cisco-IP-Conference-Station-7937 70 205
Valid Default DLink-DAP-1522 20 206
Valid Default Cisco-AP-Aironet-1130 30 207
Valid Default Cisco-AP-Aironet-1240 30 208
Valid Default Cisco-AP-Aironet-1250 30 209
Valid Default Cisco-AIR-LAP 25 210
Valid Default Cisco-AIR-LAP-1130 30 211
Valid Default Cisco-AIR-LAP-1240 50 212
Valid Default Cisco-AIR-LAP-1250 50 213
Valid Default Cisco-AIR-AP 25 214
Valid Default Cisco-AIR-AP-1130 30 215
Valid Default Cisco-AIR-AP-1240 50 216
Valid Default Cisco-AIR-AP-1250 50 217
Invalid Default Sun-Workstation 10 218
Valid Default Linksys-Device 20 219
Valid Default LinksysWAP54G-Device 30 220
Valid Default HTC-Device 10 221
Valid Default MotorolaMobile-Device 10 222
Valid Default VMWare-Device 10 223
Valid Default ISE-Appliance 10 224
Valid Default Konica-Device 10 225
Valid Default Konica-Minolta-Bizhub-C280 30 226
Valid Default Konica-Minolta-Bizhub-C650 30 227
Valid Default RICOH-Device 10 228
Valid Default RICOH-Aficio-MP-5000 30 229
Valid Default RICOH-Aficio-MP-5001 30 230
Valid Default RICOH-Aficio-MP-C2050 30 231
Valid Default RICOH-Aficio-MP-C2550 30 232
Valid Default RICOH-Aficio-MP-C4501 30 233
Valid Default RICOH-Aficio-SP-C410DN 30 234
Valid Default Samsung-Device 10 235
Valid Default Samsung-ML-2855-Series 30 236
Valid Default Samsung-CLP-310-Series 30 237
Valid Default Philips-Device 10 238
Valid Default Surveillance-Camera 10 239
Valid Default AXIS-Camera 20 240
Valid Default Pelco-Camera 20 241
Valid Default Video-Conference 20 242
Valid Default Radvision-VCF 20 243
Valid Default Polycom-VCF 20 244
Valid Default Draeger-Device 10 245
Valid Default Polycom-Device 10 246
Valid Default WYSE-Device 10 247
Valid Built-in Cisco-Device 10 0
Valid Built-in Cisco-Router 10 1
Valid Built-in Router 10 2
Valid Built-in Cisco-IP-Camera 10 3
Valid Built-in Cisco-IP-Camera-2xxx 30 4
Valid Built-in Cisco-IP-Camera-2421 50 5
Valid Built-in Cisco-IP-Camera-2500 50 6
Valid Built-in Cisco-IP-Camera-2520 50 7
Valid Built-in Cisco-IP-Camera-2530 50 8
Valid Built-in Cisco-IP-Camera-4xxx 50 9
Valid Built-in Cisco-Transparent-Bridge 8 10
Valid Built-in Transparent-Bridge 8 11
Valid Built-in Cisco-Source-Bridge 10 12
Valid Built-in Cisco-Switch 10 13
Valid Built-in Cisco-IP-Phone 20 14
Valid Built-in IP-Phone 20 15
Valid Built-in Cisco-DMP 10 16
Valid Built-in Cisco-DMP-4305G 70 17
Valid Built-in Cisco-DMP-4310G 70 18
Valid Built-in Cisco-DMP-4400G 70 19
Valid Built-in Cisco-WLC-2100-Series 40 20
Valid Built-in Cisco-Access-Point 10 21
Valid Built-in Cisco-AIR-LAP 30 22
Valid Built-in Cisco-AIR-AP 30 23
Valid Built-in Linksys-Device 20 24
Valid Built-in Surveillance-Camera 10 25
Valid Built-in AXIS-Camera 20 26
Valid Built-in Pelco-Camera 20 27
Valid Built-in Video-Conference 20 28
Valid Built-in Radvision-VCF 20 29
Valid Built-in Polycom-VCF 20 30
Valid Built-in CUPC-VCF 20 31


Document ID: 116515