test me

Site Search:

Host-to-Host communication

So far, we have learned how the Transport layer protocols UDP and TCP work, we also learned that both Network Layer addresses (the IP address) and data link layer addresses (MAC address) are needed for two hosts to communicate. In this section, we will put these knowledge into use by examing a Host-to-Host communication example.

In the example setup, Host A has Layer 3 address of 192.168.1.100 and Layer 2 address of 0000:0000:AAAA; Host B has Layer 3 address of 192.168.1.200 and Layer 2 address of 0000:0000:BBBB.

host

Let's assume that Host B have a web server running on it, and its port 80 is ready to accept http connections. A HTML file named test.htm is located in Host A's internet folder.

Now, we open a web brower in Host A and type the URL http://192.168.1.200/test.htm in the address bar, then press the ENTER key. This is what happened afterwards.

Note that I will not emphasis events happened on the three upper layers of the OSI model. Simply put, browser issued an application layer http GET request to web server, where presentation layer format are specified for browser to render test.htm. http protocol is based on session layer socket communication between browser process (192.168.1.100, TCP, random port) and listening web server process (192.168.1.200, TCP, 80). socket communication is based on transport layer TCP/UDP protocols. If you really want a complete picture, please install a firebug on the firefox browser and exam the upper layer protocols by yourself. (ref)

Step 1, The web brower program reads your input from the address bar.

Step 2, The browser broke the URL into three parts: the protocol (http), the server address (192.168.1.200), and the file name (test.htm).

 Step 3, From the protocol part "http", the browser knows two things: a reliable connection is needed, and the port number 80 should be used. Therefore the browser requests the reliable connection service from the transport layer, it also tells the transport layer that the IP address is 192.168.1.200 and port number is 80. The browser then try to create a session layer socket, thus passes the request down to transport layer.

Step 4, Upon receiving the request from the browser program, the work flow is now passed from application programmer's realm to operating system's TCP/IP stack (software, firmware and hardware). The transport layer selects TCP to set up the session. TCP initiates the session by creating a TCP segment with SYN bit set. The source port is a randomly assigned dynamic port number and the destination port is 80. The TCP segment was passed down to the Network layer, with the destination IP address 192.168.1.200.

Step 5,  IP then creates a packet with IP source address 192.168.1.100 and destination address 192.168.1.200 received from TCP. The Protocol field of the packet has value 0×06, which means TCP. After the packet creation, IP then passes the packet to Layer 2.

Step 6, Because hosts only communicate via hardware addresses on the local LAN, for this packet to be sent to the destination Host B, Layer 2 needs to map the destination IP addrss 192.168.1.200 to its MAC address. Layer 2 does this by requesting a mapping from the ARP program.

Step 7, ARP checks its ARP table to see if the IP address of the destination IP has already been resolved to hardware address. If it is, the frame is then created with the hardware destinatio address. Otherwise, Layer 2 holds the packet until ARP can provide a mapping. Since this is the first time we connect to the web server, the ARP table is empty.

Step 8, The ARP program builds an ARP request and passes it to Layer 2, telling Layer 2 to send the request t a broadcast address.

Step 9, Layer 2 encapsulates the ARP requestin a Layer 2 frame using the broadcast address (FFFF:FFFF:FFFF) provided by ARP as the destination MAC address and the local MAC address (0000:0000:AAAA) as the source MAC address.

Step 10, Layer 2 at Host B receives the frame, it notes the broadcast address and strips the Layer 2 header and send it to ARP program.

Step 11, ARP sees the ARP request is from a host with IP address 192.168.1.100 and MAC address 0000:0000:AAAA, so it adds this IP and MAC pair to its ARP table.

Step 12, ARP builds a ARP response with its own IP address 192.168.1.200, then passes it to Layer 2, telling Layer 2 to send the response to MAC address 0000:0000:AAAA.

Step 13, Layer 2 encapsulates the ARP in a Layer 2 frame using the destination MAC address 0000:0000:AAAA provided by ARP and the local source MAC address 0000:0000:BBBB.

Step 14, When Host A receives the frame, it notes that the destination MAC address is the same as its own. It strips the Layer 2 encapsulation and passes the remaining ARP reply to the ARP program.

Step 15, ARP notice the ARP reply is from a host with IP 192.168.1.200 and MAC 0000:0000:BBBB, so it adds this IP and MAC pair to its ARP table.

Step 16, Layer 2 now mapped the destination IP addrss 192.168.1.200 to the corresponding MAC address 0000:0000:BBBB with the help of ARP program. Therefore, it can encapsulats the pending packet into a frame with Source MAC 0000:0000:AAAA and destination Address 0000:0000:BBBB, then the frame out.

Step 17, At Host B, the frame is passed up the stack where encapsulation is removed. The remaining protocol data unit (PDU) is passed to TCP.

Step 18, In response to the SYN, TCP at Host B passes a SYN ACK down the stack to be encapsulated.

Step 19, Upon receives the SYN ACK from Host B, Host A sends back the ACK to complete the Three-Way Handshake.

Step 20, With the three-way handshake completed, TCP can inform the web browser that a connection to the server at IP address 192.168.1.200 have been formed on port 80.

Step 21, Following the application layer HTTP protocol, the browser sent a GET request to the server, asking for the file test.htm.

Step 22, The server running on Host B then sent the HTML format text for the Web page to the browser running on Host A..

Step 23, The browser read the HTML tags and the presentation layer present the page onto your screen.

The Host to Host communication didn't involves routing process, which will be covered later.

ICND1 and ICND2 break down

No comments:

Post a Comment