08-04-2014 02:24 PM
Hello,
I was hoping someone could please help me with an automated script. The logic seems not so difficult although, I do not have much TCL experience...
I need a way to load a list of IPs (probably 50 at a time), find their associated MAC address, then find the port its on (excluding trunks), and then change its vlan.
Does anyone have any experience with this?
Thank you in advance for any help!
08-05-2014 06:43 AM
A previous discussion located at the link below had similar requirements (mac to port mapping) and logic can be added to change the access vlan.
https://supportforums.cisco.com/discussion/12141486/create-eem-find-port-mac-address
08-05-2014 11:27 AM
Thanks - I actually saw that response. Unfortunately my knowledge of this is just about nothing and am under a very tight deadline....I cannot seem to figure out how to add that logic in to change the port. It would be nice to ensure it isn't a trunk too but that may be a luxury.
Thanks again
08-05-2014 04:34 PM
What would be the condition that the port changes the access vlan? When the script changes the vlan on the port what vlan should it assign? Would there be a reason that the script would not change the vlan (other than the port being a 802.1q trunk)?
08-13-2014 08:22 AM
The condition would be on a list of specific IP addresses. I have a list of IPs that need to be changed to a different VLAN, in which case we can reboot the machines and they will get a new DHCP IP. The vlan is going to be vlan 174 that it needs to be changed to. There is no other reason other than a trunk that it shouldnt be changed.
Thanks again for the help - very very much apprecaited!
08-13-2014 11:51 AM
If you place the attached file on the flash drive of your switch and run this command it should produce the vlan change only on access ports for the list of provided ip addresses.
tclsh flash:resolve_changevlan.tcl <list of ip addresses>
Ex:
Switch_1#tclsh flash:resolve_changevlan.tcl 192.168.0.125 192.168.0.1
192.168.0.252 192.168.0.251 192.168.0.141 192.168.0.142
*** 192.168.0.125 Fa0/12 is not currently an access port ***
*** 192.168.0.1 Fa0/12 is not currently an access port ***
***192.168.0.252 verify vlan change****
Building configuration...
Current configuration : 62 bytes
!
interface FastEthernet0/14
switchport access vlan 174
end
*******************************
*** 192.168.0.251 not in MAC table***
***192.168.0.141 verify vlan change****
Building configuration...
Current configuration : 78 bytes
!
interface FastEthernet0/2
description SUN
switchport access vlan 174
end
*******************************
*** 192.168.0.142 Fa0/19 is not currently an access port ***
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide