Praise to the best YT networking series, source of the following notes (as I understood it).
- Host: Any device connected to a network
- Client: the initiator of the request
- Server: the respondent
- IP Address: A unique identifier for a host within a network
- Every packet is sent with source and destination IP addresses
- Formats:
- IPv4 are 32 bits
- IPv6 is 64 bits
- Hierarchically assigned
- Network: Any set of interconnected devices that can communicate forms a netowrk
- To form a proper network, host have to be connected through similar connectivity
- Can contain other networks, a.k.a. sub-networks which connect to each other
- Devices of interconnection
4. Repeater: signal rebooster
5. Hub: a multi-port signal repeater (repeats everywhere except input port)
6. Bridge: a two-port signal blocker/repeater (repeats only if recipient is on the other side)
7. Switch: a multi-port signal blocker/repeater (repeats only to recipient) within a network
8. Router: a multiport sibnal blocker/repeater between networks
- Gateways: the router in a local network
- Routes
- Routing table
- Routing
IP Addresses
Let's consider IPv4. In this standard, addresses are 4 octets; 01111100111010101101101000111100
in binary or 128.26.0.1
in decimal. In binary there is no need to put the .
since we can always split the 32 bits in 4 blocks of 8 bits. In decimal however, the .
is needed to separate each block and prevent confusion.
Hierarchically assigned: Subnetting
How are all these addresses assigned ? Is it random, or would it make sense to assign addresses using some pattern ? There's a hint in the spliting of the 32 bits into 4 octets.
Since the internet connects many countries together, within which there are corporations with branches and teams etc, you can see how IP addresses must identify entities in tree like structure.
By convention, the leftmost block is used to reference large entities (closest to the trunc of the tree), and each subsequent block is used to further assign addresses to downstream levels in the branches. This splitting of addresses into meaningful sub-networks is called subnetting. You probably have already seen IP's like: 255.255.0.0
or 255.255.255.0
, those are subnet masks; a special kind of IP address, not directly used to identify a host. More on that later.
Reconsider this tree like structure. Let's say we want to reference each leaf in the tree, and that each node in a level is responsible for its branches (e.g. a corporation -> branches -> departments -> teams), we can split the IP addressing space by using each 8 bit block to reference the nodes in a level of the tree. We can use the first 256
numbers, to identify 256 corporations, and let those corporations assign identifiers to their sub branches (e.g. corporation 201 would own all addresses starting by 201.x.x.x
, it can then delegate to branches using the next 256 numbers in the second block, so branch 123 owns all IP's in 201.123.x.x
etc. until each address references each team). So 201.123.44.2
would identify team 2 in department 44 of branch 123 from corporation 201.
Can you see any limits to this process ? What if there are more than 256 corporations ? Fail. Moreover, we do not have exactly 4 levels (i.e. we can have countries before the corporations, or sub-departments), thus you can imagine that there are plenty of strategies in place to properly to split the address set. But don't despair, they mostly follow this concept with accomodations.
We understood how "Corporations" would assigne IP's to their branches. But who assigns IP's to the topmost entities (i.e. the first block space)?. An american entity called: Internet Address Numbers Authority (IANA). IANA assigns large blocks of addresses to Regional Internet Registries (a total of 5 RIRs), which form a group called the Number Resource Organisation (NRO)
The RIRs manage, distribute, and publicly register IP addresses and related Internet number resources, such as Autonomous System Numbers (ASN) and reverse Domain Name System (DNS) delegations within their respective regions. They do this according to policies which are developed within their respective regional communities, through open and bottom-up processes.
NOTE: in practice, the allocation does not follow a 100% repeatable process, due to historic reasons. NOTE: as of 3 Februrary 2011, all the IPv4 address numbers have been depleted
Networks: Internet
A network is any set of Hosts that connect together and can communicate. A network can be composed of other networks, also refered to as Sub-Networks. Does it mean a network can be a host? No, because a host must be a device, and a network is logical. At the highest logical level, all the inter-connected networks form the Internet. The inter-connection between many networks is usually handled by ISP's (Internet Service Providers).
Devices
Repeater
Every time you connect two hosts with a wire, you have a network. Since signal decays as an increasing function of distance, a device that reboosts the signal was created: repeater.
Hub
We know how to send data far, but what if we want to connect more than two _host_s together? Say we have to achieve communication between hosts A
, B
and C
:
Inefficient solution: Connect A to B, B to C, and C to A. There are (n-1)n connections. Could we do better ? Better solution: Add a Hub and connect A, B and C to it. There are n connections! And an additional host: the hub
A hub is a multi-port repeater. Any entering signal through one port, is repeated accross all the other ports.
Bridge
Before adding a hub to network of more than two hosts, we had an advantage: since the hub repeats every entering signal to all the other ports, anyone in the network can eavesdrop each-other, whereas before, communications were private between hosts. It's all good if you only connect hosts who trust each other to the same hub.
What if we need to conect to another team in the company ? We don't want the other team members to recieve copies of all packets sent among our team members, but we want to send only those packets which are ment for the other team members.
Enter the Bridge: a device with only two ports, it has the ability to learn on which side each host is at, and only repeat the signal when it is meant to a host on the other side of the bridge.
Switch
Let's add some mistrust among team members. We want packets to be repeated only to the recipient.
Could we build that using our toolset: hub and bridges? Yes, use a hub to connect all host and between the hub and each host add a bridge. This way the bridge will not repeat the packet if the recipient is not on the other side of the bridge, thus cutting all hub signals except that meant for the recipient. It's a lot of bridges!
To avoid all this bridge overhead, the switch was invented: a device that facilitates communication within a network. It's a hub that repeats the signal only to the intended recipient!
IMPORTANT: hosts in a network all share the same IP address space: 123.123.1.x
, where each host has a different x
.
If we had two teams, of 200 hosts each, we would not have enough Address numbers within the 123.123.1.x
address space (max 256, but we have a total of 400 hosts to identify). To circumvent this limitation, we would need to create an address space per team: 123.123.1.x
and 123.123.2.x
; and each would be connected to a different switch.
Router
How would the two teams communicate with each other now that each is connected to a different switch (equivalently: each team is in a different network) ? Since switches can only provide communication within a network and not between networks, we need a Router.
The Router is a device that facilitates communication between networks.
The knowledge of all these different networks is called a Route, and is stored in a Routing table.
A router is the perfect place to add traffic control mechanisms (security, filtering, redirecting). To be fair, nowadays, switches are also capable of these traffic control mechanisms.
Routers learn which networks are connected on each side. In our previous two teams example where each is connected to a different switch with a different address space: 123.123.1.x
and 123.123.2.x
, the router would learn to repeat all packets that have 123.123.1
as recipient only when the come from the other network 123.123.2
(and vice versa).
Our teams could very much be connected to the internet through this router, and thus, the router would repeat to the internet all signals that are not meant for any of the team's networks.
When a router is connected to a network, it is assigned an IP address in that network. In our example, the router may have the address 123.123.1.5
in team 1
's network (remember teams are conected as a network by switches), and on team 2
's network it may have IP address 123.123.2.254
.
Interface identity: each port in the router is an interface identified by an IP address on that interface's network.
Gateway: when router is connected to a local network, it serves as a gateway for local network.
Example: When member 55
of team 1
(IP: 123.123.1.55
) wants communicate with team member 9
of team 2
(IP: 123.123.2.9
), he knows he has to go through the Default Gateway with IP 123.123.1.5
on his local network.
Closing
Routers are connected to other routers, and the whole internet is just a web of interconnected routers. These routers learn on which interface the have to send a packet in order to reach it's destination.
Routers facilitate communication between networks Routing is the process of moving data between networks. A Router's primary purpose is Routing. Switches facilitate communication within a network Sitching is the process of moving data within networks. A Switch's primary purpose is Switching.