Internet flow work
Example Scenario:1
Objective: You want to visit www.example.com.
Entering the URL:
- You type
www.example.cominto your browser’s address bar and hit Enter.
- You type
DNS Resolution:
- Step 1: Your browser checks if it has the IP address for
www.example.comcached from a previous visit. If not, it sends a DNS request to your router. - Step 2: Your router, which may have its own DNS cache, checks if it has the IP address. If not, it forwards the DNS request to your ISP’s DNS server or a public DNS service like Google’s (8.8.8.8).
- Step 3: The DNS server looks up
www.example.comand returns the IP address, let’s say93.184.216.34, back to your router. - Step 4: Your router forwards the IP address to your browser.
- Step 1: Your browser checks if it has the IP address for
Making the HTTP Request:
- Step 1: Your browser now knows the IP address of
www.example.com, so it creates an HTTP request to93.184.216.34asking for the webpage. - Step 2: The HTTP request is sent from your device with private IP
192.168.1.2with source port10001to your router.
- Step 1: Your browser now knows the IP address of
Routing the Request:
- Step 1: Your router receives the HTTP request and performs the NAT like Translates the private IP to public IP with unique port (
192.168.1.2:10001to203.0.113.5:20001) and thenforwards the request to your ISP’s network. - Step 2: The ISP’s network routes the request (with the router’s public IP address and the unique ports assigned by NAT) over the internet to the server at
93.184.216.34wherewww.example.comis hosted.
- Step 1: Your router receives the HTTP request and performs the NAT like Translates the private IP to public IP with unique port (
Server Response:
- Step 1: The server at
93.184.216.34processes the request and sends back the requested data (HTML, CSS, JavaScript) needed to display the webpage. - Step 2: This data travels back through the internet to your ISP’s network.
- Step 1: The server at
Receiving the Response:
- Step 1: The ISP routes the data back to your router.
- Step 2: The router receives the response on public IP
203.0.113.5:20001and translates it back to private IP192.168.1.2:10001 and send the response to the respective device:192.168.1.2:10001.
Rendering the Webpage:
- Step 1: Your browser receives the data and processes it.
- Step 2: The browser renders the webpage, displaying
www.example.comfor you to view.
Visual Flow Diagram
- Browser: Requests
www.example.com - DNS Lookup: Resolves to
93.184.216.34 - Router: Forwards request to ISP
- ISP: Routes request to server
- Server: Sends response
- ISP: Routes response back
- Router: Delivers response to browser
- Browser: Renders webpage
Example Scenario:2
You have 4 devices on a local network:
- Device A:
192.168.1.2 - Device B:
192.168.1.3 - Device C:
192.168.1.4 - Device D:
192.168.1.5
All devices are connected to a router with a single public IP address: 203.0.113.5.
Detailed Flow with NAT (PAT) and Ports
1. Devices Making Requests
- Device A: Sends an HTTP request to
www.example.com. The request originates from192.168.1.2with source port10001. - Device B: Sends an HTTP request to
www.example.org. The request originates from192.168.1.3with source port10002. - Device C: Sends an HTTP request to
www.example.net. The request originates from192.168.1.4with source port10003. - Device D: Sends an HTTP request to
www.example.edu. The request originates from192.168.1.5with source port10004.
2. NAT (PAT) Process
- Device A's Request:
- Private IP and Port:
192.168.1.2:10001 - Router Translation: Translates
192.168.1.2:10001to203.0.113.5:20001
- Private IP and Port:
- Device B's Request:
- Private IP and Port:
192.168.1.3:10002 - Router Translation: Translates
192.168.1.3:10002to203.0.113.5:20002
- Private IP and Port:
- Device C's Request:
- Private IP and Port:
192.168.1.4:10003 - Router Translation: Translates
192.168.1.4:10003to203.0.113.5:20003
- Private IP and Port:
- Device D's Request:
- Private IP and Port:
192.168.1.5:10004 - Router Translation: Translates
192.168.1.5:10004to203.0.113.5:20004
- Private IP and Port:
The router assigns a unique port number for each request to distinguish between different connections.
3. Requests Sent to the Internet
- The requests from each device are now sent to the destination servers with the router’s public IP address and the unique ports assigned by NAT:
- Device A:
203.0.113.5:20001 - Device B:
203.0.113.5:20002 - Device C:
203.0.113.5:20003 - Device D:
203.0.113.5:20004
- Device A:
4. Servers’ Responses
- Servers respond to the public IP address and port numbers:
- Response for Device A: Sent to
203.0.113.5:20001 - Response for Device B: Sent to
203.0.113.5:20002 - Response for Device C: Sent to
203.0.113.5:20003 - Response for Device D: Sent to
203.0.113.5:20004
- Response for Device A: Sent to
5. Router Handles Incoming Responses
- Device A: The router receives the response on
203.0.113.5:20001and translates it back to192.168.1.2:10001. - Device B: The router receives the response on
203.0.113.5:20002and translates it back to192.168.1.3:10002. - Device C: The router receives the response on
203.0.113.5:20003and translates it back to192.168.1.4:10003. - Device D: The router receives the response on
203.0.113.5:20004and translates it back to192.168.1.5:10004.
6. Responses Delivered to Devices
- The router forwards the responses to the correct devices based on the NAT table:
- Device A receives the response at
192.168.1.2:10001. - Device B receives the response at
192.168.1.3:10002. - Device C receives the response at
192.168.1.4:10003. - Device D receives the response at
192.168.1.5:10004.
- Device A receives the response at
7. Rendering the Webpages
- Each device processes the response and renders the webpage for the user to view.
Summary of Revised Flow
- Devices: Send requests with private IP addresses and source ports.
- Router (NAT): Translates private IP addresses and ports to public IP address and unique ports.
- Internet: Receives requests from the router’s public IP with unique ports.
- Servers: Send responses to the router’s public IP with unique ports.
- Router (NAT): Translates responses back to the correct private IP addresses and ports.
- Devices: Receive and process the responses.
Comments
Post a Comment