USE OF MAC ADDRESS.
What happens when you ask for a web page?
How does the server only gives you the page you requested, and not the one other machine’s on the same network asked for?
What is the real use MAC address?
let’s have a look at it.
- Service Provider gives a user an IP address, which is used when you ask for a page.
- So the web-servers responds to that IP.
- The Service Provide knows one of its IP requested it from one of its Switches.
- The ISP then forwards it to the Switch through which request arrived,
- The switch then sends it to the earlier switch which made the request.
- Now here this switch has various machines connected to it.
- It will check which IP is with which MAC ID, once it got a hit that ‘www.google.com’ was requested by IP 182.134.53.23 with MAC ID AA:BB:CC:00:11:22 , it will send that to that machine.
- Now that it successfully found the MAC, it knows the physical place of the PC so it sends the response there.
In case of router,
- The router has a table of MAC address and the IP assigned to it.
- It checks which IP requested which page and checks the table, finds the MAC and forwards it to that machine.
Now suppose,
User A wants to use ‘www.facebook.com’ and has an internal address of 192.168.0.100 with MAC 11:22:33:44:55:66.
User B wants to use ‘www.yahoo.com’ and has an internal address of 192.168.0.101 with MAC 21:42:53:64:75:86.
Mobile C wants to use www.facebook.com and has an internal address of 192.168.0.103 with MAC A1:B2:3E:4C:5A:61.
Mobile D wants to use www.facebook.com and has an internal address of 192.168.0.104 with MAC 31:BD:EF:AC:B2:D4.
Router will have internal IP and the MAC of those machines in a table. It keeps a record of which MAC is associated with which internal IP.
- So when response from switch comes to the router, it will look up at the table and find that the request was from IP 192.168.0.100. Next it will check its MAC and send the request to User A.
- Similarly when response of yahoo.com arrives, it will check the internal IP to find which IP requested it, then the MAC and then will send the response to User B.
- If Mobile 1 requests a page Mobile 2 won’t get that page, because it will be sent to the MAC of Mobile 1 and not of Mobile 2.
This is how, IP addresses and MAC address help us get the page we requested, and communicate with other machines.
How will router keep track of which public ip is associated with which private ip ???
Router has only 1 public address through which it communicated with outer networks.
It assigns private IP addresses to the devices connected to it, and keeps a table of which local IP has been assigned to which device.
All the requests made by devices connected to router go through only 1 public IP which router has.
You can refer https://geekstarts.tech/router/ and https://geekstarts.tech/network-address-translation/ for in depth explanation of the same.
Please tell me how the the
1.public ip’s like 192.168.0.103 , 192.168.0.104 are generated ??
2.private ip’s like 182.148.5.75 ,182.148.5.100 are generated ???
Thanks.