Chapter 7 - Networking
On its own, a computer can be a fascinating tool. However, when you connect many computers together using a network, worlds of possibility open up. In a network, better use is made of all the connected resources, because they can be shared. For example, if there is one printer, everyone can use it. It is also possible to concentrate resources where they will have the greatest benefit - all the additional memory added to the server becomes available for running the programs of all the clients.
The advantages of networking only start with economies in hardware expenditure. Another aspect, one that is really far more exciting, is the opening up of communication channels among lab users, and, if you can reach the internet, with the world at large. Only some of the lab users will be interested in computers for their own sake. Many more users will be writing essays, asking questions, drawing pictures or practising skills using the educational programs offered in Edubuntu. With a network, they can easily share documents, discuss them, and have a record of discussions for the learners that come after them.
An Edubuntu lab will usually have only one or two printers for the lab as a whole. Since everyone will use these, it's worthwhile to get the best printers you can afford: as long as they're on a network, everyone will benefit.
Depending on the make of printer, it may be connected to the network switch with a network cable, or it may be connected directly to a print server (which may be the classroom server) with a parallel cable.
Printing in Edubuntu is managed using CUPS, the Common Unix Printing System. It provides a web interface (accessible at http://printserver:631/) where you may check the status of printers and print jobs, print test pages, and so on. (printserver is the hostname of the printer or the server to which the printer is connected.)
JeromeGotangco: We don't have an email service but we have email clients in the distribution
Without a network, transferring files from one computer to another is a difficult and inconvenient process. You have to copy the file onto some storage medium (such as a floppy disk or a CD) and carry it over to the other computer yourself. Floppy disks tend to break or become silently corrupted. CDs can only be written once, and are relatively expensive. Even rewritable CDs are slow to use, and even more expensive. Finally, all kinds of disk drives have many moving parts, and they have to deal with a disk platter that spins hundreds of times per second. They all break eventually.
TODO: Add image for this caption - Watch out for this one, it only looks innocent. TODO: Add image for this caption - If you're lucky, the floppy will let you know when it's broken.
It's much better to shift the job to network cables. Once laid, a cable will keep on working forever. It doesn't cost anything to transfer data over it, and it's very fast.
In the thin-client configuration of Edubuntu, the reality is even better. None of the client workstations store any data, so the need for them to have internal hard disk drives has also been eliminated. The only computer in an Edubuntu lab that must contain at least one disk drive is the classroom server. Every user of the lab - in other words, every person with a username and password to login at a workstation, has some storage space on the classroom server's hard drive allocated to them, where they may store their data. They all reach their data via the network.
This means that making a copy of a file for another user comes down to making a copy elsewhere on the same disk drive. Similarly, for files that many people need to share without necessarily needing their own copies to modify, this means that everyone may access the exact same copy of the file. In a non-networked situation, every single workstation would need their own copy of such files. This is the case for all the operating system and application software, for example.
Servers and clients
Without a network, every workstation needs to be sufficient unto itself, and to provide all the storage space and processing power that a user is likely to need. With the introduction of a network, it becomes feasible to differentiate between computers, and equip them according to their roles. For Edubuntu, this means removing everything that can break or costs money from the client workstations - their role is only to receive data over the network, and to display the user's desktop, sent from the server. The server does all the work, so it can have all the memory, disk space and computing power that you can afford. Everyone benefits from money spent on the server.
In this section, we have a look at the different kinds of equipment that we need to set up a network.
There are many different kinds of computer networks, with different strengths and weaknesses. Some might be designed for the maximum data transfer speed, some to minimize costs, and others to make it as easy as possible to connect computers to one another. In the case of Edubuntu, we need a really fast network, because everything displayed by the client workstations needs to be sent from the server over the network. We also need a standard network that allows any kind of computer or peripheral to be added to the network easily.
In order to meet these criteria, Edubuntu uses an Ethernet network with category 5 network cabling (CAT-5, for short).
In an Ethernet, data packets are broadcast onto the network for all connected devices to receive. The devices themselves then examine the data packet to determine whether it was meant for them. If so, they process it; otherwise, they drop it on the floor and it vanishes.
The name "Ethernet" comes from the ancient Greek concept of "ether". According to them, this was the fluid that filled the spaces between stars. Of course there isn't any such thing, but they made it up because surely there couldn't be nothing between stars, could there? In an Ethernet, as far as the communicating computers are concerned, there aren't any cables either. Of course there really are cables, but you don't have to send a data packet down a specific cable to a specific computer. You just entrust it to the "ether", and all computers get the packet.
Switches / Hubs
There are different ways of wiring an Ethernet local area network. One way is to simply lay coaxial cable from one computer to the next, until all the computers are connected, forming a ring. This is relatively simple, but the resulting network is slow, both because of the electrical properties of the coaxial cable, as well as because all the data has to share a single cable.
Since a Edubuntu needs more speed, a star topology is used instead. In this configuration, a single CAT-5 cable connects each workstation to a central node. This central node acts as an interchange. In a simple network where speed isn't critical, this node can be a hub. This is a device with ports where you can plug in many network cables; usually 8, 16 or 24. A hub is very chatty: it simply repeats all the data coming in on one port on all the other ports. This way, the data is sure to reach the computer it's meant for. Unfortunately, it also reaches all the other computers, taking up precious network bandwidth.
Instead of a hub, you can also use a switch. It looks just like a hub, but it's cleverer about routing the traffic that moves across it. In short, it remembers which computer is where, so that when it receives a data packet meant for a particular computer, it sends it only to the port where that computer is connected.
Switches can be linked together to form one bigger switch. For example, if you have a lab with 25 workstations, you can link together two 16-port switches using a flylead. See the section called “Switch cabinet”. Every switch has a couple of special high-speed ports. These are used to link the switch to the server, or to link switches to each other.
Category 5 cable, commonly known as CAT-5, is an unshielded twisted pair type cable designed for high signal integrity. The actual standard defines specific electrical properties of the wire, but it is most commonly known as being rated for its Ethernet capability of 100 Mbit/s. Its specific standard designation is EIA/TIA-568. CAT-5 cable typically has three twists per inch of each twisted pair of 24 gauge copper wires within the cable. Another important characteristic is that the wires are insulated with a plastic (FEP) that has low dispersion; that is, the dielectric constant of the plastic does not depend greatly on frequency. Special attention also has to be paid to minimizing impedance mismatches at connection points. In practice, this means that, when you attach connectors to the cable ends, you shouldn't untwist more of the cable than absolutely necessary.
Building the network
When laying CAT-5 cable, you need a crimping tool, RJ45 jacks, and boots for the jacks.
The crimping tool is a clever piece of work. It combines the functions of a cable-cutter, wire-stripper, and a special grip specifically designed to fix the RJ45 jack to the cable. We'll learn them as we go through the steps of preparing a cable.
TODO: Add image for this caption - An RJ-45
TODO: Add image for this caption - A crimping tool
TODO: Add image for this caption - Cutting the Cables
The first thing you need to do, is to cut the cable into the appropriate lengths, using the crimping tool's cable-cutter. To do this, measure the distance from the box where the switch will be installed to the furthest computer in each row. It's easiest to use the cable itself for this, and to mark the length with a piece of masking tape.
To keep things organized, write something on the masking tape to identify the computer which the cable is meant for. Label the rows using a letter (so that you have rows A, B, C and D), and label each computer in a row with a number (so that you have A1 to A8, and so on). Once you have the longest cable in each row, you can figure out all the other lengths by shortening each subsequent cable with the distance between two workstations (normally, this will be 1200mm).
While you are cutting the cable into the right lengths, take care to keep the cables for each row together. Bind all the cables for a row together in a bundle, using masking tape. At the one end of the bundle (the switch end) all the cable ends will be together. On the other end, the ends will vary from the shortest to the longest.
Besides the cables from the switch to the workstations, you also need to cut a couple of flyleads. These are used to connect the server(s) to the switch, and also to link together multiple switches
Laying the Cables
Once all the cables have been cut and gathered together in bundles, you can take them in to the lab. Put them on the ground underneath the desks, and ensure that the cables at the switch end can comfortably reach the switch.
If your network shares the same trunking with the electrical wiring of the lab, you MUST switch off the lab's power at the electrical subdivision board for the lab.
Now you need to put the cables inside the trunking. To do this, get as much help as you can muster, as it's hard work and no fun to do alone. Take the cover off the trunking. Note carefully where each workstation will be standing, and drill a small hole in the trunking below each workstation, for the CAT-5 cable to reach the workstation. While the cables and the covers are lying on the floor, thread each cable through the correct hole in the trunking (the cable for computer A1 goes through the hole for A1, and so on).
Once this is done, carefully put the cables inside the trunking and put the covers back on. Pass the cable ends up above the desks. You should have about 1m free cable for each workstation.
Crimping the Cables
Stepping back, your lab looks the same as before, with the addition of cable ends emerging above the desks, and a whole bundle of cables terminating at the switch cabinet. Now you need to attach RJ45 jacks to the cable ends, so that they can be plugged into the switch at the one end, and into each workstation's network card on the other end.
To do this, complete the following steps for each cable.
- Insert the 'boot' over the cable. This will cover the exposed wires where the RJ-45 jack is attached to the cable wires.
- Cut through the sheath around the cable to expose the pairs of coloured wires, without damaging them.
- Untwist about 2cm of each pair of wires (no more, as this impairs the effectiveness of the cable for data transmission).
- Arrange the wires in the correct colour sequence. (Straight-through cabling for cables between the switch and workstations, or Cross-over cabling for fly leads that connect switches, or that connect the switch to the server).
- Insert the wires into the RJ-45 connector. Push them up so that all the wires terminate right at the tip of the connector.
- Check the colour sequence of the wires again.
- Crimp the wires to the connector using the tool. You'll notice that the connector has copper strips along the top. These connect to matching strips in the plug of the workstation's network card or the switch. When you crimp the connector, it bites into the wires through their plastic covering, connecting its copper strips to the copper wire. This is why it's critical to push the wires right up to the tip of the connector, so that the connector's teeth find the wire.
- Test the cable using a continuity tester, if you have one. If you don't, you'll just have to figure out whether it works by trial and error later.
TODO: Add image for this caption - Cross-over CAT-5 cable
TODO: Add image for this caption - Straight-through CAT-5 cable
LANs and WANs
You have now constructed a local area network, or LAN. It's what gives Edubuntu life, but it stops at the classroom walls. To be able to send and receive email or access the Internet, it is necessary to connect to further networks. This happens over a wide area network, or WAN. A WAN is a computer network covering a wide geographical area. The grandest example of a WAN is the Internet.
WANs are used to connect local area networks together, so that users and computers in one location can communicate with users and computers in other locations. Many WANs are built for one particular organisation and are private; others, built by Internet service providers, provide connections from an organisation's LAN to the Internet. This is the case with an Edubuntu that is connected to the Internet. Private WANs are most often built using leased lines. At each end of the leased line, a router connects to the LAN on one side and a hub or a switch within the WAN on the other.
While a LAN is a network of computers and devices, a WAN is most often a network of networks. A router, or a computer configured to function as a router, on each network, connects to routers on other networks.
Behind every router there may be many computers (or networks) that are not directly connected to the Internet. It is then the function of the Internet gateway computer to route packets from outside networks to the correct computer on the inside. All the computers on a LAN share a single connection to the Internet. In the case of Edubuntu, the server acts as a gateway computer.
However, because a permanent WAN connection is very expensive in some parts of the globe, especially in rural areas where telecommunication infrastructure may be lacking, Edubuntu may only connect to the Internet only intermittently.
The network protocol of the Edubuntu LAN is the same as that used for communication on the Internet, namely TCP/IP. This is the Transmission Control Protocol (TCP), encapsulated within the Internet Protocol (IP). The Internet Protocol takes care of routing data packets from a source IP address to a destination IP address. An IP address consists of four numbers that look like this: 192.168.10.200. IP packets can contain TCP packets. Whereas an IP packet only knows where it should go, TCP packets contain information about their position in a sequence of packets.
TCP is wonderful: it makes it possible to treat a flaky network as though it were perfectly reliable. When you send anything across a TCP/IP network (e.g. an email message, an image, or a document) it is broken down into many TCP packets. These are numbered and sent, one by one, to the destination computer. At the destination, the sequence number is used to put the packets in the correct order (as they may have become mixed up in transit). If there are gaps in the sequence, only those packets are requested again. If some packets are received more than once, the extra packets are simply dropped. Once all the packets in the sequence have been received, the entire file has been transfered successfully.
Unsurprisingly, an IP address cannot be just any four numbers. Actually, there is a lot of underlying structure. In the first place, the numbers are a sequence of four bytes. Computers generally handle data one byte at a time, so it's convenient to specify things as a sequence of bytes. A byte consists of eight binary digits. The binary number system has only two digits, namely 0 and 1: just as 99999999 is the largest number that you can express with eight decimal digits, 11111111 is the largest number that you can express with eight binary digits. If you convert that number to decimal, you get 256. For this reason, a sequence like 300.5.502.743 does not make any sense as an IP address.
In the second place, some address ranges are reserved. For example, all the networks that start with 192.168.---.--- as their first two digits are private, not routed on the Internet. The whole public IP address space is divided among ISPs. Each ISP gets a range of numbers that they may portion out between its customers. This range of numbers is described in terms of a netmask, a number which looks similar to an IP address, but is used to match all the IP addresses that belong to a particular network. Private networks can also be segmented into subnets using netmasks. Any computer on a network can send IP packets to any other computer on the network, but to send an IP packet to a computer on a different network, there must be a gateway computer which is configured to help the packets cross from one network to another.
Gateway computers also implement network management policies, e.g. by way of firewall software, that specify what traffic is allowed into and out of a network.