bash script for auto VLAN assignment
I’m trying to write bash script that need to do telnet session to some switches and change the port VLAN to the end user desired VLAN ID.
I know how to write the most of the script but I have problem with few things, we have more than 30 VLAN our network, each vlan is sometimes class B 255.255.0.0 and sometimes 4 “C” classes 255.255.252.0 or one “C” class 255.255.255.0.
My goal is to let the user to write the desired ip + switch ip+ port number, then the script automatically will change the VLAN ID on the specific port.
My problem is how to assign the vlan ip to the vlan id, I mean if the user write:
Ip 10.7.4.100 , port 10 , switch-ip 10.7.4.1
How I can tell to the script that if the user wroth ip 10.7.4.x or 10.7.5.x or 10.7.6.x or 10.7.7.x then assign it to VLAN 11.
Or if the user wroth desired ip 10.7.20.x or 10.7.21.x than assign the port to VLAN 20.
I hope that you understand my question.
If I’m not clear enough please let me know.