Network Architecture

To engineer and build a system as complex as the Internet, engineers try to break a single challenging problem into a set of smaller problems that can be solved independently and then put back together to solve the original large problem. The engineers who built the first internets broke the overall problem into four basic subproblems that could be worked on independently by different groups.

The Four-Layer TCP/IP Model.

The Four-Layer TCP/IP Model.

They gave these four areas of engineering the following names: (1) Link, (2) Internetwork, (3) Transport, and (4) Application. We visualize these different areas as layers stacked on top of each other, with the Link layer on the bottom and the Application layer on the top. The Link layer deals with the wired or wireless connection from your computer to the local area network and the Application layer is what we as end users interact with. A web browser is one example of an application in this Internet architecture.

We informally refer to this model as the “TCP/IP model” in reference to the Transport Control Protocol (TCP) used to implement the Transport layer and Internet Protocol (IP) used to implement the Internetwork layer.

We will take a quick look at each of the layers, starting from the “bottom” of the stack.

The Link layer is responsible for connecting your computer to its local network and moving the data across a single hop. The most common Link layer technology today is wireless networking. When you are using a wireless device, the device is only sending data a limited distance. A smartphone communicates with a tower that is a few kilometers away. If you are using your smartphone on a train, it needs to switch to a new tower every few minutes when the train is moving. A laptop that is connected to a WiFi network is usually communicating with a base station within 200 meters. A desktop computer that is connected using a wired connection is usually using a cable that is 100 meters long or shorter. Link layer technologies are often shared amongst multiple computers at the same location.

The Link layer needs to solve two basic problems when dealing with these shared local area networks. The first problem is how to encode and send data across the link. If the link is wireless, engineers must agree on which radio frequencies are to be used to transmit data and how the digital data is to be encoded in the radio signal. For wired connections, they must agree on what voltage to use on the wire and how fast to send the bits across the wire. For Link layer technologies that use fiber optics, they must agree on the frequencies of light to be used and how fast to send the data.

In addition to agreeing on how to send data using a shared medium such as a wireless network, they also need to agree on how to cooperate with other computers that might want to send data at the same time. If all the computers on the network tried to transmit whenever they had data to send, their messages would collide. The result would be chaos, and receiving stations would only receive noise. So we need to find a fair way to allow each station to wait its turn to use the shared network.

The idea of breaking a large message into packets and then sending each packet separately makes this sharing easier. If only one computer wants to send data, it will send its packets one right after another and move its data across the network as quickly as it can. But if three computers want to send data at the same time, each computer will send one packet and then wait while the other two computers send packets. After each of the other computers sends a packet, the first computer will send its next packet. This way the computers are sharing access to the network in a fair way.

But how does a computer know if other computers want to send data at the same time? Engineers designed an ingenious method to solve this problem called “Carrier Sense Multiple Access with Collision Detection”, or CSMA/CD. It is a long name for a simple and elegant concept. When your computer wants to send data, it first listens to see if another computer is already sending data on the network (Carrier Sense). If no other computer is sending data, your computer starts sending its data. As your computer is sending data it also listens to see if it can receive its own data. If your computer receives its own data, it knows that the channel is still clear and continues transmitting. But if two computers started sending at about the same time, the data collides, and your computer does not receive its own data. When a collision is detected, both computers stop transmitting, wait a bit, and retry the transmission. The two computers that collided wait different lengths of time to retry their transmissions to reduce the chances of a second collision.

Carrier Sense/Collision Detection.

Carrier Sense/Collision Detection.

When your computer finishes sending a packet of data, it pauses to give other computers that have been waiting a chance to send data. If another computer senses that your computer has stopped sending data (Carrier Sense) and starts sending its own packet, your computer will detect the other computer’s use of the network and wait until that computer’s packet is complete before attempting to send its next packet.

This simple mechanism works well when only one computer wants to send data. It also works well when many computers want to send data at the same time. When only one computer is sending data, that computer can make good use of the shared network by sending packets one after another, and when many computers want to use the shared network at the same time, each computer gets a fair share of the link.

Some link layers, like a cellular connection for a smartphone, a WiFi connection, or a satellite or cable modem, are shared connections and need techniques like CSMA/CD to insure fair access to the many different computers connected to the network. Other link layers like fiber optic cables and leased lines are generally not shared and are used for connections between routers. These non-shared connections are still part of the Link layer.

The engineers working on Link layer technologies focus solving the issues so computers can transmit data across a single link that ranges in distance from a few meters to as long as hundreds of kilometers. But to move data greater distances, we need to send our packets through multiple routers connected by multiple link layers. Each time our packet passes through another link layer from one router to another we call it a “hop”. To send data halfway around the world, it will pass through about 20 routers, or make 20 “hops”.

The Internetwork Layer (IP)

