Switches, Hubs, and Modems
cancel
Showing results for 
Search instead for 
Did you mean: 

HP ProCurve - Use snmpset to add a port to a VLAN

Alan Harrylal
Occasional Advisor

HP ProCurve - Use snmpset to add a port to a VLAN

Hello,

I am able to successfully add a port to a vlan as untagged using the following snmpset command on an HP ProCurve 2510g switch:

snmpset -v 2c -c TEST 192.168.200.6 SNMPv2-SMI::mib-2.17.7.1.4.5.1.1.6 u 20.

More specifically, this adds interface 6 to vlan 20 as untagged.

The problem that I am having is this:
Interface 6 is originally assigned to vlan 10 as an untagged port, however, when I run the above snmpset command, port 6 does indeed get added to vlan 20 as untagged, but it also becomes a tagged port in the original vlan, vlan 10.

When I run the snmpset to put the port back into its original vlan, it goes in as untagged, but now it is set as tagged in vlan 20.

How can I just add the port to a vlan as untagged without having it tagged in the vlan that it is being moved from?

Thanks for any help that anyone can provide.

Also, there is no descritption for these OIDs. I loaded up the latest MIBs for this device and used a MIB browser to drill down to the object, but there is no description.

Thanks again,

Alan H.
3 REPLIES
Alan Harrylal
Occasional Advisor

Re: HP ProCurve - Use snmpset to add a port to a VLAN

Ok, let me ask this question a different way: Does anyone know how to remove a tagged port from a vlan via SNMP?

Thanks,

Alan
Rastaferraille
Occasional Visitor

Re: HP ProCurve - Use snmpset to add a port to a VLAN

Hello,

I have exactly the same problem.. Have you found a solution ? somebody could help ?

Thanks !
Rastaferraille
Occasional Visitor

Re: HP ProCurve - Use snmpset to add a port to a VLAN

I solved it with this code in PHP :

public function removeTaggedFlagOfPortInVlan($vlan_id,$port_id){

/*
This funtion is used because when a port is untagged in another VLAN with snmpset function, the port is not set to NO in the original vlan but set to TAGGED
And we don't want that...
Hexa string converted in binary : each '1' position (first, second...) in the binary string represent a port number (first->port 1, second ->port 2 etc.).
*/

$ports_hexa = $this->getEgressPortsInHexa($vlan_id);
$ports_bin = Fonctions::hex2bin($ports_hexa);
$ports_bin[$port_id - 1] = '0';
$ports_hexa = Fonctions::bin2Hex($ports_bin);
return snmpset($this->ip,$this->community,OID_EGRESS_PORTS.'.'.$vlan_id,"x",$ports_hexa);

}