Hi All,
I have a lot of printers that are being installed in the next few months, so I made a script to change VLANs based on the vendor MAC address of the devices. I've also used this to quickly put computer labs or APs in the same networks.
If you think you could use this, please feel free to check it out here: github.com/robschn/mac-change-vlan
Usage
- Enter the vendor MAC of the devices. This is the first 6 of a MAC address and must be in Cisco format, HHHH.HH.
- Enter what VLAN you want all the devices to be in.
- Enter the IP of the switch the devices are connected to.
Vendor MAC for the devices. Must be HHHH.HH format: 0000.0c VLAN would you like the devices to be in: 10 IP of the switch the devices connect to: 192.168.1.1
Once you log in, the script will run a search for devices containing the vendor MAC. If a device is already in the VLAN you specified, it will not be added to the list.
Username: cisco Password: Logging in now... Searching for MAC address... Found these interfaces: ['Gi1/0/3', 'Gi1/0/5', 'Gi1/0/9', 'Gi1/0/11']
If the interface is a trunk:
Gi1/0/3 Skipping, port is a trunk.
Else:
Gi1/0/5 Modifying, please wait... Done! Gi1/0/9 Modifying, please wait... Done! Gi1/0/11 Modifying, please wait... Done!
After the interfaces are done, it will write memory and exit:
Writing to memory, please wait... VLAN changes completed! Exiting program...
No comments:
Post a Comment