TCP/IP

Last edited

Question

Why did the internet go with TCP/IP protocol suite?

Answer

Largely to the elegant and flexible design of TCP/IP and its open and nonproprietary protocol suite.
TCP/IP doesn’t rely on any particular hardware or OS.

RFCs

The technical activities of the Internet community are summarized in documents known as Requests for Comments or RFCs. In addition to standardizing the Internet protocols, the RFC mechanism sometimes just documents or explains aspects of existing practice.

Once distributed, the contents of an RFC are never changed. Updates are distributed as new RFCs with their own reference numbers. Updates may either extend and clarify existing RFCs or supersede them entirely.

RFC

Hardware (MAC) addressing

Each of a host’s network interfaces usually has one link-layer MAC address that distinguishes it from other machines on the physical network, plus one or more IP addresses that identify the interface on the global Internet

Important

IP addresses identify network interfaces, not machines.
A packet is delivered to a specific network interface, the OS decides which process or service should receive it.

Vendor ID embedded in a MAC address can be misleading.

In theory, Ethernet hardware addresses are permanently assigned and immutable. However, many network interfaces let you override the hardware address and set one of your own choosing.

Ports

IP addresses identify a machine’s network interfaces, but they are not specific enough to address individual processes or services. TCP and UDP extend IP addresses with a concept known as a port.

Definition

Port: a 16-bit number that combined with an IP address to specify a particular communication channel. Valid ports are in the range 1–65,535.
IP address gets you to the machine, port gets you to the specific thing running on that machine.

Although both TCP and UDP have ports and those ports have the same sets of potential values, the port spaces are entirely separate and unrelated. Firewalls must be configured separately for each of these protocols.

To help prevent impersonation of system services, UNIX systems restrict programs from binding to port numbers under 1,024 unless they are run as root or have an appropriate Linux capability.
Today, privileged ports are more nuisance than security benefit. Running services on unprivileged ports as nonroot users and forwarding traffic through a load balancer is often more secure, it limits unnecessary root privileges and adds a layer of infrastructure abstraction.

IP Addresses

Internet addresses have network and host portions. The network is the logical network and the host is the node on that network.

sudo apt install ipcalc
ipcalc 10.0.14.76/27 # awesome cli tool for subnetting

IPv6

Question

Why hasn’t IPv6 been adopted yet?

Answer

The underlying issue that limits IPv6’s adoption is that IPv4 support remains mandatory for a device to be a functional citizen of the Internet.
Currently: your choice is not between IPv4 and IPv6; it’s between supporting IPv4 alone and supporting both IPv4 and IPv6.

IPv6 is a well designed protocol that improves on IPv4, in someways it’s easier to administrator than IPv4 with fewer hacks (NAT) in the end it’s just a cleaned up version of IPv4 with a larger address space. Because you need to manage it alongside IPv4 elimates any potential efficieny gains.

Implementation

Network/host are fixed /64.

├─── leading zeros can be removed :000a: -> :a:
└──┬ contiguous zero compressed into -> :: 
   ├─ only use :: compression once on the largest contiguous group of zeros
   └─ cant replace a single group of zeros -> :0000: -> :0: (instead of ::)

Routing

Definition

Routing: the process of directing a packet through the maze of networks between it’s source and destination

Routing means two things:

  • looking up a network address in a table
  • builing the routing table

A host can route packets only to gateway machines that are reachable through a directly connected network. The local hosts job is only to determine the next hop so it’s pointless to store information about non-adjacent gateways in the local table.