Once your packet destined for the Internet makes it across the first link, it will be in a router. Your packet has a source address and destination address and the router needs to look at the destination address to figure out how to best move your packet towards its destination. With each router handling packets destined for any of many billions of destination computers, it’s not possible for every router to know the exact location and best route to every possible destination computer. So the router makes its best guess as to how to get your packet closer to its destination.

Each of the other routers along the way also does its best to get your packet closer to the destination computer. As your packet gets closer to its final destination, the routers have a better idea of exactly where your packet needs to go. When the packet reaches the last link in its journey, the link layer knows exactly where to send your packet.

We use a similar approach to route ourselves when going on holiday. A holiday trip also has many hops. Perhaps the first hop is driving your car or taking a cab or bus to a train station. Then you take a local train from your small town to a larger city. In the larger city you take a long-distance train to a large city in another country. Then you take another local train to the small village where you will stay for your holiday. When you get off the train, you take a bus, and when you get off the bus, you walk to your hotel.

If you were on the train between the two large cities and you asked the conductor the exact location of your hotel in the small village, the conductor would not know. The conductor only knows how to get you closer to your destination, and while you are on the long-distance train that is all that matters. When you get on the bus at your destination village, you can ask the bus driver which stop is closest to your hotel. And when you get off the bus at the right bus stop, you can probably ask a person on the street where to find the hotel and get an exact answer.

The further you are from your destination, the less you need to know the exact details of how to get there. When you are far away, all you need to know is how to get “closer” to your destination. Routers on the Internet work the same way. Only the routers that are closest to the destination computer know the exact path to that computer. All of the routers in the middle of the journey work to get your message closer to its destination.

But just like when you are traveling, unexpected problems or delays can come up that require a change in plans as your packets are sent across the network.

A Multi-Step Trip.

A Multi-Step Trip.

Routers exchange special messages to inform each other about any kind of traffic delay or network outage so that packets can be switched from a route that is no longer working to a different route. The routers that make up the core of the Internet are smart and adapt quickly to both small and large outages or failures of network connections. Sometimes a connection slows down because it is overloaded. Other times a connection is physically broken when a construction crew mistakenly digs up a buried wire and cuts it. Sometimes there is a natural disaster like a hurricane or typhoon that shuts down the routers and links in a large geographical area. The routers quickly detect these outages and reroute around them if possible.

But sometimes things go wrong and packets are lost. Dealing with lost packets is the reason for the next layer in our architecture.

The Transport Layer (TCP)

The Internetwork layer is both simple and complex. It looks at a packet’s destination address and finds a path across multiple network hops to deliver the packet to the destination computer. But sometimes these packets get lost or badly delayed. Other times the packets arrive at their destination out of order because a later packet found a quicker path through the network than an earlier packet. Each packet contains the source computer’s address, the destination computer’s address, and an offset of where this packet “fits” relative to the beginning of the message. Knowing the offset of each packet from the beginning of the message and the length of the packet, the destination computer can reconstruct the original message even if the packets were received out of order.

As the destination computer reconstructs the message and delivers it to the receiving application, it periodically sends an acknowledgement back to the source computer indicating how much of the message it has received and reconstructed. But if the destination computer finds that parts of the reconstructed message are missing, this probably means that these packets were lost or badly delayed. After waiting a bit, the destination computer sends a request to the source computer to resend the data that seems to be missing.

The sending computer must store a copy of the parts of the original message that have been sent until the destination computer acknowledges successful receipt of the packets. Once the source computer receives the acknowledgment of successful receipt of a portion of the message, it can discard the data that has been acknowledged and send some more data.

The amount of data that the source computer sends before waiting for an acknowledgement is called the “window size”. If the window size is too small, the data transmission is slowed because the source computer is always waiting for acknowledgments. If the source computer sends too much data before waiting for an acknowledgment, it can unintentionally cause traffic problems by overloading routers or long-distance communication lines. This problem is solved by keeping the window size small at the beginning and timing how long it takes to receive the first acknowledgements. If the acknowledgments come back quickly, the source computer slowly increases the window size and if the acknowledgements come back slowly, the source computer keeps the window size small so as not to overload the network. Just like at the Link layer, a little courtesy on the Internet goes a long way toward ensuring good use of the shared network infrastructure.

This strategy means that when the network has high-speed connections and is lightly loaded the data will be sent quickly, and if the network is heavily loaded or has slow connections the data will be slowed down to match the limitations of the network connections between the source and destination computers.

The Application Layer

The Link, Internetwork, and Transport layers work together to quickly and reliably move data between two computers across a shared network of networks. With this capability to move data reliably, the next question is what networked applications will be built to make use of these network connections.

When the first widely used Internet came into being in the mid-1980s, the first networked applications allowed users to log in to remote computers, transfer files between computers, send mail between computers, and even do real-time text chats between computers.

