cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
226
Views
0
Helpful
0
Comments
Mark Malone
VIP Alumni
VIP Alumni

This may be useful to someone , put this script together it when it sees a phone in CDP it will auto configure the port for voice and data put port-security on it and dhcp snooping and bit of STP

This only works for phones , if you connect a switch the script will match nothing and not run it as a protection method not to just configure any CDP switch sees coming , you could tweak it if required

event manager applet Auto-Configure-Access-Ports-Voice&Data trap

description track and configure phone that comes up/up from cdp event

event neighbor-discovery interface regexp FastEthernet cdp add

action 0.1 comment "Verify Phone CDP neighbor connected"

action 0.2 regexp "(Phone)" "$_nd_cdp_platform" value

action 0.3 if $_regexp_result eq "1"

action 0.4 puts "match"

action 0.5 info type routername

action 0.6 cli command "enable"

action 0.7 cli command "config t"

action 0.8 cli command "default interface $_nd_local_intf_name"

action 0.9 cli command "interface $_nd_local_intf_name"

action 1.0 cli command "description $_nd_cdp_entry_name:$_nd_port_id"

action 1.1 cli command "switchport"

action 1.2 cli command "switchport mode access"

action 1.3 cli command "auto qos voip trust"

action 1.4 cli command "switchport voice vlan 196"

action 1.5 cli command "switchport access vlan 164"

action 1.6 cli command "spanning-tree portfast"

action 1.7 cli command "switchport port-security maximum 3"

action 1.8 cli command "switchport port-security maximum 2 vlan"

action 1.9 cli command "switchport port-security violation restrict"

action 2.0 cli command "switchport port-security aging time 1"

action 2.1 cli command "switchport port-security aging type inactivity"

action 2.2 cli command "switchport port-security"

action 2.3 cli command "ip dhcp snooping trust"

action 2.4 cli command "do write"

action 2.5 cli command "end"

action 2.6 syslog priority notifications msg CDP_Phone_Port_Auto_Configured_And_Copy_Run_Start_Completed

action 2.7 else

action 2.8 puts "nothing"

action 2.9 end

action 3.0 set _exit_status "0"

 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: