Wednesday, 19 March 2014

Behind the scenes - While you browse www.google.com from your computer

1. You open the browser and type www.google.com in the browser
2. Your laptop has the IP address and DNS server address
3. Now computer want to resolve the www.google.com to the IP address
4. He check the DNS server IP he got during the DHCP process
5. If DNS server is not in his subnet he need to resolve it
6. Suppose client even dont know he mac address of gateway
7. Computer will send a L2 broadcast ARP to asking what is the mac address of my gateway
8. Gateway respond back saying my mac address is x.x.x.x.x
9. Computer will send the DNS request to the gateway
10. Gateway check his routing table if this IP address is know to me
11. If not he will forward the request based on his routing table
12. Request goes like this and reached the DNS server
13. DNS server respond back with the IP address of www.google.com
14. IP address reaches the computer
15. Computer check if the IP is in his subnet else will forward the request to gateway
16. Here is the packet computer forms

 Source IP address - Computer IP
 Source Mac Address - Computer mac
 Destination IP address - google IP address
 Destination Mac - Gateway mac address

17. If reached the gateway and he checks the routing table as before
18. Now gateway change the packet as bellow

Source Mac - Gateway Mac
Source IP - Computer IP
Destination Mac - Mac of next route in the routing table
Destination IP - google IP address

19. This process continues on the way
20. Every router comes in between changes the Source and destination mac but keep the source and destination IP as same.
21. Packet reaches google
22. Google respond back as bellow

Source IP -google IP address
Source Mac - google mac
Destination IP - Computer IP
Destination Mac -  gateway of google

23. This process continues as mentioned above and packet reaches the computer

IF NAT IS CONFIGURED
===================
Most probably NAT will be one to many

Here natting device will keep a track on the IP and port number client used to send data to the public IP
Source port 10 , IP address 10.10.10.10 ===>>> Mapped to 200.200.200.200

While the reply comes it will be again on the same port number so natting device know which was the client mapped to this IP address in this port number.







1 comment:

  1. Gratitious ARP :- Used to detect duplicate address.
    Client send a packet with source and destination IP as its own address and destination mac as ffffffffff . Common example is once client changes its IP it send a GARP.

    Reverse ARP :- Resolve Mac address to IP address not used anymore as everyone uses DHCP for getting IP address.
    Inverse arp also server same purpose which is used in frame relay

    Reverse ARP and Inverse ARP both are used for getting IP address but the difference is:
    * In RARP u get ip add, when u know MAC add of that interface.
    * In InARP u get ip add, when u know the DLCI no.

    ReplyDelete