In the early 1990s, as the Internet came to more people and computers’ abilities to handle images improved, the World Wide Web application was developed by scientists at the CERN high-energy physics facility. The web was focused on reading and editing networked hypertext documents with images. Today the web is the most common network application in use around the world. But all the other older Internet applications are still in wide use.

Each application is generally broken into two halves. One half of the application is called the “server”. It runs on the destination computer and waits for incoming networking connections. The other half of the application is called the “client” and runs on the source computer. When you are browsing the web using software like Firefox, Chrome, or Internet Explorer, you are running a “web client” application which is making connections to web servers and displaying the pages and documents stored on those web servers. The Uniform Resource Locators (URLs) that your web browser shows in its address bar are the web servers that your client is contacting to retrieve documents for you to view.

When we develop the server half and the client half of a networked application, we must also define an “application protocol” that describes how the two halves of the application will exchange messages over the network. The protocols used for each application are quite different and specialized to meet the needs of the particular application. Later we will explore some of these Application layer protocols.

Stacking the Layers

We usually show the four different layers (Link, Internetwork, Transport, and Application) stacked on top of each other with the Application layer at the top and the Link layer at the bottom. The reason we show them this way is because each layer makes use of the layers above and below it to achieve networked communications.

All four layers run in your computer where you run the client application (like a browser), and all four layers also run in the destination computer where the application server is running. You as the end user interact with the applications that make up the top layer of the stack, and the bottom layer represents the WiFi, cellular, or wired connection between your computer and the rest of the Internet.

The routers that forward your packets from one to another to move your packets towards their destination have no understanding of either the Transport or Application layers. Routers operate at the Internetwork and Link layers. The source and destination addresses at the Internetwork layer are all that is needed for routers to move your packets across the series of links (hops) to get them to the destination. The Transport and Application layers only come into play after the Internetwork layer delivers your packets to the destination computer.

If you wanted to write your own networked application, you would likely only talk to the Transport layer and be completely unconcerned about the Internetwork and Link layers. They are essential to the function of the Transport layer, but as you write your program, you do not need to be aware of any of the lower-layer details. The layered network model makes it simpler to write networked applications because so many of the complex details of moving data from one computer to another can be ignored.

Up next, we will talk about these four layers in more detail.

Glossary

client: In a networked application, the client application is the one that requests services or initiates connections.

fiber optic: A data transmission technology that encodes data using light and sends the light down a very long strand of thin glass or plastic. Fiber optic connections are fast and can cover very long distances.

offset: The relative position of a packet within an overall message or stream of data.

server: In a networked application, the server application is the one that responds to requests for services or waits for incoming connections.

window size: The amount of data that the sending computer is allowed to send before waiting for an acknowledgement.

Questions

  1. Why do engineers use a “model” to organize their approach to solving a large and complex problem?
    • a)Because it allows them to build something small and test it in a wind tunnel
    • b)Because talking about a model delays the actual start of the hard work
    • c)Because they can break a problem down into a set of smaller problems that can be solved independently
    • d)Because it helps in developing marketing materials
  2. Which is the top layer of the network model used by TCP/IP networks?
    • a)Application
    • b)Transport
    • c)Internetwork
    • d)Link
  3. Which of the layers concerns itself with getting a packet of data across a single physical connection?
    • a)Application
    • b)Transport
    • c)Internetwork
    • d)Link
  4. What does CSMA/CD stand for?
    • a)Carrier Sense Multiple Access with Collision Detection
    • b)Collision Sense Media Access with Continuous Direction
    • c)Correlated Space Media Allocation with Constant Division
    • d)Constant State Multiple Address Channel Divison
  5. What is the goal of the Internetwork layer?
    • a)Insure that no data is lost while enroute
    • b)Get a packet of data moved across multiple networks from its source to its destination
    • c)Make sure that only logged-in users can use the Internet
    • d)Insure than WiFi is fairly shared across multiple computers
  6. In addition to the data, source, and destination addresses, what else is needed to make sure that a message can be reassembled when it reaches its destination?
    • a)An offset of where the packet belongs relative to the beginning of the message
    • b)A location to send the data to if the destination computer is down
    • c)A compressed and uncompressed version of the data in the packet
    • d)The GPS coordinates of the destination computer
  7. What is “window size”?
    • a)The sum of the length and width of a packet
    • b)The maximum size of a single packet
    • c)The maximum number of packets that can make up a message
    • d)The maximum amount of data a computer can send before receiving an acknowledgement
  8. In a typical networked client/server application, where does the client application run?
    • a)On your laptop, desktop, or mobile computer
    • b)On a wireless access point
    • c)On the closest router
    • d)In an undersea fiber optic cable
  9. What does URL stand for?
    • a)Universal Routing Linkage
    • b)Uniform Retransmission Logic
    • c)Uniform Resource Locator
    • d)Unified Recovery List

Licenses and Attributions


Speak Your Mind