Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
networking:concepts [2025/02/06 08:43] – willy | networking:concepts [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Networking ====== | ||
- | |||
- | Networking is the concept of connection two or more computers together so that they can exchange data trough some kind of transport medium. | ||
- | |||
- | The [[https:// | ||
- | |||
- | More details on the physical layers can be found [[networking|Wired Backbone|here]] and [[networking: | ||
- | |||
- | |||
- | ===== Addresses ===== | ||
- | |||
- | If you have a network of computers, also referred as hosts, you need a way address each one, like for a home address which you need to receive your mail or your services (power, water, garbage...). Each host in a network must have it's own address, which means that the network itself needs to have an address configuration. | ||
- | |||
- | I am referring to IP neworks, and for clarity i will always use IPv4 addressing examples. IPv6 is more evolved, but also somehow still far away. Maybe i will bother in the future to adapt all these pages to IPv6 examples as well. | ||
- | |||
- | The way IPv4 define an address is by using four bytes, and it is displayed as a sequence of four numbers (between 0 and 255) separated by dots, like: | ||
- | < | ||
- | 192.168.0.1 | ||
- | </ | ||
- | |||
- | This sequence of numbers identifies one host in a subnetwork. You can see the 4 bytes as a sequence of 32bits and those bits are separated between the **subnet** part and the **host** part and is represented like: | ||
- | < | ||
- | 192.168.0.1/ | ||
- | </ | ||
- | in this example, we have a 24-bit subnet which defines: | ||
- | * The left-most (always!) 24bit are the subnet address: 192.168.0.0 | ||
- | * The right-most 8bit are the host address: 192.168.0.1 | ||
- | Please note that no matter how many bits the subnet mask is, we always refer to a subnet or host address with 4 full bytes. Maybe it's stupid, but this is customary. | ||
- | |||
- | == Address assignment == | ||
- | |||
- | the IP addresses are subdivided into private and public addresses. When assigning IP addresses to your home network you want **always** to use a private block because using a public one will cause a mess on the overall routing and is better avoided. | ||
- | |||
- | [[https:// | ||
- | |||
- | Well, first of all let's assume you have planned your network and defined your subnet address, now how can those addresses be assigned to your hosts? You have two ways: | ||
- | * Static assignment, by manually setting a different IP to each device on the network | ||
- | * Dynamically, | ||
- | * Mixed, by using a DHCP but at the same time assigning some hosts address statically | ||
- | |||
- | While running a fully static network is simple enough, today' | ||
- | |||
- | At the same time, a fully dynamic network might be overkill as at least some devices are not //mobile// and will most probably never need to change address. Good examples are IoT devices, smart appliances, TV boxes, webcams and such. | ||
- | |||
- | The protocol behind a dynamic or mixed network is a DHCP server, see [[https:// | ||
- | |||
- | I will show you how to setup a DHCP server for your home. | ||
- | |||
- | ===== Names resolution ===== | ||
- | |||
- | Nobody wants to remember a numeric sequence of four bytes (even worse in IPv6), even less thousand of those sequences. It's much better to assign a human-readable name to a host and use that to reach it. In order for this to work, we need a specific protocol to translate a name to an IP address, otherwise you would not be able to navigate or actually do anything meaningful on the internet. | ||
- | |||
- | The protocol behind names resolution it a DNS srver, see [[https:// | ||
- | |||
- | The DNS (Domain Name System) is how __names__ are converted to __addresses__ on the internet. Historically one of the oldest Internet Services still in use today, it suffers from a lot of drawbacks and issues, specially on the privacy side of things. The original plain-text protocol (on port 53, UDP) has been extended over the years with a few improvements like **DNS over TLS (DoT)** and **DNS over HTTPS (DoH)**. Both the new extensions provide more privacy, as the requests are encrypted your ISP and middleman cannot snoop every website you visit, and more robustness as, paired with DNSSEC, it is now more difficult to feed you malicious DNS responses and redirect your traffic to bad websites (think of malaware and such). | ||
- | |||
- | I will show you how to setup a forwarding DNS server for your home. | ||
- | |||
- | |||
- | ===== Internet Routing ===== | ||
- | |||
- | Now that a device in your network has an address and knows how to translate a name to the address of a destination server, all you need is a proper network routing to allow your devices to connect to those servers: in other words, there must be a way for your network data packets to go from your computer to the destination. On the way it will need to go trough a lot of intermediate devices like firewalls, routers, gateways... This process is called **routing**. | ||
- | |||
- | The basic concept behind routing is that every host is assigned a **default gateway** where all the traffic which goes outside the **local subnet** must be directed. This gateway will then take care of those packets and send them away. | ||
- | |||
- | The first step of the routing is to get your data packet from your computer out to the internet, trough your ISP (Internet Service Provider). This is the process: | ||
- | * You type the destination //name// (let's assume this name is a server on the internet) | ||
- | * The name is translated to it's IP address using the DNS | ||
- | * The IP is compared with your computer **subnet** address | ||
- | * Since it doesn' | ||
- | * The gateway (usually the home router connected to your ISP) will forward the packet upstream to the internet | ||
- | |||
- | What happens next is complex and outside the scope of all this, you can learn more looking for the BGP protocol and the likes. | ||
- | |||