School Papers

The across networks. Specifically, the Physical Layer encodes,

The hardware, including the nodes, cabling, and routers that comprise this LAN, are what enables the Physical Layer to successfully transmit data across networks. Specifically, the Physical Layer encodes, decodes and transmits bits. It would be simple if that’s all there was to networking. But, let’s go a little deeper. To begin, we need to start at the end of our network model, at the Application Layer. Let’s say that one of our nodes, Node 1, wants to establish a TCP connection with Node 2.Imagine, if you will, that we have a LAN comprised of two main nodes, Node 1 and Node 2. Both of these nodes exist on two separate networks, the go between being the router that sits between them. Node 1 is connected via Network A and Node 2 is connected via Network B.Our two networks both have different address spaces. Network A is represented by 10.1.1.0/24, while Network B is represented by 192.168.1.0/24. A router connects both of these networks via two different interface IP’s. Network A is connected to the router via the interface IP of 10.1.1.1 and Network B is connected to the router via the interface IP of 192.168.1.254. Keep in mind that Node 1 is connected to Network A and that Node 2 is connected to Network B. Node 1 has been assigned an IP address of 10.1.1.100 and represents the client, whereas Node 2 has been assigned an IP address of 192.168.1.100 and represents the server. The server itself has a web server and is open at port 80.If you find yourself lost, here’s a quick recap of what IP Addresses and Ports are. An IP address is a unique 32-bit string of numbers that is used to identify each node using the IP to communicate over a network. Ports, simply put are just endpoints for communication for different services.A user sits at Node 1 and pulls up a web browser. This occurs at the Application Layer. The user’s intent is to establish a TCP connection with his server, which has an assigned IP address of 192.168.1.100. The user inputs the IP Address and Node 1, which recognizes the IP address resolves to a webpage. The browser on Node 1 communicates with its Operating System that it wants to establish a TCP connection to the inputted IP Address, 192.168.1.100:80. Port 80 is the port that HTTP clients use to make a request to connect to a server. The operating system examines its own subnet and finds that it exists on the network 10.1.1.0/24. With this knowledge in mind, the OS determines that the IP address that the IP address that the client requested access to is on another network. Because of this, Node 1 now knows that it will have to send any data it wants to transmit to its gateway for routing to a remote network. As mentioned previously, this gateway is assigned an interface IP of 10.1.1.1.Now, Node 1 will look at its ARP table to determine what MAC address the interface IP address has. Unfortunately, Node 1 doesn’t know the MAC address for this interface IP address, so it initiates an ARP request to the IP address 10.1.1.1 in the form of a broadcast to MAC address FF:FF:FF:FF:FF:FF. This broadcast is sent to every node on the local network, including Network A and the router. When the router receives the ARP request, it responds to Node 1 with the router’s own MAC Address. Node 1 takes note of this and now knows the hardware address of its gateway, 00:11:22:33:44:55.To recap, a MAC Address is like an IP address, in the sense that it is a unique identifier, but for hardware with network interfaces to be used for communication at the Data-Link Layer, and is hexadecimal in nature. This brings us to the next step.At the point Node 1 knows the MAC Address of its gateway, it begins constructing an outbound packet. Since Node 1 knows that it’s being asked by the web browser to form a TCP connection, it will need an outbound port. The OS will identify any available user port, ephemeral port 60000, and will open a socket that will connect the web browser to this port. This is where the Data Link Layer begins. The OS will start building a TCP segment and will fill in the source port field with 60000 and the destination port with 80. A sequence number will be chosen and filled into the sequence number field, the control flag SYN will be applied to the control flag field, and a checksum for the segment is calculated and filled into the checksum field.To recap, a control flag is used in TCP connections to indicate the state of a connection or control how a connection is handled. A checksum is used to detect the corruption of data over a TCP connection or determine that a TCP connection is made or not.Now that the TCP segment is completed, it is passed to another part of the OS at the IP Layer. This Layer constructs an IP header. The header is filled in with the source IP address of 10.1.1.100 and the destination IP address of 192.168.1.100 and a TTL(Time to Live) of 64.To recap, TTL stands for Time to Live, and represents the number of hops that data in a forthcoming TCP connection can exist for before it is thrown out.The TCP segment that was recently created in inserted as a data payload for the IP datagram that was recently created, and a checksum is calculated for the the combined segments. The now complete IP Datagram is now ready to be sent. But first, Node 1 needs to get the Datagram to its gateway. Node 1 knows that the MAC address of the router’s gateway is 00:11:22:33:44:55. So an ethernet frame is constructed. All the appropriate fields are filled in, including the Destination MAC Address of the router’s gateway, 00:11:22:33:44:55 and the source MAC Address of Node 1. Then the IP Datagram is inserted as the data payload for the Ethernet frame and another checksum is calculated. Now that the Ethernet is frame is fully constructed, it is really ready to be sent. Keep in mind that it is the Data Link Layer that creates these frames and and encapsulates the packets inside them and uses the MAC Addresses to identify the source and destination.The network interface connected to Node 1 sends the frame to Network A and inspects the destination MAC Address, 00:11:22:33:44:55. Network A knows which of its interfaces this MAC Address belongs to, and forwards the frame across the cable connected to that interface. At the end of that interface is the router, which receives the frame and recognizes its own MAC Address as the destination. It then takes the whole frame and calculates a checksum against it. The router compares this checksum with the on in the ethernet frame header and will see if it matches. If it does then that means that everything arrived in one piece and that the data is uncorrupted. Then the router will strip away the ethernet frame, leaving just the IP Datagram behind. The router then calculates another checksum and compares that checksum to the checkum for the IP Datagram. If it matches, then once again, everything arrived in one piece. This is where the Data-Link Layer ends and the Network layer begins.The router inspects the destination IP address of Node 2, 192.168.1.100, and performs an inspection of its routing table, which lists the routes that must be taken to get to particular destinations on a network.The router sees that in order to get data to the destination IP address, 192.168.1.100, it will have to reach the subnet of Network B, 192.168.1.0/24. The router notices that the quickest way to Network B is through the router interface IP Address of Network B, 192.168.1.254. The router looks at all the data in the IP Datagram, decrements the TTL of 64 by 1 to 63, calculates a new header checksum that reflects the new TTL value and fashions a new IP Datagram. Then the router looks at its ARP table and sees that it has an entry for 192.168.1.100. Next the router will begin to construct an ethernet frame with the MAC Address of its router interface on Network B, 192.168.1.254 as the source address and the MAC Address of Node 2 as the destination address.After all of the fields in the ethernet frame have been filled in, the router will place the recently fashioned IP Datagram and deposits it as the data payload of the recently created ethernet frame. It then calculates a checksum and compares this checksum to the one already in place. If it matches, the frame is sent to Network B. Network B sends the frame to Node 2 and Node 2 identifies the destination MAC Address as its own. Node 2 strips away the ethernet frame, leaving just the IP Datagram. It performs a CRC and recognizes that the data has been delivered without corruption. It the examines the destination IP address, 192.168.1.100 and sees that it is its own IP address. Then Node 2 strips away the IP Datagram, leaving just the TCP segment. The checksum for this segment is examined to see if data remains intact. Node 2 then inspects the destination port, 80.The OS on Node 2 checks to ensure there is an open socket on port 80. When it sees that its open, Node 2 sees that the TCP segment has the control flag of SYN activated and identifies the sequence number and stores it. The reason being that Node 2 will need this number for the acknowledgement number field, once it creates a response. The above process will need to happen two more times to ensure a successful TCP connection. Specifically, Node 2 will have to include both the SYN and ACK control flags in the TCP segment of its response to Node 1’s request of SYN. Then when Node 1 receives the TCP segment with SYN and ACK control flags, it will send an ACK control flag in the TCP segment of its response.This is where the Network Layer ends and the Transport Layer begins. After all that, a TCP connection is formed between the two nodes. Then the web browser notifies the user on Node 1 that a connection has been made, which is where the Physical layer once again comes in.