Reviewing computer network basics
In Chapter 1, we learned that a computer network is a collection of interconnected devices, such as computers, servers, printers, and other devices, that are linked together to share resources and communicate with each other. A subnet, or subnetwork, is a smaller network that is created by partitioning a larger network into smaller segments, typically used to improve network performance, security, and management. Each subnet is identified by a unique network address, and devices within the same subnet share the same network address prefix. Each device has a unique address in the network/subnet. For a computer to talk to another one in a computer network, it must have an address for communication, which we call an IP address.
IP address
An IP address, or an Internet Protocol address, is a numerical address assigned to a device in a computer network for communication with the other devices that are also assigned IP addresses. An IP address serves as an identifier for the device on the network and allows it to send and receive data. There are two versions of IP addresses in use today: IPv4 and IPv6. IPv4 addresses consist of four decimal numbers separated by dots, while IPv6 addresses use a hexadecimal format with eight sets of four characters separated by colons. We will mainly use IPv4 in our book. Figure 3.1 shows a fictitious website, www.zeebestbuy.com, and its IP address
Figure 3.1 – An IP address
As we can see, an IPv4 address can be represented by four decimal numbers, 172.217.9.36
, or by 4 bytes (32 bits) of binary numbers, 10101100
. 11011001
. 00001001
.00100100
. Since an IP address has 4 bytes or 32 bits, the total number of addresses in this IP space is 232. We cannot put this number of computers in one network, so we need to develop a way to separate the network into subnets, which requires something called Classless Inter-Domain Routing (CIDR).
CIDR
CIDR is a method used to allocate IP addresses in networks and specify network addresses. In the CIDR notation, a network address is represented by an IP address followed by a slash (/) and a number indicating the number of bits in the network address. For example, the CIDR notation 172.217.9.0/24
represents a network address – the first 24 bits (10101100
. 11011001
. 00001001
) represent the network portion and are fixed, and the remaining 8 bits represent the host portion and are varied (from 00000000
to 11111111
). For the subnet 172.217.9.0/24
, since 24 bits out of 32 are fixed and 8 bits are variable, there are 2
8=256
IP addresses in the subnet: 172.217.9.0
to 172.217.9.255
. Figure 3.2 shows CIDR notations for some subnets, from /32
to /24
, and the available IP addresses for the subnets:
Figure 3.2 – CIDR notation
With IP address and network address notations, we can construct any networks and connect them with routing devices. And that’s how we build the internet, which will be discussed next.
The internet
The internet is a global network of interconnected computer networks that allows the exchange of information and communication among users around the world. It is composed of millions of devices, including computers and networking hardware devices, and software applications, protocols, and standards that enable these devices to communicate and share data with each other.
At a high level, the internet is made up of physical infrastructure, such as computers, routers, and switches. A router is a network device that connects multiple networks and routes data packets between them. Routers use a route table to determine the best path for data packets to take between networks, and they can be used to filter and direct traffic based on various criteria, such as port numbers, IP addresses, and protocols. Each subnet must be associated with one and only one route table. A switch is a network device that connects multiple devices within a network. Switches use MAC addresses to direct traffic to the correct device and can be used to segment networks and improve performance by limiting the amount of traffic that flows through each segment.
On the internet, routers, switches, and computers work together, under network routing protocols such as Transmission Control Protocol (TCP) and IP. Just like computers have evolved from physical machines to virtual machines, networks have evolved from hardware-based physical networks to software-based virtual networks. In the next section, we will discuss Amazon VPC, which is a virtual network in the cloud.