Sagar.BlogArticle
All posts
All posts
Linux

Network Fundamentals — IP, DNS, and Ports

Understand IP addresses (IPv4/IPv6), how DNS resolves domain names, and what ports are used for on a Linux system.

March 9, 20255 min read
linuxnetworkingdnsip

What Is a Network?

Every device on a network has an IP address that uniquely identifies it. Linux systems need to understand IP addressing, DNS, and ports to communicate over a network.

IPv4 Addresses

IPv4 uses four 8-bit octets (0–255) separated by dots, giving ~4.3 billion unique addresses.

# Private ranges (local networks only)
10.x.x.x
172.16.x.x – 172.31.x.x
192.168.x.x

# Loopback (yourself)
127.0.0.1

# Check your own IP
hostname -I
ip addr

IPv6

IPv6 uses 128-bit addresses written in hexadecimal — virtually unlimited address space.

# Example IPv6 address
2001:0db8:85a3:0000:0000:8a2e:0370:7334

# Show IPv6 addresses
ip -6 addr

DNS — Domain Name System

DNS translates human-readable domain names to IP addresses: google.com → 142.250.80.46.

# View configured DNS servers
cat /etc/resolv.conf

# Manual DNS lookups
nslookup google.com
dig google.com
host google.com

Common Ports

Ports (0–65535) identify specific services. Well-known ports:

PortService
22SSH
80HTTP
443HTTPS
3306MySQL
5432PostgreSQL
3000Node.js

Network Interfaces

ip addr                    # Show all interfaces
ip addr show eth0          # Specific interface
ifconfig                   # Legacy command
hostname -I                # Quick IP list

Private IPs (10.x, 172.16-31.x, 192.168.x) are never routed over the internet — they're for local networks only.

Quick Check

What does DNS stand for?

Exercise

Run hostname -I to see your IP address. Then run dig google.com +short to see its IP.