I am confused about how packets from my machine reaches their destination through proxy servers. my machine has a private ip for intranet and we have a proxy server with public ip to talk to world.
so we have three addresses here.
1) my private ip address
2) proxy server address
3) destination address (google.com)
now in the tcp packet that I send I have source and destination port to distinguish the various programs (like mozilla , chrome , ie) on my machine and destinations.
in the ip network layer I have source and destination address.
I don't know whether http also has addresses.
so when my packet leaves my machine, what address would it be containing. so that it reaches my proxy server through gateways in between. ?
once it reaches proxy server, NAT can be used to send it to destination. but I am confused about how it reaches proxy server.
EDIT: should my packet contain address of my proxy server (local private one) to reach it? I can change my proxy server by configuring my browser. how does my packet once it leaves my machine knows which proxy server it would go?
HTTP sits on top of TCP/IP (along with FTP, SMTP etc)
You configure the proxy server on your PC, so all requests are sent through the proxy (unless they're recognised as local addresses).
When you request a page from "www.google.com:80"
The packet doesn't reach the target at all. The data inside it reaches the target as part of a new connection between the proxy and the server, in completely new packets, whose size and number may be different from those in the downstream connection. From the server TCP's point of view it is connected to the proxy, not the downstream client.