SNMP
I am having an issue where I am using socket programming in a programmable logic controller using a special web card. I am doing a SNMP get request write to a gateway's IP and port # (161). I receive and read the response from my port and parse the data. This works great.
When I add another gateway to the network and make the same request to one gateway, both gateways respond. This happens when I make a request to either gateway. This is a little troublesome because I will eventually have 10-15 gateways, and I have to read each response to clear the socket when I only wanted the 1.
When I add another gateway to the network and make the same request to one gateway, both gateways respond. This happens when I make a request to either gateway. This is a little troublesome because I will eventually have 10-15 gateways, and I have to read each response to clear the socket when I only wanted the 1.
This discussion has been closed.
Comments
The way SNMP works is through the UDP protocol. UDP means that a packet is sent to a specific device and that device responds to it. The big difference with TCP is that there is no handshake. If 2 systems respond, then this means that 2 systems have received the UDP packet - so this means that it was sent to 2 devices.
What can be wrong when only one is on the network, and it responds correctly. I've used wireshark to trace the network and the SNMP request is only going to one IP address.
Shows 1 get request with specific IP address, with 2 get responses from said IP address and other IP address. This using wireshark.
Connect to a sensor and do a SNMP Walk and then a SNMP Get request on the OID matching the system. If you get the correct response back, then it is your code. If you get incorrect responses back, then it is your setup (duplicate IP, hostname or MAC)
I have 2 sensors, IP 201 and 203.
When I request 201, 201 and 203 send a response
When I request 203, only 203 responds
The issue must be somewhere in your network where the requests are sent to multiple sensors and not the sensor in question.
That being said, you can easily filter it out by verifying if your SNMP UDP response matches the IP address you sent it to and that way there is no issue.
Question: are these universal power, either power plug or PoE? My installation will be PoE, but I don't have a PoE for testing.