Basic Networking Principles
The networking of computers is nearly as old as computing itself. Its roots can be traced back as far as 1961 when the idea of ARPANET was proposed by Leonard Kleinrock. Since that time there have been a series of gradual improvements to the ideas and technologies.
Significant points in the timeline can be shown as
1965 when the term packet was used to describe data being sent between computers on a network
1969 the Internet was officially born
1973 Ethernet is developed
1974 first Routers are used. However, these Routers are not considered to be true IP Routers
1976 development of the first IP Router
1978 the invention of the TCP/IP protocol
1983 implementation of the first DNS
1988 details of the first firewall are published
1990 the first network switch is developed and introduced
A computer network is a collection of computing nodes connected in a number of ways that allow them to communicate with each other. The network comprises Routers, Hubs, Bridges, and Switches.
In order the ensure interoperability between computers on a network, standards must be defined and adhered to. The most important one is the OSI 7 layer model. It is a reference model that specifies standards for communications protocols and also the functionalities of each of the 7 layers.
Computers communicate with each other using predefined protocols. A protocol is the set of rules that define the way how two entities can communicate across the network. It would specify patterns of communication and data structures. Each layer of the OSI 7 layer models is governed by 1 or more protocols, such as TCP, IP, UDP, ARP, DHCP, FTP, and so on.
In order for computers to be able to identify each other on a network, they need an identifier. There are several types of identifiers used in the network.
Hostname
A unique device name (names can clash) on the network
Open a command prompt and type hostname
IP Address (Logical Address)
The IP Address is the network address of the system across the network. Notice we say the system here and not the device. More on this later. It is assigned to the system when it is bootstrapped, and it can be changed at any time whilst the system is actively running.
To identify each device in the world-wide-web, the Internet Assigned Numbers Authority (IANA) assigns an IPV4 (Version 4) address as a unique identifier to each device on the Internet. There are more devices in the world than there are IP addresses, so addresses are distributed based on organizational requirements.
The length of the address is 32-bits for IPv4, giving us an available 232 IP addresses. Or 128-bits for IPv6 giving us an available 2128 IP addresses.
From the command line type - ipconfig
MAC Address (Media Access Control) - Physical Address
The MAC Address is the unique identifier of each node and is associated with its NIC (Network Interface Card). A MAC address is assigned to the NIC at the time of manufacturing. It can not be changed.
The length of the MAC address is : 12-nibbles == 6 bytes == 48 bits
A nibble is 4-bits
From the command line type - ipconfig /all
Port
A Port is a logical construct that is mapped onto a physical construct (the physical IO connection port on the Ethernet card). It allows for traffic to be routed from the physical card to applications running on the node. A node can have multiple applications running on it all competing for data coming in through the single physical IO connection. The operating system routes data from the physical IO port to a destination application. Only one application can own (bind to) a port, but an application may own (bind to) many ports.
Port numbers are divided into three groups
Port Range |
|
---|---|
0 - 1023 | Well known ports |
1023 - 49151 | Registered by product vendors |
49152 - 65535 | Ephemeral, free for anyone to use |
Sockets
Logical construct offered by the operating combining the IP and Port. It’s analogous to a socket that you put in a wall and the socket itself.
There are two types of sockets, server sockets, and client sockets. One server socket communicates with 1 or more client sockets.
An application that is acting in a server capacity creates a server socket. The server socket must bind to a port on the host that it is running on. When client applications want to communicate with a server socket they do this by opening a client socket and sending a bind request to the host and port that the server is running. The server can respond by creating a client socket so that two-way communications can begin between the two endpoints.
DNS (Domain Name Server)
Given that computing nodes on a network have IP addresses, there may be 100s - 10000s of nodes in a network, and that the IP addresses can change. Using IP addresses as a point of reference in code of any kind is not scaleable or good design, it leads to brittle designs.
A better approach is to attach to the IP (which is a changeable value) an identifier that is more persistent. Such an identifier could be a human-readable value like a name, something that is more memorable than IP addresses. This is the purpose of a DNS. It follows the NVList pattern (Name/Value List). For each IP address, you associate with it a human-readable name.
When you want to locate a node on the network, simply request its IP address from the DNS by passing it the human-readable name.
This model leads to more scaleable and decoupled systems.
ARP (Address Resolution Protocol)
Used to convert an IP address to its corresponding physical address(i.e., MAC Address).
ARP is used by the Data Link Layer (ISO 7-layer) to identify the MAC address of a target node.