4
1
I wish to know how my packets travel from my computer to a web server. Please bear with the long post. I will pose lots of question in between and will upvote if you answer any one of them. I am connected to a LAN, where the router gives me the an IP address via DHCP. So, when I switch on my WiFi, I send a UDP broadcast to port 67. The DHCP server receives the broadcast and assigns me an IP address and the DNS server address. Am I correct so far? So now I open my browser and type say "www.cnn.com". Browser does a DNS lookup and finds the IP address of cnn.com. It then sends the packet to this address. The computer looks at the dest IP address and looks at its routing table. It sees that the dest IP addr is not on the LAN. So. it send the packet to the default gateway (my router). The router usually provides the DHCP service too.
Q1. The router is connected to my ISP and has a WAN IP and a LAN IP. Is this WAN IP globally visible? or is the router also part of a ISP LAN?
Assuming the router has a globally visible IP address. At this point, it should change the src IP address to its own WAN IP address. The router has a WAN MAC address too. Does it change the src MAC address too? I presume each subsequent router which does not have a globally visible IP address will change the src IP address to its own IP address. I am little confused about this.
Q2. Assuming somehow the packets reach the server and I receive a reply back. How does the LAN router know who this packet is for? Does it use NAT to find this out? Does it use MAC (if it did not change the MAC above)? When does ARP come into the picture?
I know there are two type of switches (Layer 2 and Layer 3). What kind of switches are the typical routers (Linksys etc.)?
I know I am asking too many questions and many/all of them might be noobish/dumb. But I really want to know the answers. Please point out if I missed anything in describing the system. I would appreciate if you can provide links to blogs/articles etc.
Thanks a lot for replying. When I said "I presume each subsequent router which does not have a globally visible IP address will change the src IP address to its own IP address" I meant to ask what happens in the case of an ISP formed LAN? I guess there will be Layer 2 switching (and possible SrcIP replacements) but once the packet reaches a router (with global WAN IP) there will be only Layer-3 routing from there on with no replacements. – Bruce – 2011-06-25T19:10:27.113
If you're in an ISP lan, then there might be several layer 2 switching and several layer 3 routers before you reach the globally visible gateway, that gateway will do NAT (replace the source IP address for outgoing packets and replace the destination address for incoming packets), but the routers inbetween will not replace the IP address. The layer 2 addresses will be replaced, as layer 2 is normally just point to point. – nos – 2011-06-26T11:32:14.167