Networking For DevOps
Networking For DevOps
What is a Network?
When two or more computers and computing devices connected together with each
other through communication channels, such as cables or wireless media and sharing
some files, then it is called a Network.
A network is used to:
Enable multiple users to share devices over the network, such as music and video
servers, printers and scanners.
The Internet is the largest network in the world and can be called "the network of
networks".
Types of Networks
There are different types of networks. But the main two are LAN and WAN
1. LAN (Local Area Network) - interconnects computer within a limited area, such as
residences, schools. e.g.: Wi-Fi, Ethernet
3. WAN (Wide Area Network) - extends LAN over a large geographic area.
e.g:- optical fiber cable
Network Components:
1. Switch:
3. Modem:
4. Hub:
5. NIC:
6. Bridge:
What is Protocol?
A network protocol is a set of rules which is set up by people that determine how a
particular data is transmitted between different devices in the same network. e.g.:
HTTP, TCP, IP, FTP, SMTP etc.
Types of IP Addresses
1. IPv4:
2. IPv6:
Provides a vastly larger pool of addresses, designed to replace IPv4 as it runs out.
3. Public IP:
4. Private IP:
5. Static IP:
Often used for servers and devices that need a consistent address.
6. Dynamic IP:
224.0.0.0 -
D 239.255.255.255 Reserved for multicasting.
240.0.0.0 -
E 255.255.255.255 Experimental, used for research.
0.0.0.0 is a special address, not part of the usable IP address range in Class A.
What is Loopback?
Loopback address allows a device to communicate with itself.
Itʼs often used for testing network software on the local machine.
Any IP address in the 127.x.x.x range will loop back to the same device.
There are two parts to an IP address - Network ID and Host ID (Any device which gets
the IP address is called a Host).
Class C: 1st, 2nd, and 3rd octets are the Network ID.
Direct Connection: Devices with the same Network ID can connect without a router.
Router Requirement: Devices with different Network IDs need a router to connect.
We will try to break it with text based structural diagram for a better understanding:
+---------------------+---------------------+-----------------
| Class C | 1st, 2nd & 3rd | 4th Octet
| | Example: 192.168.1.1| (1)
+---------------------+---------------------+-----------------
Connection Summary:
+-----------------------+---------------------------+---------
| Device A IP | Device B IP | Connec
+-----------------------+---------------------------+---------
| 17.0.0.1 | 17.0.4.2 | Direct
+-----------------------+---------------------------+---------
| 17.0.0.1 | 192.168.1.5 | Requir
+-----------------------+---------------------------+---------
Explanation:
- If Device A and Device B are in the same network (same Netwo
- If they are on different networks (different Network IDs), a
Router Usage:
+-----------------------+---------------------------+---------
| Different Networks | Example: | Connec
+-----------------------+---------------------------+---------
Subnetting:
Divides a network into smaller, more manageable segments.
Example: A network with IP address 192.168.1.0/24 can be divided into subnets like
192.168.1.0/25 and 192.168.1.128/25.
/24 indicates a subnet mask of 255.255.255.0, meaning there are 8 bits for
hosts (32 total bits in IPv4 - 24 bits for the network portion 8 bits for hosts).
1. Subnet 1: 192.168.1.0/25
Total IPs: 128 addresses (126 usable for hosts, as the first address is the network
address and the last is the broadcast address).
2. Subnet 2: 192.168.1.128/25
Summary Table
192.168.1.0 -
192.168.1.0/25 192.168.1.127 255.255.255.128 128 126
192.168.1.128 -
192.168.1.128/25 192.168.1.255 255.255.255.128 128 126
Explanation:
By using a /25 mask instead of /24, we split the network into two subnets with 128
IP addresses each.
This creates smaller segments within the original network, making it easier to manage
specific groups of hosts separately.
Number of Relation to
Prefix Netmask addresses class Comment
1 Single host in a
/32 255.255.255.255 Class C/256 network
Class C*256
/16 255.255.0.0 65,536 Class B
Class B*256
/8 255.0.0.0 16,777,216 Class A
0.0.0.0/0 means
entire internet.
/0 0.0.0.0 4,294,967,296 Class A*256 Often used in
public firewall
rules
Network Models
2. TCP/IP Model
1. Physical Layer: Handles the physical connection between devices, transmitting raw
data as bits over cables, radio signals, etc.
2. Data Link Layer: Manages data transfer between directly connected nodes.
It handles error detection and flow control. Examples: Ethernet, Wi-Fi.
3. Network Layer: Manages packet forwarding and routing through the network. Uses
IP addressing. Example: IP (Internet Protocol).
4. Transport Layer: Ensures reliable data transfer with error correction and flow
control. Examples: TCP, UDP.
7. Application Layer: Interfaces directly with the user and provides network services
like HTTP, FTP, SMTP.
Hereʼs a
text-based structural diagram that shows the flow through the OSI model from
Person X to Person Y:
NetBIOS (Ports 137, 138, 139): Establishes sessions for network communications.
Layers 2 to 6 typically deal with specific network management functions and do not
use port numbers as these layers are responsible for connections and managing data
formats.
Port numbers are used primarily in the Application and Transport Layers to ensure
data is delivered to the correct services and applications running on a computer.
2. TCP/IP Model:
The
TCP/IP model, also known as the Internet Protocol Suite, is a simplified version of
the OSI model with only 4 layers instead of 7.
This model is a real model which actually works in real. This model consists of 4 layers.
2. Transport Layer
3. Network Layer
It is a client server stateless (means it never stores any data of client) protocol, and it
tells us how it requests any data from the server and also tells us how the server will
send the data back to the client.
- When server sends response to client - HTTP response -- Some HTTP methods used
to make any request
Status codes are issued by a server in response to a client's request made to the server.
2. 300s: Redirects
Found, Temporary The URI of the requested resource has been changed
302, 307 Redirect temporarily.
404 Not Found The server canʼt find the requested resource.
Internal Server The server does not know how to handle a request.
500 Error
Find the complete list of status codes with detailed explanations by Mr.
Abhishek Veeramalla (Thank you!):
I have said that HTTP is a stateless protocol, means it never store any data of
client in server. Then suppose when you will search for the second time amazon.com then
it should be logged out from the server, and you have to log in again for second time
visit, but you don't. In second time, it's automatically logged in, and you can see all of
your saved carts 🛒 and all data. So how it is possible?? Here, cookies come into the
picture.
SMTP is used in sending and receiving any email from senders SMTP server to
Receiver's SMTP server
FTP is used to download, upload and transfer files from one host to another host.
Find the link below for Common Ports and Protocols Cheat Sheet (Thanks to
Stationx):
Routing:
So how do we get a packet of information from a host on one network to a host in
another? In one word: Routing.
We use tables to help us determine the routes we want to take. This screenshot
demonstrates a typical route table in AWS:
If a packet destination does not fall in any of these ranges, the widest one is evaluated
which is 0.0.0.0/0 which means it is internet traffic. And the packet will be redirected
to the Network Address Translation (NAT) interface.
Root DNS Server stores all the Top-level domain e.g : - .com, .in, .org, .io etc.
DNS works like the phonebook of the internet, allowing humans to use readable names
while machines use numerical addresses.
The DNS process involves looking up the domain name and finding the corresponding
IP address through multiple DNS servers.
2. DNS Query:
3. DNS Resolution:
The DNS server checks if it has the IP address cached. If not, it contacts other
DNS servers (root, TLD, and authoritative servers) to find the IP address.
4. IP Address Found:
Once the IP address (e.g., 93.184.216.34) is found, the DNS server sends it back
to your browser.
The browser uses this IP address to connect to the web server, and the website
loads on your screen.
For example, ICANN controls the root domain and delegates .com to Verisign.
Verisign can then delegate control over example.com to "Example Ltd" by adding an
NS record those points to their nameserver.
The NS records direct traffic to the appropriate nameserver that manages a domain,
allowing different parts of the DNS tree to be managed independently by different
organizations.
Below are the most commonly used types of DNS records and their meaning:
TXT Descriptive Text Holds general information about a domain name such
as who is hosting it, contact person, phone
DHCP
DHCP (Dynamic Host Configuration Protocol) is a network management
protocol that automatically assigns IP addresses and other network
configurations (such as subnet mask, gateway, DNS servers) to devices on a
network.
Example:
When you connect your laptop to a Wi-Fi network, a DHCP server assigns it an IP
address automatically, allowing it to communicate with other devices on the
network without manual configuration.
Switches: Connect devices within the same network and use MAC addresses to
forward data to the correct device.
Firewalls
Firewalls control incoming and outgoing network traffic based on predetermined security
rules.
Load Balancers
Load balancers distribute incoming network traffic across multiple servers to ensure no
single server becomes overwhelmed.
VPN
VPN (Virtual Private Network) provides a secure connection between remote users and
the corporate network over the internet.
Usage: For basic troubleshooting, you can run ping www.google.com to check network
connectivity and see response times and packet loss.
How It Works: Sends UDP probes with increasing TTL values, showing each router
along the route and the delay in reaching it.
Usage: Helps find which gateway is causing a delay by showing response times and
where packets fail (indicated by ).
3. telnet
Purpose: Test network connections and protocols.
4. curl
Purpose: Transfer data using multiple protocols, often for HTTP requests.
Usage:
Basic GET request: curl http://example.com .
Usage: dig google.com to get information like IP addresses, TTL, and DNS record types.
6. netstat
Purpose: Show network connections and port listening information.
Usage:
netstat -lp : List listening servers and their program names. netstat -a :
How It Works: Sends raw packets to identify hosts, services, and operating systems.
Usage:
Usage:
Secure and encrypted, used for remote management and file transfers.
Usage:
These tools are invaluable for network diagnostics, troubleshooting, and secure
communications, which are critical skills for any DevOps engineer.