
How NAT Lets Multiple Devices Share One IP
Under the older IPv4 standard, an entire household typically shares a single public IP address, while every phone, laptop, and smart TV inside uses a local private IP that cannot be routed over the open internet. To bridge this gap, your router uses NAT (Network Address Translation). When your phone sends a request to YouTube, it attaches a random source port number, such as 50001, alongside its private address. The router intercepts the packet, swaps the private source IP for its own public IP, and logs a note in its translation table linking port 50001 directly to your phone.
When YouTube sends the video data back, it addresses the reply to your router's public IP and port 50001. The router inspects that incoming port number, matches it against its internal lookup table, and rewrites the destination back to your phone's private IP before forwarding the packet locally. If a laptop and a TV ever happen to pick the exact same source port while reaching the same server, the router simply assigns one of them a new unique port to keep the traffic streams separate, ensuring every packet lands on the exact device that requested it.
#Networking #SystemDesign #SoftwareEngineering #TechExplained #IPv4 #CodingForBeginners
When YouTube sends the video data back, it addresses the reply to your router's public IP and port 50001. The router inspects that incoming port number, matches it against its internal lookup table, and rewrites the destination back to your phone's private IP before forwarding the packet locally. If a laptop and a TV ever happen to pick the exact same source port while reaching the same server, the router simply assigns one of them a new unique port to keep the traffic streams separate, ensuring every packet lands on the exact device that requested it.
#Networking #SystemDesign #SoftwareEngineering #TechExplained #IPv4 #CodingForBeginners
KodeKloud
...