CIS126RH | RHEL System Administration 1
Mesa Community College
Describe the network model and how data flows between layers
Understand IPv4/IPv6 addresses, subnet masks, and CIDR notation
Use ip, ss, and other tools to examine network settings
Use ping, traceroute, and DNS tools to verify and troubleshoot
Used by: HTTP, SSH, FTP, SMTP, databases
Used by: DNS, NTP, streaming, VoIP, gaming
A port is a 16-bit number (0–65535) that identifies a specific service or application on a host. Combined with an IP address, it forms a socket.
# View well-known port assignments
[student@server ~]$ cat /etc/services | grep -E "^ssh|^http|^dns|^ftp"
# Check what is listening on a port
[root@server ~]# ss -tlnp | grep :22
An IPv4 address is a 32-bit number, written as four decimal octets separated by dots. Each octet ranges from 0–255.
■ Network portion ■ Host portion
Identifies which network the host belongs to. All hosts on the same network share this prefix.
Identifies the specific host within that network. Must be unique on the local network.
A subnet mask defines which bits of an IP address are the network portion (1s) and which are the host portion (0s). CIDR notation expresses this as a prefix length: /24 means 24 network bits.
| CIDR | Subnet Mask | Network Bits | Host Bits | Max Hosts |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 8 | 24 | 16,777,214 |
| /16 | 255.255.0.0 | 16 | 16 | 65,534 |
| /24 | 255.255.255.0 | 24 | 8 | 254 |
| /28 | 255.255.255.240 | 28 | 4 | 14 |
| /30 | 255.255.255.252 | 30 | 2 | 2 |
Reserved for internal networks — not routed on the Internet:
| 10.0.0.0/8 | ~16M addresses |
| 172.16.0.0/12 | ~1M addresses |
| 192.168.0.0/16 | ~65K addresses |
Require NAT to reach the Internet
| 127.0.0.1 | Loopback (localhost) |
| 169.254.0.0/16 | APIPA (no DHCP) |
| 0.0.0.0 | All interfaces (bind) |
| 255.255.255.255 | Broadcast |
IPv6 uses 128-bit addresses written as eight groups of four hex digits separated by colons. Two consecutive groups of zeros can be replaced with :: (once per address).
# Full IPv6 address
2001:0db8:0000:0000:0000:0000:0000:0001
# Simplified (leading zeros removed, :: for consecutive zero groups)
2001:db8::1
# Link-local address (auto-configured, always starts with fe80)
fe80::a00:27ff:fe4e:66a1
# Loopback (equivalent to 127.0.0.1)
::1
fe80::/10 — Link-localfc00::/7 — Unique local (private)2001:db8::/32 — Documentation::1/128 — LoopbackDNS translates human-readable hostnames into IP addresses. Without DNS, you would need to know the IP address of every server you want to reach.
# DNS resolver configuration
[student@server ~]$ cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
search example.com
# Local static hostname resolution (/etc/hosts takes priority)
[student@server ~]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain
::1 localhost localhost.localdomain
192.168.1.10 webserver.example.com webserver
# Name Service Switch — controls resolution order
[student@server ~]$ grep hosts /etc/nsswitch.conf
hosts: files dns myhostname
# files = /etc/hosts first, then dns (nameservers), then hostname
| A | IPv4 address for a hostname |
| AAAA | IPv6 address for a hostname |
| CNAME | Alias to another hostname |
| MX | Mail server for domain |
| NS | Authoritative nameservers |
| PTR | Reverse lookup (IP → name) |
/etc/resolv.conf | DNS servers to query |
/etc/hosts | Static name mappings |
/etc/nsswitch.conf | Resolution order |
A network interface represents a network connection — physical (Ethernet, Wi-Fi) or virtual (loopback, bridge, VLAN). Modern RHEL uses predictable network interface names.
| Name Pattern | Type | Example |
|---|---|---|
| lo | Loopback (localhost) | lo |
| eno* | Onboard Ethernet | eno1, eno2 |
| ens* | PCI Express hotplug slot | ens33, ens192 |
| enp*s* | PCI bus location | enp0s3, enp3s0 |
| enwXXX | MAC-based stable name | enx001122334455 |
| wl* | Wireless LAN | wlp2s0 |
eth0/eth1 from older Linux. Names encode the hardware location so they are stable across reboots and hardware changes.
# Show all interfaces and addresses
[student@server ~]$ ip addr show
[student@server ~]$ ip a # Short form
# Show specific interface
[student@server ~]$ ip addr show ens33
# Show only IPv4 or IPv6
[student@server ~]$ ip -4 addr
[student@server ~]$ ip -6 addr
# Brief one-line-per-interface output
[student@server ~]$ ip -br addr
lo UNKNOWN 127.0.0.1/8 ::1/128
ens33 UP 192.168.1.100/24 fe80::a00:27ff:fe4e:66a1/64
# Show link layer info (MAC addresses, state)
[student@server ~]$ ip link show
[student@server ~]$ ip l # Short form
# Brief link status
[student@server ~]$ ip -br link
lo UNKNOWN 00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
ens33 UP 00:0c:29:4e:66:a1 <BROADCAST,MULTICAST,UP,LOWER_UP>
UP | Interface is enabled |
LOWER_UP | Physical link detected (cable connected) |
BROADCAST | Supports broadcast (Ethernet) |
MULTICAST | Supports multicast |
ip addr | Layer 3 addresses |
ip link | Layer 2 (MAC, state) |
ip route | Routing table |
ip neigh | ARP/neighbor table |
Interface name: ens33
Flags: UP (enabled), LOWER_UP (link detected)
MTU: 1500 bytes (standard Ethernet)
MAC address: 00:0c:29:4e:66:a1
IPv4: 192.168.1.100/24 (dynamic = DHCP)
IPv6: fe80:: (link-local, auto-config)
scope global: address is routable
valid_lft: DHCP lease time remaining
# Show routing table (two equivalent forms)
[student@server ~]$ ip route show
[student@server ~]$ ip r # Short form
default via 192.168.1.1 dev ens33 proto dhcp metric 100
192.168.1.0/24 dev ens33 proto kernel scope link src 192.168.1.100 metric 100
# Show IPv6 routes
[student@server ~]$ ip -6 route
# Show which route a specific destination would use
[student@server ~]$ ip route get 8.8.8.8
8.8.8.8 via 192.168.1.1 dev ens33 src 192.168.1.100 uid 1000
default via 192.168.1.1 — all traffic not matching a specific route goes to gateway 192.168.1.1192.168.1.0/24 dev ens33 — this network is directly connected on ens33
# Show all sockets
[student@server ~]$ ss
# Show TCP connections
[student@server ~]$ ss -t
# Show listening TCP sockets
[student@server ~]$ ss -lt
# Show listening UDP sockets
[student@server ~]$ ss -lu
# Show numeric (don't resolve names/ports)
[student@server ~]$ ss -n
t=TCP, u=UDP, l=listening, n=numeric, p=process name, a=all statesss -tlnp = listening TCP, numeric, with process names
# Show listening TCP sockets with process names (requires root)
[root@server ~]# ss -tlnp
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=1234,fd=3))
LISTEN 0 128 0.0.0.0:80 0.0.0.0:* users:(("httpd",pid=5678,fd=4))
LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=1234,fd=4))
# Show all connections with details
[student@server ~]$ ss -tulna
State | Socket state (LISTEN, ESTAB) |
Recv-Q | Bytes in receive queue |
Send-Q | Bytes in send queue |
ss -tlnp | What services are listening? |
ss -tn | Active TCP connections |
ss -unlp | Listening UDP services |
# Ping a host (Ctrl+C to stop)
[student@server ~]$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.543 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.412 ms
^C
--- 192.168.1.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.412/0.477/0.543/0.065 ms
# Send exactly 4 packets
[student@server ~]$ ping -c 4 google.com
# Quick check with 1-second timeout
[student@server ~]$ ping -c 1 -W 2 192.168.1.1 && echo "Host is up"
# Ping IPv6
[student@server ~]$ ping -6 ::1
[student@server ~]$ ping6 fe80::1%ens33 # Link-local needs %interface
# Trace the path to a destination (hop by hop)
[student@server ~]$ traceroute google.com
traceroute to google.com (142.250.80.46), 30 hops max, 60 byte packets
1 gateway (192.168.1.1) 0.543 ms 0.412 ms 0.389 ms
2 10.0.0.1 (10.0.0.1) 5.234 ms 5.112 ms 5.089 ms
3 isp-router.example.net (203.0.113.1) 12.456 ms
4 * * *
5 google-peer.example.net (198.51.100.1) 15.678 ms
6 142.250.80.46 (142.250.80.46) 16.789 ms
# Use ICMP (often passes firewalls better than default UDP)
[student@server ~]$ traceroute -I google.com
# Test TCP to specific port
[student@server ~]$ traceroute -T -p 443 google.com
# mtr — combines ping and traceroute (real-time updating)
[student@server ~]$ mtr google.com
# Simple lookup with host
[student@server ~]$ host google.com
google.com has address 142.250.80.46
google.com has IPv6 address 2607:f8b0:4004:800::200e
google.com mail is handled by 10 smtp.google.com.
# Detailed query with dig
[student@server ~]$ dig google.com
;; ANSWER SECTION:
google.com. 300 IN A 142.250.80.46
# Query specific record types
[student@server ~]$ dig google.com MX # Mail servers
[student@server ~]$ dig google.com NS # Nameservers
[student@server ~]$ dig google.com AAAA # IPv6 address
# Query a specific DNS server (bypass resolv.conf)
[student@server ~]$ dig @8.8.8.8 google.com
# Reverse lookup: IP address to hostname
[student@server ~]$ dig -x 8.8.8.8
[student@server ~]$ host 8.8.8.8
8.8.8.8.in-addr.arpa domain name pointer dns.google.
# Short output only (just the answer)
[student@server ~]$ dig +short google.com
142.250.80.46
# Trace the DNS delegation from root
[student@server ~]$ dig +trace google.com
dig @8.8.8.8 hostname to bypass local DNS and test against a known-good resolver — isolates local DNS configuration problems.
# Check NetworkManager status
[student@server ~]$ systemctl status NetworkManager
# List all connections
[student@server ~]$ nmcli connection show
NAME UUID TYPE DEVICE
ens33 a1b2c3d4-e5f6-7890-abcd-ef1234567890 ethernet ens33
# Show device status
[student@server ~]$ nmcli device status
DEVICE TYPE STATE CONNECTION
ens33 ethernet connected ens33
lo loopback unmanaged --
# Show detailed connection info
[student@server ~]$ nmcli connection show ens33
# Show general network status
[student@server ~]$ nmcli general status
nmcli survive reboots. Direct edits to ip commands do not.
ip addr — Is the interface UP? Does it have an IP? (169.254.x.x = DHCP failed)ip route — Is there a default route? ping <gateway IP>cat /etc/resolv.conf — Are nameservers configured? dig 8.8.8.8 to bypass DNSss -tlnp — Is the service listening on the expected port?firewall-cmd --list-all — Is the port allowed through the firewall?TCP/IP Model: Four layers — Application, Transport, Internet, Link. TCP for reliability, UDP for speed.
IP Addressing: IPv4 (32-bit, dotted decimal), IPv6 (128-bit, hex). CIDR /24 = 254 hosts. Private ranges need NAT.
Investigation: ip addr for interfaces, ip route for routing, ss -tlnp for listening services.
Testing: ping for connectivity, traceroute for path, dig for DNS queries.