Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

VLAN Change by IP

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!

Everyone's tags (1)
5 REPLIES
Cisco Employee

A previous discussion located

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

 

New Member

Thanks - I actually saw that

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

Cisco Employee

What would be the condition

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)?

 

New Member

The condition would be on a

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!

Cisco Employee

If you place the attached

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 ***

 

230
Views
0
Helpful
5
Replies
CreatePlease to create content