Behind The Scenes of a Website Part Three – Networking
Hayden Smith explains the jargon of networking…
Something you can’t escape from once you start running a server is networking. Whilst, with shared hosting the underlying nature of the network is hidden from you by sysadmins and support teams, in the world of server management it becomes something worth knowing about.
You’ve no doubt heard the term IP addresses mentioned in numerous places. IP stands for Internet Protocol, and describes the method by which information can travel from one computer to another over a network. The current prevailing system is known as IP version four. IP addresses for this version consist of four numbers from 0 to 255 separated by dots (.). This gives a range from 0.0.0.0 to 255.255.255.255, a total of over four billion addresses. This seemed like a suitably large number when the system was devised, though now the number of available addresses is running out. IP version 6 is starting to be deployed, but it’s still a long way from becoming common.
Traffic on a network comes in three main forms. There’s broadcast traffic, which all devices connected to the network should receive it. There’s multicast, which multiple devices should receive it. Then there’s unicast, which is intended for just one device. To prevent broadcast traffic from being sent to all of the potential four billion devices that could be connected, the IP system was designed so that, rather than having one large network that all computers connect to, the network could be broken down into smaller sub-networks, or subnets. The size of the subnet is given by the subnet mask, also known as just a netmask.
The subnet mask for IPv4 addresses is commonly expressed in a similar format to the IP address itself, with four numbers between 0 and 255 separated by dots. Unlike the numbers in the IP address which represent an absolute value for the address, the subnet mask shows the number of IP addresses in the subnet. The number represents the inverse of the available number of IP addresses. So a subnet mask of 255.255.255.0 shows that there are a total of 256 IPs in the subnet, X.X.X.0 to X.X.X.255. Subnet sizes are predefined and are based on the binary representation of the underlying number. As such, each subnet is double the size of the previous smaller subnet. So, with our example subnet having 256 IPs, the next size up has 512 and the next size down has 128.
Two IPs in each subnet are unable to be used for network devices. The very first IP, is referred to as the network IP. And the very last IP, referred to as the broadcast IP. All devices on a given subnet will listen for traffic sent to the broadcast IP, and this is often used by software designed to communicate seamlessly with other devices on the same subnet without the need for a user to provide target addresses. This is something seen a lot in shared IP space scenarios where a server may detect a lot of traffic incoming on the broadcast IP and an overzealous firewall configuration may flag it as an attack, while it is simply other servers in the same subnet running software that uses broadcast traffic.
The final thing you’ll need to know when configuring networking is the gateway address. This is normally the IP address of your router. Because devices can only see other devices using IP addresses in the same subnet, to communicate with IP addresses in another subnet a router is required to route network traffic between the different subnets. Routers use various protocols to advertise which subnets they are on to other routers, and through these advertisements can learn which router to pass traffic on to, to get it towards its destination. This may make a number of trips through various routers, commonly referred to as hops. Tools like traceroute can show the various routers that the traffic is routed through on the journey from one IP address to another across the Internet. If no gateway address is set or the address set is on a different subnet to that of the device’s IP address then the device will only be able to communicate with other devices on the same subnet.