How redirect packets UDP ASSOCIATE via socks5 - vpn

TCP can redirect but UDP not working, Please help.
TCP get from ip:port destination
UDP get from ip:port endpoit

Related

How does Wireshark identify a TCP packet's protocol as HTTP?

Port number equals to 80 is obviously not a sufficient condition. Is it a necessary condition that Wireshark has found a request message or response message in application layer payload?
I'm not sure this is a full answer, but here is what I know regarding Wireshark's identification of HTTP packets (all items below are dissected as HTTP):
TCP port 80
TCP or UDP ports 8080, 8008, 591
TCP traffic (on all ports) that has line end (CRLF) and the line begins or ends with the string "HTTP/1.1"
SSDP (Simple Service Discovery Protocol) in TCP or UDP port 1900
DAAP (Apple's Digital Audio Access Protocol) in TCP port 3689
IPP (Internet Printing Protocol) in TCP port 631

TCP/UDP And NAT

My friend told me that TCP doesn't need port forward.
What exactly he said is if the server is port forwarded the client can request something and the server will respond without port forward.
And I agreed with that even though I'm not sure it is true.
Later he said it is the same with UDP which I do not believe.
MAINLY THE QUESTION IS
If a client requests something on a server with TCP, does it need to be port forwarded to receive the response?
Also is it the same for UDP?
If the request from the client is a SYN for connect call then only a SYN-ACK response will be allowed through NAT. If the NAT supports simultaneous open connection then a SYN response from server will also be allowed through NAT. After the connection is established then client and server can communicate freely without any restriction. Port forwarding is not needed.
For UDP after a packet from client to server is sent then anything from server can be received through exact same public port of the NAT from which the first packet was sent. No port forwarding needed.

Sending Udp on port 8080?

Is it possible to send/receive udp over port 8080? Everything I see says 8080 is strictly a TCP port. I don't quite get why that would be?
Port 8080 is used by TCP or UDP. There is no restriction of Kernel for opening ports 8080 UDP. What happens is that there is a convention to use port 8080 as TCP, like squid proxy, but nothing prevents you from using UDP in it.

How can I send UDP packets over SOCKS proxy

I am looking at traffic generated by my computer when socks server is defined.
I read over the internet and see that its possible to route udp also trough the proxy server.
when i try using different apps that uses UDP and allows socks settings, it uses it only for tcp traffic. why?
I have defined SOCKS5, as i understand that v4 doesnt support udp (why?)
i tried an example, Vuze client - its expert mode allows to prefer udp traffic, setup socks server and even at this point, any udp goes directly to peers.
My wish is to monitor the traffic and see how its transmitted, is it over UDP connection with socks server, or does it actually connects to the socks server in TCP and sends the data, which is then sent via udp to the destination?
When a client wants to relay UDP traffic over the SOCKS5 proxy, the client makes a UDP associate request over the TCP. SOCKS5 server then returns an available UDP port to the client to send UDP packages to.
Client then starts sending the UDP packages that needs to be relayed to the new UDP port that is available on SOCKS5 server. SOCKS5 server redirects these UDP packages to the remote server and redirects the UDP packages coming from the remote server back to the client.
When client wants to terminate the connection, it sends a FIN package over the TCP. The SOCKS5 server then terminates the UDP connection created for the client and then terminates the TCP connection.
Double SSH Tunnel Manager support SOCKS5 With UDP
3proxy Server support UDP

How do you write a UDP port forwarder?

As UDP is a connectionless protocol, once the forwarder gets a packet and sends it to a target ip, and the target ip responds with data, how can the forwarder know what ip to send the packet to?
If you are talking about a standard gateway, it knows where to send it because the packet has a destination IP address and port.
If you are talking about NAT, then the router must remember what it has recently sent out and accept corresponding incoming packets. The router maintains a session internally, which will stay alive for some configured period.

Resources