cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1127
Views
0
Helpful
2
Replies

Automatic phone vlan changes based on device

robmccarty
Level 1
Level 1

Running 2 phone systems (Cisco and a Polycom) on 9400 switches, IOS-XE 16.6.2. Since they have different DHCP options, they are in different phone VLANs.

 

I was hoping to find a way to automate the port configs based on the phone plugged in. We move them around a lot which requires a network admin to change the config each time. 

 

The phones identify themselves in CDP or MAC address to tell them apart. Is there a way to locally have the switch in port UP try and detect this and make the change (if needed)? I'm not completely familiar with the new IOS-XE capabilities, so just looking for a 'if its possible' without buying more advanced add-ons (like prime or APIC-EM). 

 

 

2 Replies 2

balaji.bandi
Hall of Fame
Hall of Fame

I have suggested one of the user some time back as below :

 

event manager applet DETECT_CDP_PHONE
event neighbor-discovery interface regexp .*GigabitEthernet.* cdp add
action 10 puts "CDP Device Type $_nd_cdp_platform detected on Interface $_nd_local_intf_name"
action 20 set result "0"
action 20.1 string equal length 13 "Phone decription*" "$_nd_cdp_platform"
action 20.2 if $_string_result eq 1
action 20.3 set result "1"
action 20.4 end
action 30.1 string equal length 13 "Phone Description*" "$_nd_cdp_platform"
action 30.2 if $_string_result eq 1
action 30.3 set result "1"
action 30.4 end
action 40 if $result eq 1
action 40.1 cli command "enable"
action 40.2 cli command "conf t"
action 40.3 cli command "interface $_nd_local_intf_name"
action 40.4 cli command "YOUR COMMAND"
action 40.5 cli command "YOUR COMMAND"
action 40.6 cli command "YOUR COMMAND"
action 40.7 cli command "YOUR COMMAND"
action 40.8 cli command "description $_nd_cdp_entry_name via EEM_CDP - $_nd_cdp_platform"
action 50 puts "Configured Interface $_nd_short_local_intf_name for PHONE $_nd_cdp_entry_name"
action 60 else
action 70 puts "CDP Neighbor not recognized as PHONE. Doing nothing."
action 99 end

 

@Georg Pauwen  - confirmed below script working,

 

 

 

 

event manager applet CDP_PHONE_DISCOVERY
event neighbor-discovery interface regexp .*Ethernet.* cdp add
action 1 puts "CDP Device Type $_nd_cdp_platform detected on Interface $_nd_local_intf_name"
action 2 set result "0"
action 2.1 string equal length 14 "Cisco IP Phone" "$_nd_cdp_platform"
action 2.2 if $_string_result eq 1
action 2.3 set result "1"
action 2.4 end
action 3.1 string equal length 14 "Cisco IP Confe*" "$_nd_cdp_platform"
action 3.2 if $_string_result eq 1
action 3.3 set result "1"
action 3.4 end
action 4 if $result eq 1
action 4.1 cli command "enable"
action 4.2 cli command "conf t"
action 4.3 cli command "interface $_nd_local_intf_name"
action 4.4 cli command "switchport port-security maximum 2"
action 4.5 cli command "switchport voice vlan 20"
action 5 puts "Configured Interface $_nd_short_local_intf_name for Cisco IP Phone $_nd_cdp_entry_name $_nd_cdp_platform"
action 6 else
action 7 puts "CDP Neighbor not recognized as Cisco IP Phone or conferencing device."
action 8 end

 

hope this helps you. tweak as per your needs.

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

wow thanks for the quick reply, that looks spot on! Will test next week and post my findings :)
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: