本文件提供完整組態範例,說明如何為自動智慧型連接埠定義自訂觸發。此示例使用基於內建裝置分類器的自定義觸發器。在無法使用組織唯一識別符號(OUI)時,這是對非思科裝置進行分類的良好替代方法。使用內建裝置分類器的另一種替代方法是基於RADIUS屬性值對auto-smart-port=(自定義事件觸發器)進行觸發。RADIUS觸發器不在本檔案的範圍之內。
本文件沒有特定需求。
本文中的資訊係根據以下軟體和硬體版本:
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路正在作用,請確保您已瞭解任何指令可能造成的影響。
在本示例中,Avaya IP電話連線到3750X交換機上的Gi1/0/1。此範例使用來自電話的內建裝置分類器和連結層探索通訊協定(LLDP)資訊來自動設定連線埠。
確保裝置分類器具有所需裝置的內建配置檔案。自15.2.1E版本起,有250多個內建配置檔案。如需完整清單,請參閱本檔案結尾的附錄。配置文件僅與.tar映像綁架。根據您的代碼版本,配置檔案儲存在以下任一中:
如果禁用並重新啟用裝置分類器,則可以強制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
在本示例中,裝置分類器使用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-Phone的配置檔名稱,因此將觸發器繫結到該配置檔案。
c3750x(config)# macro auto trigger AVAYA_IP_PHONE
c3750x(config-macro-trigger)# profile Avaya-IP-Phone
宏是Auto 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
}
要使事件成功觸發,必須全域性啟用宏處理。
在全域性啟用宏處理之前,請確保通過no macro auto processing 命令禁用應排除的埠上的處理。
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驗證,必須首先為當前終端會話啟用Cisco 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-Phone,請輸入以下命令:
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
修訂 | 發佈日期 | 意見 |
---|---|---|
1.0 |
25-Sep-2013 |
初始版本 |