Most home routers use a special-case of NAT called PAT. Show You'll also see it referred to as NAPT, or IP Masquerading. All three of the latter terms mean the same thing in general use. (The acronyms - Network Address Translation / Port Address Translation / Network Address Port Translation) When the packet goes out from your internal machine, the source address is rewritten as you are aware. The source port is also changed, usually to a high number, and the router keeps an address translation table. For example, let's say you have a client machine that goes to www.google.com. Your computer (e.g., 192.168.1.100) looks that address up and makes a TCP connection to 72.14.204.147 on port 80 from your internal IP address, using a random source port. To your computer, the connection looks like this: 192.168.1.100:37641 <--> 72.14.204.147:80Your computer sends the packet to the router, which picks a new random high port and rewrites the packet. Each outbound connection gets its own port on the router. The router then forwards the packet on to your ISP after adding it to its connection table: PrivateIP PrivatePort PublicIP PublicPort Remote RemotePort ------------- ---------- ----------- ----------- ---------- ----------- 192.168.1.100 37641 *10.6.23.5 59273 72.14.204.147 80*For example purposes, I used an address starting with 10, but these aren't publicly routable. The table is also somewhat oversimplified. To google, the connection looks like this: 10.6.23.5:59273 <--> 72.14.204.147:80Google will send it's reponse to 10.6.23.5 on port 59273. Your router then looks up that information in the table and forwards the packet on to 192.168.1.100:37641.
If you're seeing this message, it means we're having trouble loading external resources on our website. If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.
A network router plays a crucial role in how data packets travel to and from a computer to host across the Internet. Routers serve as the junction point between the computers in a network and an Internet connection source. Computers transmit data to each other over network connections in data packets, and the router's job is to make sure those data packets get where they are supposed to go. Packets
Routers
Router Path
Router Transmission
Previously, we looked at a simplified IP packet, with fields for the source and destination addresses as well as the data it transports.
Previously, we looked at a simplified IP packet, with fields for the source and destination addresses as well as the data it transports. In a real IP packet header there are several other fields.
You can find all the details about the header of IPv4 packets as well as the header of IPv6 packets on Wikipedia. Routers and routingRouters got their name because they route IP Packets across networks: a router device connects different links. It examines IP packet headers, looking at the destination address and consulting a routing table of known networks. The table indicates which connections to send the packet on as the next link. The connections on a router are called interfaces: through the router, they interface between different link types. In the animation, an IP packet arrives at a router, which compares the packet’s destination address with the networks in the routing table. The packet is identified as belonging to network A, so the router routes it out of interface 1. Often, routers learn how to reach distant networks by exchanging information with their neighbouring routers and building their own routing tables. This exchange of information to learn about other networks is called a routing protocol. You can find more information about routing protocols on Wikipedia.
Routing on Home and Small Business NetworksA home or small-business network usually has a single LAN, which a router connects to an ISP.
So the router is connected to two different IP networks, which are automatically placed into the routing table. The default network, 0.0.0.0, gets configured so it sends data out via the WAN interface and onto the next router. Each router examines and sends each IP packet individually — this is called packet switching. If the network changes, due to congestion or faults, routers can use an alternative interfaces to reach a destination. So packets may travel over different routes to reach the same destination.
Telephone systems use circuit switching: they send an initial packet to the destination, and along its path, this first packet reserves capacity on all of the links it uses. It sets up a fixed route on each router specifically for this connection. This creates a guaranteed connection from end to end for the duration of the call. If capacity is unavailable, then no connection is made and the system terminates the call. The internetThe internet is the interconnection of all the different networks that we have discussed, and that people have created and are using in different capacities. For example:
ISPs interconnect with other ISPs, and this connects everything together into a gigantic WAN. This is the internet, which you’ll learn more about next week. It’s estimated that almost 50% of the world’s population has access to the internet. Next upIn the next step, we’ll show you how you can see the routers that your IP packets pass through on the way to a web server. Questions
Join in the conversation in the comments below to share your ideas. |