All Network Layers working in Unison
Let's go through an exercise to see how everything works. Network A has an address space of 10.1.1.0/24. Network B has an address space of 192.168.1.0/24 and network C will be 172.16.1.0/24. Router A sits between network A and network B with an interface and an IP of 10.1.1.1 on network A and an interface of 192.168.1.254 on network B. There is a second router B that connects networks B and C or an interface of network B with an IP address of 192.168.1.1 and an interface of network C with an IP address of 172.16.1.0/24.
Now let's put desktop as a client part of network A with an IP address of 10.1.1.100 and put another computer as a server and refer to it as computer 2, part of network C with an IP address of 172.16.1.100 and has a web server listening at port 80. An end-user opens a web browser and enters 172.16.1.199 in the browser. The web browser knows it's been ordered to retrieve a webpage. The web browser tells the local networking stack that it is going to establish a TCP connection to 172.16.1.100/80. The networking stack will observe that it lies on 10.1.1.0/24 which means that the networking stack is on another network. This means that we will need to route to a remote network. Then computer 1 determines what MAC address 10.1.1.1 is but no entry. Computer A then crafts an ARP request for 10.1.1.1 which then sends as the hardware broadcast address of all Fs. This ARP discovery request is sent to every node on the local network. Router A sees that it's the computer receiving the IP address of 10.1.1.1 and subsequently responds to computer 1 to let it know of its own MAC address. Computer 1 receives this response and now knows the hardware address of its gateway. This means that it's ready to start constructing the outbound packet. Computer 1 knows it's being asked to form an outbound TCP connection meaning it will form an outbound TCP port. The networking stack starts to build a TCP segment, with all the appropriate fields in the header including the source port and the destination port, and a sequent number, as well as a checksum. Our newly constructed TCP segment is now put in the IP layer, with a source id, destination IP, etc. The TCP segment is inserted as the payload of the IP datagram. Computer 1 now needs to get things to its IP datagram So an Ethernet frame is constructed, with all the appropriate data, most notably the source and destination IP addresses.
The Ip is known more as the data payload of the ethernet frame, and another checksum is calcul[ated, having an ethernet frame now ready to be sent across the physical layer. Now we can send the ethernet frame. Computer 1 sends the binary data as modulations of 0s and 1s to a switch where the switch sends the data to the correct corresponding destination MAC address, and forwards across only the cable connected to this interface. Router A receives the frame and recognizes the address, so Router A calculates the entire frame and calculates the checksum to make sure all of the data makes it to one piece. Router A then strips the ethernet frame, leaving just the IP datagram. Router A performs a lookup on the destination IP address and tries to find the quickest path to that address (which, by the way, is through router B!) and now router A makes a new IP datagram. Now, router A begins the construction of its ethernet frame. Once the values for all fields in the frame, places IP datagram into new ethernet frame as data payload and calculates a checksum and sends the frame out to network B. Router B performs the same checks, remove the ethernet, performs checksum, examines destination IP address. Then it decrements TTL, calculates checksum, encapsulates the new IP datagram by the new ethernet datagram, with the source/destination address, and then repeats the process one last time. Computer 2 receives the frame, identifies its own MAC address, strips the ethernet frame, and performs CRC recognizes that the data is intact. Now computer 2 leaves only the TCP segment, checks out everything, and then examines the destination port, which is 80. Networking stack checks to ensure there is an open socket held open by running a patchy web server and examines the sequence number to put in the acknowledgment field once it receives a response. All we did was get a single TCP segment from one computer to a second one.

Comments
Post a Comment