Is there any way to assign a VLAN to a port via SNMP? I found the OID that holds the VLAN ID for each port ( .1.3.6.1.2.1.17.7.1.4.5.1.1.X where X is the port number) but I am unable to set it to any value but the one it has.
All my ports are set 'switchport mode access' so they can only have one ID per port.
I found an earlier post of someone trying to do this, but it was back from fall 2007, so I'm wondering if there is any current solution to achieve this. It would be much appreciated.
Thanks!
JoseQ
The oid described (.1.3.6.1.2.1.17.7.1.4.5.1.1.x) is the PVID, which is the VLAN ID assigned to untagged frames received on that port. I tested this on a 3524 with firmware 2.0.0.29 and it seems to work fine. After making the change thru SNMP I was able to verify it in the web UI > Switch > VLAN > Port Settings > Show All.
Assigning ports to the VLAN requires a different oid. If you assign a port to a vlan in the web UI under Switch > VLAN > VLAN Membership, you can see that it changes the following oid(s) when walking the mib:
1.3.6.1.2.1.17.7.1.4.3.1.2 (all ports assigned) 1.3.6.1.2.1.17.7.1.4.3.1.4 (all untagged ports assigned) Hope this helps. - Victor
Which tool did you use to set the value and what variable type did you use?
Here's the command I'm using from a Linux box:
snmpset -c private -v2c -On switcho .1.3.6.1.2.1.17.7.1.4.5.1.1.20 u 145
And the result:
Error in packet.Reason: (genError) A general failure occuredFailed object: .1.3.6.1.2.1.17.7.1.4.5.1.1.20
I have verified that the private community has permissions from this IP (I use it to switch ports on and off via snmp without issues).
I also looked at the 'all untagged ports assigned' to each VLAN, but got unable to write to that one...
I feel I'm getting closer to a solution, but no cigar just yet...
To add some info, I have about three dozen PowerConnects ranging from 3348s to 3548. It seems 2.0.0.29 was released recently so I dont have any switches with that yet, and I can't upgrade them right away as they are in production. I do have some with 2.0.0.21 which may be the previous version, and I get the same result.
To set the PVID the port VLAN mode has to be set to General if Tagged. Or, can use Access mode or General mode if an untagged member of that VLAN. Anything else will fail as is also shown in the VLAN Port Settings screen in the Web User Interface.
I am using Adventnet mib browser to read and write the dot1qPvid value, setting it to any number between 1 and 4095.
Can you elaborate on the first paragraph? I am using 'switchport mode access' on all our ports (except the uplink, which is trunk).
This 'general' mode is new to me, so I'm not sure if we can revert everything to it, or if there is a way to set the VLAN ID via snmp in access mode.
Ok I figured out how to use the general mode as untagged which is how our ports are anyways (in access mode). So I can set the pvid as long as the switchport is set to general... However, all of our switches are currently in access mode. Is there any way to change the Vlan ID via snmp in that case?
You can use Access mode if the port is an untagged member of the VLAN. You can also use OID .1.3.6.1.4.1.89.48.22.1.1.x to set x port to general (1), access (2), or trunk (3).
Ok, I have setting the PVID down... now, how can I set the equivalent of this: "switchport general allowed vlan add X" via snmp?
Thanks a lot. Do you know if these changes go into the startup_config automatically or just into the running_config?
If the latter, how can I save the current config into the startup one via snmp?
The above changes only go to the running-config. To copy running to startup you will need the rlCopyTable entries
You can also download the running-config file from the switch to a remote TFTP server and then copy the active image to a remote server using SNMP using a single SNMP set request using the "rowstatus" create&go method. For example the following parameters could be scripted...* set rlCopySourceLocation = set this to the source type (e.g. I set source to local for my testing - see MIB for more info).* set rlCopySourceUnitNumber = set this to the unit # of the switch in the stack or set to 1 if you are not running stacking.* set rlCopySourceFileType = set this to the type of file to copy (e.g. running-config or image - see MIB for more info).* set rlCopyDestinationLocation = set this to the destination type (e.g. I set destination to tftp).* set rlCopyDestinationIpAddress = set this to the IP address of the TFTP server if you are doing TFTP copy.* set rlCopyDestinationFileName = set this to the name of the destination file.* set rlCopyHistoryIndex = set this if you want the history of the copy to be retained (you need a unique history index so use the next free index variable - see MIB).* set rlCopyRowStatus = set this to "create&go" (value = 4) to create the row in the table and start the copy.Note that the copy succeed really fast when copying a configuration file and when it completes the row is removed so if you want history save it in the history table. If you copy an image then the row may stay around awhile so you can poll status while the copy executes.
What is the SNMP string to set a vlan for the 54XX series?
The exact string will depend on the SNMP tool you are using and therefore you will need to check its documentation for proper syntax. The oids used to create the vlan and add ports to it are under dot1qVlanStaticEntry in the Q-BRIDGE-MIB.
Hello,Ive tried this above and checked the Qbridge, unfortunately i cant get it working.The oids i am using are HEXdecimal, but i dont have any clue how to set them.Tagged: 1.3.6.1.2.1.17.7.1.4.3.1.2Untagged: 1.3.6.1.2.1.17.7.1.4.5.1.1Can you please help me?