Amir reza Riahi
Amir reza Riahi

Reputation: 2450

How to get the destination port and IP while send request to a proxy server?

While sending a packet (tcp or udp) to proxy server, we want that server send the packet to the destination we want and then receive the response and give that to us. In this case, we have 2 destination and one place for putting data in that. I want to ask proxy server with IP address X and port p to get a web page from IP address Y and port ‍‍q, how can I send this packet? If I put X and p in my packet, the proxy server can't understand where to send the packet after receiving it. On the other hand if I put Y and q in my packet, how the packet can reach the proxy server?

One solution here I think is that we send one packet inside another packet. The outer packet will take the inner packet to the proxy server, and then proxy server will extract the inner one and send it to the destination. Is this solution practically correct? Is there any standard protocol for solving this problem?

Upvotes: 1

Views: 1072

Answers (1)

Karel vIJ
Karel vIJ

Reputation: 46

You have the right idea, a proxy protocol usually wraps the original TCP/UDP package up in another package that is send to the proxy server. A VPN also works this way.

SOCKS5 is a heavily used proxy protocol. Most browsers and operating systems support it. Tor relies on it and if you have an SSH connection it can also be used as a SOCKS proxy.

When the client needs to be unaware of the proxy than tunneling on network level like VPN might be a good option.

Note that most encryption happens on application level (like SSL in browser). A proxy is always able to discern the destination IP and port but the data it sends is already encrypted and therefore unreadable.

Upvotes: 1

Related Questions