The supply IP address is lost after pdu forwarding in snmp protocol, please seek advice from .txt
- thistedle50ribdgl
- Jun 14, 2020
- 1 min read
Challenge description: The 3 servers are: serverA (ipA, portA), serverB (ipB, portB), serverC (ipC, portC). Send usb raw data recovery from serverA to serverB, serverB receives the pdu from serverA directly Forwarded to serverC, serverC receives the pdu from serverB and finds that its ip address isn't the address ipA of serverA, however the address ipB of serverB, which causes the supply address of pdu to become lost. ( hdd raw partition repair lost IP address refers to occasion.getPeerAddress. event is a parameter inside the processPdu(CommandResponderEventevent) system, and the processPdu(CommandResponderEventevent) process belongs for the CommandResponder interface inside the SNMP4J.jar package.)*** The code of serverB is as follows:** *****/***serverB service code. ** Implement the ProcessPdu process of CommandResponder, employed to get the incoming PDU, then forward it for the target serverC *When pdu is received, it will automatically enter this process. **@paramrespEvnt*/publicvoidprocessPdu(CommandResponderEventevent)//The following ip is taken from the event: who sent him the pud, who the ip address is. //This is a problem, from serverA to serverC, pdu is forwarded by serverB, //The final IP address becomes serverB, and the source ip address ipA is lost.//Please see how to deal with it to ensure Do not lose the source address of ipA. Stringip=event.getPeerAddress().toString();//Set target(that is, serverC)CommunityTargettarget=newCommunityTarget();//The target address, which is the address of serverC AddresstargetAddress=neworg.snmp4j.smi.UdpAddress(java.net .InetAddress.getByName(ipC),portC); target.setAddress(targetAddress);//The number of retries when the communication is unsuccessful target.setRetries(2);//Timeout time target.setTimeout(1500);//snmp version target.setVersion(SnmpConstants.version2c);//Receive pdu from serverA and forward it to target serverC to PDUpdu=event.getPDU();TransportMappingsendTransport=newDefaultUdpTransportMapping();SnmpsendSnmp=newSnmp(sendTransport);sendTransport.listen(); sendSnmp.send(pdu,target);
Comments