-1

I am trying to build a proxy server that will receive all client packets and forward to the content server. As I read the proxy type is "forward proxy". While doing the system architecture I couldn't answer this question.

How does the proxy server know the destination ip?

Suppose we have a client with ip 11.1.1.1 and proxy server with 12.2.2.2 and google with ip 13.3.3.3.

When the client send the packet to the proxy. The packet will have 11.1.1.1:xxxx as source ip and port, and 12.2.2.2:xxxx as destination ip and port. How does the proxy server forward the packet to 13.3.3.3 ?

1 Answers1

0

When a client uses a proxy, it uses a special protocol to do so. In case of HTTP proxying the client connects to the proxy and then tells the proxy what URL to fetch. The proxy then does the name resolution and fetches the content on behalf of the client.

In other cases (non-HTTP) the client usually uses a protocol called "socks" where it tells the proxy to what ip-address and port a connection should be made. The proxy then establishes the connection on behalf of the client and passes packets from the client to the destination host and vice versa

Andreas Rogge
  • 2,670
  • 10
  • 24
  • Can you please mention a VPN case, because I need to forward all the traffic. What will happen if the there is VPN in client side? – Mohd Alomar Feb 10 '18 at 22:24
  • VPN has *nothing* to do with proxying. It usually happens on a different network layer. So I don't understand what you need to know. – Andreas Rogge Feb 11 '18 at 03:31
  • I would like to forward all the traffic to a proxy server. Not per application traffic. So I need to use VPN ? and if I need to use an VPN that will work on IP layer. How the proxy server will forward the traffic to the correct end server? – Mohd Alomar Feb 16 '18 at 00:39