Unable to receive response from the SNMP port - snmp

I am using SNMP to access the remote system data. According to the requirement I am encoding the SNMP request data to OAMPDU packet format and sending to remote system. The remote system receives the OAMPDU packet, decodes it and sends the snmp request to snmp agent through UDP socket which is bound to port 161. But I am unable to receive the response from snmp agent. I have created a UDP socket which is bound to 161 port to receive the response.
If I use any other free port number other than 161 for receiving SNMP agent does not send responses to that port.
Can anyone please suggest me how to overcome this problem?
Can we configure the different ports for tx,rx ???
How do we know on which port does snmp sends the response ???

Each UDP packet has a source port and a destination port. An SNMP manager sends out an SNMP request using any source port, and destination port 161. The agent will reply to the source port on the manager. For example:
Manager Agent
source port: <random number>
dest port: 161
content: what is your sysUpTime
source port: 161
destination port: <same random number>
content: sysUpTime is 42 seconds
Replies arrive on random number port, not port 161. So a manager listening on port 161 is unlikely to receive many replies. Instead of listening on port 161, listen on the same socket you used to send out the request. That socket will remember the source port it chose for sending.
P.S. When you use SNMP to query, SNMP's manager is UDP's client, and SNMP's agent is UDP's server.

Related

I can’t send email from my own mail server using cyberpanel webmail

I have been trying to create my own server using cyberpanel on vultr I already created my email and issue ssl and configured my dns and my reverse dns but when I login to my rainloop my message would be sent but won’t deliver but if I send a mail to my rainloop mail account I get it quickly but can’t reply from my rainloop,I have tried setting up my imap and pop3 in the rainloop admin to connect it with gmail still the same way please what should I do
Have you verified the ports are open? These ports are blocked by default at Vultr. You may request removing the blocks by opening a support ticket.
TCP port 25 (SMTP)
TCP & UDP port 137
TCP & UDP port 138
TCP & UDP port 139
TCP & UDP port 445
TCP port 1688 (KMS, inbound only)
There are three SSL options on CyberPanel, you need to select email SSL for your email to work
Every provider blocks port 25 to control spam. Contact your ISP or if you are hosting your server on Digital Ocean or AWS request them to unblock port 25 ( They never agree, at least for me )

pcap / winpcap - send packet to Rx

I'm capturing traffic with winpcap on a Windows machine that is also a network gateway, so I see packets with src mac, src ip, dst mac, and dst ip which are different from the gateway's mac and ip.
What I'm trying to do is redirect some of those packets to a listening server (for example, redirect all port 80 HTTP packets to a local HTTP server instead of their original destination, something similar to a captive portal).
My idea is to disable IP forwarding on the gateway so packets won't go out, and reinject the captured packets to the interface again with winpcap. However, the listening server ignores these packets.
I researched this issue, and found out that maybe it has something to do with Rx, Tx. Apparently, when you send packets with winpcap, listening for those packets on the same interface won't work because listening is on the Rx channel and sending is on the Tx channel.
Does anyone know any workaround for this issue?

Getting FIN and RST flags when attempting TCP handshake in OS X

Trying to establish a tcp connection between a client / server. Both machines are Macs and are on the same LAN. Server's app listens on port 12345. After receiving "SYN, ACK" from Server, I send "ACK" but then my client automatically sends a "FIN, ACK" followed by "RST, ACK". So the TCP Flow ends up being:
Client sends SYN.
SVR sends SYN, ACK.
Client sends ACK.
Client sends FIN, ACK.
Client sends RST, ACK.
SVR sends ACK.
SVR sends ACK.
Client sends RST.
Client sends RST.
From reading other posts with similar issues it sounds like this could be happening because I'm trying to manually create the handshake on the user level and the Unix kernel (operating at the system level) sees the "SYN, ACK" far before anything on the user level can respond and moves to close the connection, seeing it as open for no reason. A similar problem to what this Linux user experienced: Unwanted RST TCP packet with Scapy
Whereas iptables worked for the Linux user should I use something like pf in Mac OS X to block / drop the FIN and RST msgs? My client is running 10.9.5 and my server 10.10.3.
Here's a flow graph of the tcp communication Server is 10.0.100.5 and client is 10.0.100.4:

Receive OSC Message on sending port

I have an OSC server which returns data upon receiving a request message to the port used to send said request. Is there a way to find the port which was used to send the message (assigned by the os) and then open a listen channel on that port?
Before sending your message from the client, just bind it. For an automatically assigned port, use 0 as the port number. Example:
require 'socket'
u = UDPSocket.new
u.bind('0.0.0.0', 0)
Now you can receive from the same port you send from.

UDP Socket and ruby

I am having trouble to bind to a server address. I have a connection, to a server (using Savon XML Library). Now I just need to listen to that server and gather its HTTP packets that sends. The server each time sends:
http://200.34.12.168/Videos/1/frame/0
http://200.34.12.168/Videos/1/frame/1
http://200.34.12.168/Videos/1/frame/2
http://200.34.12.168/Videos/1/frame/3
http://200.34.12.168/Videos/1/frame/4
...
..
which are HTTP packets. I am trying to create a UDP server that listens to these. This is what I have so far:
s = UDPSocket.new
s.bind('200.34.12.168', 80)
5.times do
text, sender = s.recvfrom(16)
puts text
end
it fails at the bind function. How can I listen to a UDP connection with ruby?
The Error I get:
"`bind': Can't assign requested address - bind(2) (Errno::EADDRNOTAVAIL)"
Do you have a web browser running - it may already be bound to port 80..

Resources