How Computer Networks Work
An article for those interested in discovering a little about the technology of computer networks.
First: a little history to put today's networks in perspective. The early computer networks were not commonly computer-to-computer networks such as we see today. Usually, a big organisation such as a bank or a government department, would have a mainframe with a network of terminal equipment. Operators would sit at these terminals and input data while the mainframe computer would process the data and output results to other terminals or printers. A "terminal", in those days, was practically synonymous with a keyboard/screen pair (the familiar old green-on-black display units) and office buildings were crisscrossed with huge bundles of cables connecting all these peripheral devices to the computer room. In order to take the communications load away from the mainframe, smaller computers were introduced to control and prioritise the data traffic. There was a very formal network "protocol" (set of rules) applied to control this traffic flow: in the IBM world this was called Systems Network Architecture. SNA was very successful and dominated computer networks for many years (and still operates in places where mainframes are alive and prospering).
Eventually, the proliferation of mini-computers and PC's spread to the world of big business and government. The model of the big beast mainframe in the centre of the network was replaced by another model: that of small computers with local processing power, connected to others doing similar work. This was a distributed processing model and it soon extended to the desktop where each "terminal" was now a PC and could perform its own tasks. The new model needed a new network architecture and, by happy coincidence, an alternative was just about ready to take centre stage: the Local Area Network, or LAN.
For over a decade there were competing technologies all vying for prominence in the LAN marketplace. IBM promoted their Token Ring cable technology while others opted for Ethernet. At the same time there was some competition when it came to the network protocol (I'll explain more about protocols shortly): the main contenders being IBM's SNA, an international standards based product called Open Systems Interconnect (OSI) and a protocol originally developed in the 1970's by the US Department of Defense called TCP/IP. By the time the LAN dust had settled, IBM had failed with both Token Ring and SNA, Ethernet had become the cable solution of preference and the TCP/IP protocol pushed all others aside. Now that everyone agreed, mankind was ready for the next giant leap: the internet.
Local Area Networks
But let us not get ahead of ourselves: an article on the structure of the internet will follow in the near future. In this article we are looking at how a Local Area Network - is put together. Before digging too deep into the protocols, we need to understand the "model". A network architecture is built according to a layered model, or "stack". The International Standards Organisation produced the OSI 7 Layer Model which is probably the first thing taught to every student of networking. TCP/IP has a slightly different model but the purpose is the same (to quote the Wikipedia article):
The TCP/IP Suite defines a set of rules to enable computers to communicate over a network. TCP/IP provides end-to-end connectivity specifying how data should be formatted, addressed, shipped, routed and delivered to the right destination.
The diagram above shows two computers (Hosts A and B) connected via routers - I'll talk about routers later - with a schematic of the various TCP/IP protocol layers below that. Each layer on one side talks directly to the same layer on the other side. Let's take a closer look at the four layers from the bottom up:
- Link: Sometimes called the Media Access Control or "MAC" layer, this has to do with the physical media (wires, fibre-optic cables, etc.) and the low-level protocol which controls the data sent along that media. In the case of a LAN, this protocol is normally Ethernet.
- Internet: This is the layer of the Internet Protocol - the IP bit of TCP/IP. It understands IP addressing (for example: 192.168.1.100) and it makes sure that data from one network can be routed to another network across the office block or across the world.
- Transport: The Transport layer controls the end-to-end conversation between two hosts. Hosts are usually computers but any network "aware" device can be a host. Examples might be printers or CCTV cameras or process control equipment in factories. Once the connection has been made at the IP level, the Transport Control Protocol (TCP) takes over. TCP requires confirmation of receipt (like sending a recorded delivery letter) but this layer also includes another protocol called UDP which does not require that receipt. For this reason, UDP is also known as a "connectionless" protocol.
- Application: Sitting atop the others is the Application Layer. This is where the application software on one host converses directly with the application on the other host. Application software designed to use a TCP/IP network has built-in connection points (called sockets) which expect and accept connections from other applications (or from the same application on another host).
So that's the model but how does it work in practice? Well, data bits on a network are transmitted serially, that is: one-after-the-other. The bits and bytes are arranged into data "packets" and each packet reserves a few bytes at the front (or head) to identify where it is heading and what is in the packet that follows. It is a little like passengers on a bus: the front of the bust has some information indicating where it is going and it could also indicate what it is carrying (people, in this case). Another similar looking vehicle might be carrying chickens instead so that information would go up front. It is a bit of a laboured metaphor but you get the idea. These information "headers" also identify which layer they belong to, so we get Ethernet headers and Transport Layer headers, etc.
The diagram above shows us nicely how this is all put together:
- We start with a block of application data.
- Next we add a Transport layer header which tells us that the transport protocol is UDP (it could also have been TCP).
- The packet containing the original data and the UDP header is next given an Internet (IP) layer header. This determines the IP destination address.
- Finally, it is sent out on to the physical network (the wires or fibres or other communication media) so it needs to navigate using a Link layer protocol such as Ethernet.
The headers are added by the sending host as the data packet is passed down the protocol "stack". When it reaches the other side, the headers are removed as the packet progresses up the corresponding stack until, arriving at the application, we are left with the pure data again.
Network Addressing
I have already mentioned it in relation to IP addresses but, in reality, each layer has (and needs) an addressing structure. These could be summarised as follows (bottom-to-top in the layer model):
- MAC (Media Access Control) layer addresses: These might be thought of as hardware addresses. Each manufacturer of network connection devices is allocated a batch of addresses. These devices would include Ethernet cards for PC's, broadband routers or wireless access points. A MAC address (often called an Ethernet address) is made up of six hexadecimal pairs, such as 00:1A:92:82:1A:8D. The manufacturer code is the first three pairs.
- IP Addresses: These are numeric addresses which can be assigned to hosts on any network. Some are private and might be assigned by an IT administrator within an organisation. Others are public and are assigned by internet authorities in order to ensure that every host connected to the public network (the internet) has a unique IP addresses. Private IP addresses only have to be unique within the organisation. Often, a private IP address on the inside of an organisation can be translated to a public address by a router or gateway device which sits between the public and private networks. This is called Network Address Translation - or NAT. An IP address is a group of four numbers separated by dots. Each number between the dots can have up to three digits between 0 and 255. For example: 212.58.226.8 (one of the BBC's public IP's) or 192.168.1.15 (a commonly used Private IP).
- TCP Ports: These are numbered ports assigned to various applications, some standardised such as HTTP assigned to the web site server port 80, and port 23 assigned to telnet. Although many are standardised, they are not fixed. So long as both sides of the connection is aware of the agreed port number, any application can be assigned any number. In practice, however, this is hardly ever workable in a large network. Batches of non-standard port numbers are always available for less common and proprietary applications.
- Application Sockets: A socket is a combination of the IP address and TCP port as in "192.68.122.45:80".
Network Devices
It can't be denied that networks are complex affairs and, alas, it isn't just a simple matter of connecting lots of computers directly to each other. Each of the above described layers has a device - or number of devices - associated with it. Here are some examples:
The Network Adapter, either as a separate card or built-in to the PC motherboard. This connects the computer to the network via a cable (or, alternatively, by wireless signal).
A MAC layer (or Ethernet) Switch: Used to concentrate all the Ethernet cable connections from the PC's and to switch data traffic from one port to another.
A Hardware Firewall: Protects the private IP network from security threats originating outside the organisation, i.e. the internet. These devices often perform IP routing too.
An IP Router: Used to connect one IP network to another. For example: a private LAN to the public internet. Often has an ADSL (Broadband) modem built-in as well as Wireless LAN connectivity.
A Simple Office LAN Diagram
Finally, to conclude this brief introduction to TCP/IP networks, the diagram above shows all the pieces in place. Except, as you might have spotted, we don't see an ethernet switch in the picture. This is because an ethernet LAN is usually drawn symbolically as a straight line with connection points along its length. Physically speaking, the straight line is the switch and the connection points are the cable connections along the front of the switch - as shown in the photograph above.
This diagram shows a LAN inside an organisation - a small office LAN, for example - connected to the outside world of the public internet. Between private and public are the two gateway devices: the protective firewall and the ADSL router. The outward facing (ADSL) interface of the router will have a public IP address and the inward facing (Ethernet) interface of the firewall will have a private LAN address. ADSL (Asymmetric Digital Subscriber Line) is the Link layer protocol that runs on the telephone wires from your home. It connects you to the big routers and servers maintained by your Internet Service Provider (ISP).
And that's about it for this article. I will go into IP Network addressing in more detail in another article but, in the meantime, I hope you found this information useful.
David Chamberlain
September 2008