Network DevOps Basic¶
The basic and simplified network knowledge to know for DevOps
Computers need a way to decide the target server to communicate.
To have a unique address is “addressing”.
IP Addressing (IP Protocol)¶
The most popular way of addressing.
An IP address represents a host or a network interface.
Currently the most commonly used.
But the total number of unique IPv4 addresses is not enough as the internet grows.
IPv4 is a 32-bit number and is divided into 4 parts with 8 bits each part.
This 32-bit number is also divided to be 2 parts:
- Network Identifier
- Host Identifier
There is no fixed length for these 2 parts.
Another numerical label, “subnet mask”, is used to determine this length.
Subnet mask is usually simple. It also has 32 bits and each bit corresponds to a bit in IP address.
The “1” bits of subnet mask represents the network identifer part of this IP address.
Only given both IP address and subnet mask can we decide which is which.
The example above can be represented as:
where 24 means there are 24 “1” bits in subnet mask.
MAC (Media Access Control)¶
Used for communication within the same network.
MAC is the “hardware” address for a network interface controller.
In OSI model, this is the second layer. (IP is the third layer)
Communication within Same Network¶
When the IP addresses of different devices share the same network identifier (the bits “masked” by the subnet mask are identical), we say theses devices are within the same network.
- Sender uses ARP (Address Resolve Protocol) to retrieve MAC address from the IP address of receiver
- All devices receives this ARP, but only the device with the requested IP address will respond
- Get MAC address
- Usually devices within the same network are connected with wires or network switches.
Communication outside of Same Network¶
Routers or gateways are needed. (Devices with routing functionality)
Usually there are more than 10 routers between 2 devices.
Forwards packets between different networks.
Each router has multiple data lines that are connected to different networks.
Routers forward data packets based on routing tables.
- Receiver is decided to be in another network
- Sender sens packet to router/gateway
- Router looks up the routing table
- It forwards data
- For example, from eth0 to eth1
The URLs uses type in the address bar of the browsers.
They are case-insensitive.
It is hard to memorize the IP address, so people use domain names.
Domain name is divided into 3 parts:
It is read from right to left:
- type of this domain (Top-level domain)
- com: company
- org: organization
- domain (Second-level domain)
- host name
- In the example above, www represents a host called “www” in the domain of “some”
- “www” is a convention or something historical (more)
Note the dot at the end represents the root domain.
Host name can be anything.
First locate the domain then the host.
DNS (Domain Name Service)¶
Translates domain name to IP.
DNS are provided by DNS servers.