This lesson covers fundamental networking concepts in Linux and essential command-line utilities for viewing and managing network configurations. These tools are critical for system administration and troubleshooting network connectivity issues.
Network Communication
Network Interfaces: Hardware or virtual components that allow a computer to connect to a network (like a network card)
Router: A device/server that connects different networks and routes traffic between them
IP Address: A unique numerical identifier assigned to each device on a network (like a home address for computers)
Example Network Setup:
Network A: 192.168.x.x (one subnet)
Network B: 172.16.x.x (another subnet)
Router in middle: Has interfaces on BOTH networks, allowing communication between them
The Loopback Device
What it is: A special virtual network interface that exists on every computer
Purpose: Allows a computer to communicate with itself internally
IPv4 Address: 127.0.0.1
IPv6 Address: ::1
Hostname: Mapped to "localhost"
Use Case: Testing network applications without external network access
ip
Overview:
Modern replacement for deprecated ifconfig and route commands
ifconfig
route
Comprehensive tool for network configuration and management
Uses "objects" to organize different functionalities
Important Limitation: ⚠️ Changes made with ip command are NOT persistent - they disappear after reboot!
To make permanent changes, edit configuration files at:
Debian/Ubuntu: /etc/network/
/etc/network/
SUSE: /etc/sysconfig/network
/etc/sysconfig/network
Red Hat/CentOS: /etc/sysconfig/network-scripts/
/etc/sysconfig/network-scripts/
Or use utilities like nmcli or nmtui
nmcli
nmtui
address
Purpose: Display and manage IP addresses
Commands:
ip address show # Full command
ip address show
# Full command
ip addr show # Medium shorthand
ip addr show
# Medium shorthand
ip a show # Shortest shorthand
ip a show
# Shortest shorthand
ip a # Show all addresses
ip a
# Show all addresses
What You'll See:
Interface name (e.g., ens5, eth0, lo)
ens5
eth0
lo
State: UP or DOWN
Link address: MAC address (hardware address)
inet: IPv4 address
inet6: IPv6 address
Link-local address: Starts with fe80 - automatically configured for IPv6
fe80
Example Output Explained:
1: lo: <LOOPBACK,UP,LOWER_UP>
inet 127.0.0.1/8 # Loopback IPv4
2: ens5: <BROADCAST,MULTICAST,UP>
link/ether aa:bb:cc:dd:ee:ff # MAC address
inet 172.31.127.197/20 # IPv4 address/subnet
inet6 fe80::xxxx/64 # Link-local IPv6
Statistical Information:
ip -s addr # Show with statistics
ip -s addr
# Show with statistics
ip -s a # Shorthand
ip -s a
# Shorthand
Shows packet statistics: received (RX) and transmitted (TX) packets
Adding an IP Address:
sudo ip addr add 172.31.120.80/20 dev ens5
add: Action to perform
add
172.31.120.80/20: IP address with subnet mask (CIDR notation)
172.31.120.80/20
dev ens5: Network device to add it to
dev ens5
Result: Creates a secondary IP address (original becomes primary)
Removing an IP Address:
sudo ip addr del 172.31.120.80/20 dev ens5
link
Purpose: Display and modify network device attributes
ip link show # Show all interfaces
ip link show
# Show all interfaces
ip link # Same as above ip l # Shorthand
ip link
# Same as above
ip l
ip -s link # Show with statistics
ip -s link
Interface names and states
MAC addresses
MTU (Maximum Transmission Unit)
Device flags (UP, DOWN, PROMISC, etc.)
Bringing Interface Up/Down:
sudo ip link set ens5 up # Enable interface
sudo ip link set ens5 up
# Enable interface
sudo ip link set ens5 down # Disable interface
sudo ip link set ens5 down
# Disable interface
⚠️ Warning: Setting your current interface DOWN will disconnect you if remote!
Changing MTU (Maximum Transmission Unit):
sudo ip link set ens5 mtu 8000 # Set MTU to 8000 bytes
sudo ip link set ens5 mtu 8000
# Set MTU to 8000 bytes
MTU: Largest data packet a network device will accept
Default is often 1500 (Ethernet) or 9001 (Jumbo frames)
Promiscuous Mode:
sudo ip link set ens5 promisc on # Enable
sudo ip link set ens5 promisc on
# Enable
sudo ip link set ens5 promisc off # Disable
sudo ip link set ens5 promisc off
# Disable
Promiscuous Mode: Interface accepts ALL packets, not just those addressed to it
Use Case: Network monitoring, packet sniffing, security analysis
Normal Mode: Interface only accepts packets destined for its MAC address
Purpose: Display and manipulate the kernel routing table
ip route show # Display routing table
ip route show
# Display routing table
ip route # Same as above ip r # Shorthand
ip route
ip r
Understanding Routing Table Output:
default via 172.31.0.1 dev ens5 172.31.112.0/20 dev ens5 proto kernel scope link src 172.31.127.197
First Entry Explained:
default via 172.31.0.1: Default gateway (where packets go when no other route matches)
default via 172.31.0.1
dev ens5: Through which interface
Second Entry Explained:
172.31.112.0/20: Destination network
172.31.112.0/20
dev ens5: Send through this interface
proto kernel: Added by kernel
proto kernel
scope link: Direct connection (no gateway needed)
scope link
src 172.31.127.197: Use this source IP
src 172.31.127.197
Routing Table Purpose:
Determines where to send network packets
Like a GPS for network traffic
Default route = "if you don't know where it goes, send it here"
ss
Purpose: Investigate network sockets and view connection statistics
Replaces: The deprecated netstat command
netstat
What are Sockets?
Endpoints for network communication
Combination of IP address + port number
Like a specific door (port) at a specific address (IP)
Common Command:
ss -tulnp
Flag Breakdown:
-t: Show TCP connections
-t
-u: Show UDP connections
-u
-l: Show listening sockets (services waiting for connections)
-l
-n: Don't resolve hostnames (show IP addresses, faster)
-n
-p: Show process using the socket (requires sudo for all processes)
-p
Output Columns Explained:
Netid: Protocol (tcp, udp, etc.)
State: Connection state (LISTEN, ESTAB, UNCONN, etc.)
Recv-Q: Receive queue (data waiting to be processed)
Send-Q: Send queue (data waiting to be sent)
Local Address:Port: Your computer's address and port
Peer Address:Port: Remote computer's address and port
Process: Process name and PID using this socket
Example Output:
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=1234))
Means: SSH daemon (sshd) is listening on port 22 for connections from any IP
Use Cases:
See what services are running and on which ports
Identify which process is using a specific port
Troubleshoot network connectivity issues
Security auditing (find unexpected listening services)
dig
Purpose: Query DNS (Domain Name System) servers to resolve domain names to IP addresses
What is DNS?
Translates human-readable names (google.com) to IP addresses (142.250.80.46)
Like a phone book for the internet
Basic Command:
dig acloudguru.com
Output Sections Explained:
1. Header Section:
Version information
Query flags and response status
2. OPT PSEUDOSECTION:
Advanced/extended DNS data
3. QUESTION SECTION:
Shows what you asked for
;acloudguru.com. IN A
Asking: "What's the A (address) record for acloudguru.com?"
4. ANSWER SECTION (Most Important!)
acloudguru.com. 60 IN A 104.18.32.68
acloudguru.com. 60 IN A 104.18.33.68
Breaking it down:
acloudguru.com: Domain queried
60: TTL (Time To Live) in seconds - how long to cache this answer
IN: Internet class
A: Address record type (IPv4)
104.18.32.68: The actual IP address
Multiple IPs = Load balancing across multiple servers
5. Statistics Section:
Query time, server used, message size
Related Commands:
nslookup: Simpler DNS lookup (less detailed)
nslookup
host: Even simpler, just shows the answer
host
Find IP address of a domain
Troubleshoot DNS issues
Verify DNS propagation
Check mail server (MX) records
Security research
ping
Purpose: Test network connectivity to a host
How it Works:
Sends ICMP ECHO_REQUEST packets to target
Target responds with ICMP ECHO_RESPONSE
Measures round-trip time
Basic Commands:
ping google.com # Ping until stopped (Ctrl+C to stop) ping -c 4 google.com # Send only 4 packets
ping google.com
# Ping until stopped (Ctrl+C to stop)
ping -c 4 google.com
# Send only 4 packets
Output Explained:
PING google.com (142.250.80.46): 56 data bytes 64 bytes from 142.250.80.46: icmp_seq=0 ttl=116 time=12.3 ms 64 bytes from 142.250.80.46: icmp_seq=1 ttl=116 time=11.8 ms 64 bytes from 142.250.80.46: icmp_seq=2 ttl=116 time=12.1 ms
Line by Line:
First line: What you're pinging and its resolved IP
64 bytes: Size of response packet
from 142.250.80.46: IP responding
icmp_seq=0: Sequence number (counts packets)
ttl=116: Time To Live (hops remaining before packet dies)
time=12.3 ms: Round-trip time in milliseconds
Statistics Summary:
--- google.com ping statistics --- 4 packets transmitted, 4 received, 0% packet loss
round-trip min/avg/max/stddev = 11.8/12.1/12.3/0.2 ms
What This Tells You:
Transmitted: Packets sent
Received: Packets that came back
Packet loss: Percentage lost (higher = network problems)
min/avg/max: Fastest/average/slowest times
stddev: Consistency of response times
Interpreting Results:
Replies received: Network path is working
Request timeout: No response (firewall blocking, host down, network issue)
High packet loss: Network instability
High/variable times: Network congestion or distance
Quick connectivity test
Measure latency
Detect packet loss
Troubleshoot network issues
Verify host is up and reachable
Physical or virtual NICs that connect to networks
Have MAC addresses (hardware) and IP addresses (software)
Can be brought up/down, configured with multiple IPs
IPv4: 192.168.1.1 format (32-bit)
IPv6: 2001:db8::1 format (128-bit)
Subnet mask: Defines network size (CIDR notation: /20, /24)
Determines path for network packets
Default gateway: where to send unknown destinations
Routing table: map of network destinations
Port: Number identifying a specific service (22=SSH, 80=HTTP)
Socket: IP address + port combination
Listening: Service waiting for connections
Converts names to IPs
Multiple record types (A, AAAA, MX, CNAME, etc.)
TTL controls caching duration
What is a network interface?
A hardware or virtual component (network card/NIC) that allows a computer to connect to and communicate over a network. It has both a MAC address (hardware) and can be assigned IP addresses (software).
What is the loopback device and what is its purpose?
A special virtual network interface that allows internal communication within a host (computer talking to itself).
IPv4 address: 127.0.0.1
IPv6 address: ::1
Hostname: localhost Used for testing network applications without external network access.
What is a router in networking?
A device or server that connects different networks and routes traffic between them. It has network interfaces on multiple networks, allowing communication between those networks by forwarding packets to the correct destination.
What is an IP address and why is it important?
A unique numerical identifier assigned to each device on a network, similar to a home address. It allows devices to be located and communicated with on a network. Comes in two versions: IPv4 (e.g., 192.168.1.1) and IPv6 (e.g., 2001:db8::1).
What is a MAC address?
The hardware address of a network interface card (NIC), also called the link address. It's a unique identifier burned into the network hardware, typically shown as six pairs of hexadecimal numbers (e.g., aa:bb:cc:dd:ee:ff).
What command does ip replace in modern Linux?
The ip command replaces two deprecated commands:
ifconfig: For interface configuration
route: For routing table management
All their functionality is now consolidated in the ip command.
Are changes made with the ip command persistent across reboots?
NO! Changes made with the ip command are temporary and will be lost when the system reboots. To make permanent changes, you must edit network configuration files or use tools like nmcli or nmtui.
Where are network configuration files located on different Linux distributions?
Red Hat/CentOS/Fedora: /etc/sysconfig/network-scripts/
What are the three main objects used with the ip command?
address (or addr, a): Manages IP addresses
link (or l): Manages device attributes
route (or r): Manages routing table
What does the ip command use "objects" for?
Objects organize different functionalities of the ip command. Each object (address, link, route, etc.) handles a specific aspect of networking, making the command modular and organized. You use: ip [object] [command]
ip [object] [command]
What command shows all IP addresses on the system?
ip address show # Full form
# Full form
ip a show # Short form
# Short form
ip a # Shortest
# Shortest
What information does ip address show display?
Interface names (lo, ens5, eth0, etc.)
Interface state (UP or DOWN)
MAC address (link/ether)
IPv4 address (inet)
IPv6 address (inet6)
Subnet masks (CIDR notation)
Link-local addresses
How do you show IP address information with statistics?
ip -s address show
The -s flag adds packet statistics showing received (RX) and transmitted (TX) packets.
-s
What is a link-local IPv6 address and how do you identify it?
A link-local address is an IPv6 address automatically configured for interfaces that support IPv6. It's only valid on the local network segment.
Identifier: Starts with fe80::
fe80::
Purpose: Local network communication without manual configuration
Example: fe80::a00:27ff:fe4e:66a1/64
How do you add a secondary IP address to an interface?
172.31.120.80/20: IP with subnet (CIDR notation)
dev ens5: Device/interface name Creates a secondary IP (original becomes primary).
How do you remove an IP address from an interface?
Replace add with del and specify the IP address and device to remove it.
del
What is the difference between primary and secondary IP addresses?
Primary: The first/original IP address assigned to an interface
Secondary: Additional IP addresses added to the same interface
An interface can have one primary and multiple secondary addresses. In ip a output, secondaries are labeled as such.
What does CIDR notation (/20, /24) mean in IP addresses?
CIDR (Classless Inter-Domain Routing) notation indicates the subnet mask by specifying how many bits are used for the network portion:
/20: First 20 bits are network, remaining 12 are host (4,096 addresses)
/20
/24: First 24 bits are network, remaining 8 are host (256 addresses)
/24
/32: Single host address
/32
What is the ip link command used for?
To display and modify network device attributes including:
View interface states (UP/DOWN)
View MAC addresses
Change MTU (Maximum Transmission Unit)
Enable/disable promiscuous mode
Bring interfaces up or down
How do you view network interfaces with ip link?
ip link show # Full form
ip link # Short form
ip l # Shortest
ip -s link # With statistics
# With statistics
How do you bring a network interface up or down?
sudo ip link set ens5 up # Bring interface up (enable)
# Bring interface up (enable)
sudo ip link set ens5 down # Bring interface down (disable)
# Bring interface down (disable)
⚠️ Warning: Don't disable the interface you're connected through remotely!
What is MTU and how do you change it?
MTU (Maximum Transmission Unit): The largest data packet (in bytes) that a network device will accept.
sudo ip link set ens5 mtu 8000 # Set to 8000 bytes
# Set to 8000 bytes
Common values: 1500 (standard Ethernet), 9001 (jumbo frames)
Lower MTU = more packets, more overhead
Higher MTU = fewer packets, more efficient (if supported)
What is promiscuous mode and when is it used?
Promiscuous mode: Makes the network interface accept ALL packets on the network, not just those addressed to it.
Use cases:
Network monitoring and analysis
Packet sniffing/capture (Wireshark, tcpdump)
Security analysis
Network troubleshooting
How can you tell if an interface is in promiscuous mode?
Run ip link show and look for PROMISC in the interface flags:
PROMISC
2: ens5: <BROADCAST,MULTICAST,PROMISC,UP>
If you see PROMISC in the angle brackets, promiscuous mode is enabled.
What does the ip route command show?
Displays the kernel routing table, which determines where network packets are sent. Shows:
Default gateway
Network routes
Which interface to use for each destination
Source addresses for routes
What is a default gateway?
The default route where packets are sent when no other specific route applies. It's the "gateway" to other networks (usually the internet).
default via 172.31.0.1 dev ens5
Means: "If you don't know where to send it, send it to 172.31.0.1 through ens5"
How do you view the routing table?
ip route show # Full form
ip route # Short form
ip r # Shortest
Interpret this routing table entry: 172.31.112.0/20 dev ens5 proto kernel scope link src 172.31.127.197
172.31.112.0/20 dev ens5 proto kernel scope link src 172.31.127.197
dev ens5: Send through interface ens5
proto kernel: Route added by kernel automatically
scope link: Direct connection, no gateway needed
src 172.31.127.197: Use this as source IP address
Means: Traffic to 172.31.112.0/20 network goes directly through ens5 interface.
The routing table determines the path for network packets to reach their destination. Like a GPS for network traffic, it tells the system:
Which interface to use
Which gateway to send packets through
Which networks are directly connected
Where to send packets by default
What does the ss command do?
Investigates network sockets and displays socket statistics, showing:
Active connections
Listening services
Which ports are in use
Which processes are using sockets Replaces the deprecated netstat command.
What is a network socket?
An endpoint for network communication, consisting of:
IP address + Port number
Like a specific door (port) at a specific address (IP). Example: 192.168.1.1:80 means port 80 at IP 192.168.1.1.
What does ss -tulnp show and what does each flag mean?
-t: TCP connections
-u: UDP connections
-l: Listening sockets (services waiting for connections)
-n: Don't resolve hostnames (show IPs, faster)
-p: Show process using socket (needs sudo for all processes)
Shows all listening TCP/UDP services with their processes.
Interpret this ss output: tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=1234))
tcp: Protocol is TCP
LISTEN: State - waiting for connections
0: Receive queue size
128: Send queue size
0.0.0.0:22: Listening on all IPs, port 22
0.0.0.0:*: Accepting from any IP, any port
users: Process sshd with PID 1234
Means: SSH daemon is listening on port 22 for connections from anywhere.
What are the common socket states shown by ss?
LISTEN: Waiting for incoming connections
ESTAB (ESTABLISHED): Active connection
UNCONN (UNCONNECTED): UDP socket not connected
TIME-WAIT: Connection closing, waiting for timeout
CLOSE-WAIT: Remote end closed, local waiting to close
What is the difference between TCP and UDP?
TCP (Transmission Control Protocol):
Connection-oriented (establishes connection first)
Reliable (guarantees delivery, retransmits lost packets)
Ordered (packets arrive in sequence)
Examples: HTTP, SSH, FTP
UDP (User Datagram Protocol):
Connectionless (no connection setup)
Unreliable (no delivery guarantee)
Unordered (packets may arrive out of order)
Faster, less overhead
Examples: DNS, streaming, gaming
What are common use cases for the ss command?
See what services/ports are listening
Find established connections
Troubleshoot "port already in use" errors
Security auditing (find unexpected services)
Monitor network activity
Why would you use -n flag with ss?
The -n flag prevents hostname resolution (DNS lookups), showing raw IP addresses instead of names. This makes the command:
Faster: No DNS lookups needed
More reliable: Works even if DNS is broken
More precise: Shows actual IPs, not potentially cached names
What is DNS and why is it important?
DNS (Domain Name System): Translates human-readable domain names (google.com) to IP addresses (142.250.80.46) that computers use.
Allows using memorable names instead of numbers
Essential for internet functionality
What does the dig command do?
Performs DNS lookups to query DNS servers and resolve domain names to IP addresses. Shows detailed information about DNS records including:
IP addresses for domains
Mail servers (MX records)
Name servers (NS records)
TTL (caching duration)
Query timing and statistics
What is the most important section in dig output?
The ANSWER SECTION - this contains the actual DNS resolution result (the IP address for the domain you queried).
;; ANSWER SECTION:
Interpret this dig ANSWER: acloudguru.com. 60 IN A 104.18.32.68
acloudguru.com.: Domain queried (dot at end is root)
60: TTL (Time To Live) - cache this for 60 seconds
IN: Internet class (standard)
A: Address record type (IPv4 address)
Means: acloudguru.com resolves to 104.18.32.68, cache for 60 seconds.
What is TTL in DNS context?
TTL (Time To Live): Duration (in seconds) that a DNS record should be cached before checking again.
Low TTL (60s): Frequently updated, less caching
High TTL (86400s/1 day): Stable records, more caching
Reduces DNS server load
Affects how quickly DNS changes propagate
What does it mean when dig shows multiple IP addresses for one domain?
Multiple IPs indicate load balancing - traffic is distributed across multiple servers:
Benefits:
Distribute traffic load
Provide redundancy (if one server fails)
Improve performance
Increase capacity
What are the main sections in dig output?
Header: Version, flags, response status
OPT PSEUDOSECTION: Extended DNS data
QUESTION SECTION: What you asked for
ANSWER SECTION: The response (most important)
Statistics: Query time, server used, message size
What is an A record in DNS?
An A (Address) record maps a domain name to an IPv4 address. It's the most common DNS record type.
Example: google.com → 142.250.80.46
For IPv6, use AAAA record instead
What are alternative commands to dig?
nslookup: Simpler DNS lookup, less detailed
dig: Most detailed, best for troubleshooting
For LFCA, focus on dig as it's most comprehensive.
When would you use the dig command?
Troubleshoot DNS resolution issues
Verify DNS propagation after changes
Investigate DNS configuration
Security research (identify hosting)
Diagnose website connectivity problems
hat does the ping command do?
Tests network connectivity to a host by:
Sending ICMP ECHO_REQUEST packets to target
Measures round-trip time (latency)
Confirms if a host is reachable and measures connection quality.
What is ICMP?
ICMP (Internet Control Message Protocol): A network protocol used for diagnostic and error messages.
Not used for data transfer
Used by ping and traceroute
traceroute
Reports errors (host unreachable, network down)
Tests connectivity
Works at network layer (Layer 3)
How do you use the ping command?
ping google.com # Ping until stopped (Ctrl+C)
# Ping until stopped (Ctrl+C)
ping -c 4 google.com # Send only 4 packets (-c = count)
# Send only 4 packets (-c = count)
ping 8.8.8.8 # Ping IP address directly
ping 8.8.8.8
# Ping IP address directly
Interpret this ping output: 64 bytes from 142.250.80.46: icmp_seq=0 ttl=116 time=12.3 ms
64 bytes from 142.250.80.46: icmp_seq=0 ttl=116 time=12.3 ms
64 bytes: Size of response packet received
from 142.250.80.46: IP address that responded
icmp_seq=0: Sequence number (packet counter, starts at 0)
ttl=116: Time To Live - hops remaining (started at 128 or 255)
time=12.3 ms: Round-trip time - 12.3 milliseconds
Means: Successfully received response in 12.3ms from that IP.
What does TTL mean in ping output?
TTL (Time To Live): Number of network hops (routers) a packet can pass through before being discarded.
Each router decrements TTL by 1
When TTL reaches 0, packet is dropped
High TTL (116): Many hops remaining, far from timeout
Low TTL (1-5): Close to expiring, many hops already traversed
Helps prevent infinite routing loops
What do ping statistics tell you?
4 packets transmitted, 4 received, 0% packet loss
Received: Packets that returned
Packet loss: Percentage lost (0% = perfect, >5% = problems)
min: Fastest response time
avg: Average response time
max: Slowest response time
stddev: Standard deviation (consistency measure)
What does "Request timeout" mean in ping?
No response received from target. Possible causes:
Host is down: Target computer is off or crashed
Firewall blocking: ICMP packets being filtered
Network issue: Routing problem, cable unplugged
Wrong IP: Pinging non-existent address
ICMP disabled: Target configured not to respond
Doesn't always mean host is down - could be firewall!
What is packet loss and what does it indicate?
Packet loss: Percentage of packets sent that don't receive a response.
0%: Perfect connection
1-5%: Acceptable, minor issues
5-10%: Noticeable problems, needs investigation
>10%: Serious network issues
100%: Complete communication failure
Causes: Network congestion, faulty hardware, poor wireless signal, routing issues.
What is a good ping time?
Depends on distance and connection:
<1 ms: Same local network (excellent)
1-30 ms: Same city/region (excellent)
30-50 ms: Same country (good)
50-100 ms: Different country (acceptable)
100-200 ms: International (acceptable for some uses)
>200 ms: High latency (noticeable lag)
Lower is always better, especially for gaming/video calls.
Why would you ping by IP address vs domain name?
Ping by domain (ping google.com):
Tests both DNS resolution AND connectivity
More realistic (how users access sites)
Ping by IP (ping 8.8.8.8):
Tests only connectivity
Bypasses DNS (useful if DNS is suspected issue)
Faster (no DNS lookup delay)
If domain fails but IP works: DNS problem!
How do you stop a ping command?
Press Ctrl+C (Control key + C key simultaneously). This sends an interrupt signal, stops the ping, and displays statistics summary.
What does high standard deviation in ping times indicate?
High stddev: Inconsistent response times (jitter).
round-trip min/avg/max/stddev = 10/50/200/85 ms # High variance!
Network instability
Intermittent congestion
Variable routing paths
Wi-Fi interference
Low stddev: Consistent, stable connection (desirable).
When should you use ping for troubleshooting?
Use ping to:
Verify connectivity: Can you reach the host?
Measure latency: How fast is the connection?
Detect packet loss: Is connection stable?
Test DNS: Domain name vs IP address
Identify network issues: Where does connectivity break?
Baseline performance: Normal vs problematic times
First step in most network troubleshooting!
You need to add a second IP address to eth0. What command?
sudo ip addr add 192.168.1.100/24 dev eth0
Remember: This is temporary and lost on reboot. For permanent, edit config files.
How do you check if a service is listening on port 80?
sudo ss -tulnp | grep :80
Or specifically for TCP:
sudo ss -tlnp | grep :80
Will show if anything is listening on port 80 and which process.
A server isn't responding. What's your troubleshooting order using these commands?
ping server.com: Can you reach it at all?
ping server.com
ping IP_ADDRESS: If domain fails but IP works = DNS issue
ping IP_ADDRESS
dig server.com: Verify DNS resolution
dig server.com
ip route: Check routing table
ip link: Verify interface is UP
ss -tulnp: Check if service is actually listening
Systematic approach from basic to specific!
How do you find which process is using port 8080?
sudo ss -tulnp | grep :8080
Or more specifically:
sudo ss -tlnp | grep :8080
The output will show the process name and PID in the last column.
Interface eth0 shows DOWN. How do you bring it up?
sudo ip link set eth0 up
Verify with:
ip link show eth0
Look for <UP> in the output.
<UP>
How do you verify DNS is working correctly?
Test DNS lookup:
dig google.com
Check if you get IP addresses in ANSWER section.
Compare with known good DNS:
dig @8.8.8.8 google.com # Use Google's DNS
dig @8.8.8.8 google.com
# Use Google's DNS
Test reverse lookup:
dig -x 8.8.8.8
If local dig fails but @8.8.8.8 works: Your DNS server is the problem.
You can ping google.com but can't browse websites. What's likely wrong?
Since ping works:
Network connectivity: OK ✓
DNS: OK ✓ (ping resolved domain)
Likely issues:
Firewall blocking HTTP/HTTPS (ports 80/443)
Web browser problem
Proxy configuration issue
Check: Can you telnet google.com 80 or use curl http://google.com?
telnet google.com 80
curl http://google.com
How do you check your default gateway?
ip route | grep default
Or:
ip r | grep default
Output will show:
default via 192.168.1.1 dev eth0
The IP after "via" is your default gateway.
You need to see ALL interfaces, even those that are down. Which command?
Or
Both show all interfaces regardless of state. Look for state UP or DOWN in the output.
How do you find your system's hostname and IP address quickly?
Hostname:
hostname
IP address:
ip a | grep inet
Or more specific:
ip -4 addr show scope global # IPv4 only
ip -4 addr show scope global
# IPv4 only
Combined info:
hostname -I # Shows all IP addresses
hostname -I
# Shows all IP addresses
What networking commands should you memorize for LFCA?
Essential commands:
ip a - View IP addresses
ip link - View/manage interfaces
ip route - View routing table
ss -tulnp - View listening services
dig domain.com - DNS lookup
dig domain.com
ping host - Test connectivity
ping host
Key flags:
-s for statistics
-4 for IPv4 only
-4
-6 for IPv6 only
-6
What's the difference between ip addr and ip link?
ip addr
ip addr:
Shows IP addresses (IPv4 and IPv6)
Network layer (Layer 3)
Includes subnet information
Shows inet and inet6 entries
ip link:
Shows interface states and MAC addresses
Data link layer (Layer 2)
Shows physical interface status (UP/DOWN)
Shows link/ether (MAC) addresses
No IP address information
Think: link = hardware, addr = network configuration.
When troubleshooting, should you use domain names or IP addresses first?
Start with IP addresses if you suspect DNS issues:
Ping by IP: Tests pure connectivity
If IP works but domain fails: DNS problem
If both fail: Network connectivity problem
Start with domain names for general testing:
Tests the whole chain (DNS + connectivity)
More realistic (how services are actually accessed)
Rule of thumb: Use IPs to isolate DNS issues
Why might ping work but a service still be unreachable?
Ping uses ICMP; services use TCP/UDP. Different protocols can be blocked separately:
Firewall: Allows ICMP but blocks specific ports
Service down: Host is up but service isn't running
Port filtering: Router/firewall blocking application ports
Service binding: Service listening on wrong interface/IP
Check with: ss -tulnp | grep port_number
ss -tulnp | grep port_number
What's the quickest way to see if port 22 (SSH) is open and listening?
sudo ss -tlnp | grep :22
If you see output with LISTEN state, SSH is listening.
No output = either:
SSH not running
Running on different port
Not listening on queried interface
How can you tell if you're using IPv4 or IPv6?
In ip a output:
inet: IPv4 address (e.g., 192.168.1.1)
inet
inet6: IPv6 address (e.g., 2001:db8::1)
inet6
IPv4: Four numbers separated by dots (192.168.1.1) IPv6: Eight groups of hex separated by colons (2001:db8::1)
Most systems have both configured (dual-stack).
What does "scope link" mean in ip address output?
Scope link: Address is only valid on the local network link (local network segment).
Link-local addresses (169.254.x.x for IPv4, fe80:: for IPv6)
Can't be routed beyond local network
Automatically configured
Used for local network communication only
vs scope global: Routable address, can communicate anywhere.
What's the practical difference between dig and ping for testing domain names?
dig domain.com:
ONLY tests DNS resolution
Shows what IP the domain resolves to
Shows DNS server response
No connectivity test
ping domain.com:
ping domain.com
Tests BOTH DNS resolution AND connectivity
Verifies you can actually reach the host
Measures response time
Use dig when you only care about DNS; use ping for full connectivity test.
What information should you gather when reporting a network issue?
Interface status: ip link show
IP configuration: ip addr show
Routing table: ip route
Connectivity test: ping gateway and ping 8.8.8.8
ping gateway
DNS test: dig problem-domain.com
dig problem-domain.com
Service status: ss -tulnp for relevant ports
This systematic information helps diagnose root cause quickly.
What's the significance of 0.0.0.0 vs 127.0.0.1 vs specific IP in socket listings?
0.0.0.0:port or *:port:
0.0.0.0:port
*:port
Listening on ALL interfaces
Accepts connections from any IP
127.0.0.1:port:
127.0.0.1:port
Only listening on loopback
Only local connections accepted
Not accessible from network
192.168.1.10:port (specific IP):
192.168.1.10:port
Only listening on that specific interface/IP
Only accepts connections to that IP
Security: Use 127.0.0.1 for local-only services, 0.0.0.0 for public services.
You made changes with ip addr add but they're gone after reboot. Why?
ip addr add
ip command changes are NOT persistent! They're lost on reboot. This is by design for safety.
To make permanent:
Edit network config files directly, OR
Use nmcli or nmtui tools
Temporary = ip command Permanent = config files
Why doesn't ss show all processes when run as normal user?
Process information for sockets owned by other users requires elevated privileges.
As normal user: Only see your own processes With sudo: See all processes system-wide
Always use: sudo ss -tulnp for complete information.
sudo ss -tulnp
You ran ip link set eth0 down remotely and got disconnected. What happened?
ip link set eth0 down
You disabled the network interface you were connected through!
ip link set eth0 down disables the interface
If you're connected via eth0 (SSH, etc.), you lose connection
Can only fix with physical/console access
Prevention: NEVER disable your active connection interface remotely!
Ping shows 0% packet loss but very high times (500+ ms). Is this okay?
No! While technically "working," this indicates serious problems:
Severe network congestion
Overloaded router/server
Very long physical distance (satellite)
QoS deprioritization
Failing network equipment
Applications will be very slow or timeout. Investigate cause immediately.
dig shows correct IP but ping to domain name fails. What's wrong?
Possible causes:
DNS caching: Ping using old cached DNS, dig queries fresh
Multiple IPs: dig shows different IP than ping is using
Firewall: Blocking ICMP but not DNS
Recent DNS change: Propagation in progress
Solution:
Clear DNS cache
Ping the specific IP from dig
Wait for full DNS propagation
Why does ip a show an IPv6 address you didn't configure?
Link-local IPv6 addresses (starting with fe80::) are automatically configured on IPv6-enabled interfaces:
No manual configuration needed
Always present on IPv6 interfaces
Used for local network communication
Normal and expected behavior
Not a problem - this is how IPv6 works by design.
Service won't start saying "port already in use." How to find what's using it?
sudo ss -tulnp | grep :port_number
Example for port 80:
Shows process and PID using that port.
Then decide: kill that process or configure service on different port.
You can ping gateway but not external IPs. What's the issue?
Can ping gateway: Local network works ✓ Can't ping external: Routing/gateway issue ✗
Likely problems:
Gateway not routing: Gateway isn't forwarding packets
No default route: Check ip route for default entry
Firewall on gateway: Blocking outbound traffic
ISP issue: Internet connection down
Check: ip route to verify default gateway exists.
MTU is set to 9001 but you're having packet issues. Why?
MTU mismatch: Your MTU (9001 - jumbo frames) is larger than what network supports (usually 1500).
Results in:
Packet fragmentation
Dropped packets
Connection issues
Solution: Set MTU to match network:
sudo ip link set eth0 mtu 1500
Rule: MTU must match or be smaller than network supports.
How do you know which network interface is your primary/main one?
Check routing table for default route:
Output:
The interface after "dev" (eth0) is your primary/main interface used for internet.
Quick command reference for common tasks - viewing info
ip a # View all IP addresses
# View all IP addresses
ip link # View all interfaces
# View all interfaces
ip route # View routing table
# View routing table
ip -s link # Interface statistics
# Interface statistics
ss -tulnp # All listening services
# All listening services
dig domain.com # DNS lookup
# DNS lookup
ping host # Test connectivity
# Test connectivity
hostname -I # Show system IPs
# Show system IPs
Quick command reference - making changes
sudo ip addr add IP/mask dev interface # Add IP
sudo ip addr add IP/mask dev interface
# Add IP
sudo ip addr del IP/mask dev interface # Remove IP
sudo ip addr del IP/mask dev interface
# Remove IP
sudo ip link set interface up # Enable interface
sudo ip link set interface up
sudo ip link set interface down # Disable interface
sudo ip link set interface down
sudo ip link set interface mtu SIZE # Change MTU
sudo ip link set interface mtu SIZE
# Change MTU
sudo ip link set interface promisc on/off # Promiscuous mode
sudo ip link set interface promisc on/off
# Promiscuous mode
Remember: All temporary until reboot!
Troubleshooting command sequence for network issues
1. ip link # Is interface UP?
1. ip link
# Is interface UP?
2. ip addr # Does it have an IP?
2. ip addr
# Does it have an IP?
3. ip route # Is there a default route?
3. ip route
# Is there a default route?
4. ping gateway_ip # Can reach gateway?
4. ping gateway_ip
# Can reach gateway?
5. ping 8.8.8.8 # Can reach internet?
5. ping 8.8.8.8
# Can reach internet?
6. ping domain.com # Does DNS work?
6. ping domain.com
# Does DNS work?
7. dig domain.com # DNS resolution details
7. dig domain.com
# DNS resolution details
8. ss -tulnp | grep :port # Is service listening?
8. ss -tulnp | grep :port
# Is service listening?
Key IP addressing concepts to remember
127.0.0.1: Loopback (localhost)
0.0.0.0: All interfaces/any address
169.254.x.x: Link-local (autoconfigured, no DHCP)
192.168.x.x, 10.x.x.x, 172.16-31.x.x: Private IPs
fe80::: IPv6 link-local
::1: IPv6 loopback
Important port numbers to know
22: SSH
80: HTTP (web)
443: HTTPS (secure web)
53: DNS
25: SMTP (email)
3306: MySQL
5432: PostgreSQL
6379: Redis
For LFCA, especially know: 22 (SSH), 80 (HTTP), 443 (HTTPS), 53 (DNS)
What does each layer test?
Layer 2 (Link): ip link - Hardware/interface level
Layer 3 (Network): ip addr, ip route, ping - IP addressing/routing
Layer 4 (Transport): ss - TCP/UDP ports and connections
Layer 7 (Application): dig - DNS (application protocol)
Troubleshoot bottom-up: link → IP → routing → services.
Red flags in networking output that indicate problems
Interface state DOWN: ip link shows <DOWN>
<DOWN>
No IP address: ip a shows no inet entry
No default route: ip route has no default entry
100% packet loss: ping shows all packets lost
No LISTEN state: ss shows no service on expected port
NXDOMAIN: dig shows domain doesn't exist
High packet errors: ip -s link shows many errors
Request timeout: No response to ping
How to remember ip command syntax?
Format: ip [OPTIONS] OBJECT COMMAND
ip [OPTIONS] OBJECT COMMAND
Objects (what to manage):
address (a): IP addresses
link (l): Interfaces/devices
route (r): Routing table
Commands (what to do):
show: Display info
add: Add entry
del: Delete entry
set: Modify entry
Example: ip addr add = manage address, add entry
Most common LFCA exam scenarios for networking
View network config: ip a, ip link, ip route
Test connectivity: ping, verify response
Check services: ss -tulnp, identify listening ports
DNS troubleshooting: dig, verify resolution
Add/remove IPs: ip addr add/del
ip addr add/del
Interface management: ip link set up/down
ip link set up/down
Identify network issues: Systematic troubleshooting
Practice these scenarios repeatedly!
Final exam checklist - what you must know cold
✓ ip a - view IPs
✓ ip link - view interfaces
✓ ip route - view routes
✓ ss -tulnp - view services/ports
✓ dig domain - DNS lookup
dig domain
✓ ping host - test connectivity
✓ Loopback = 127.0.0.1/::1
✓ Changes with ip are temporary
✓ Config files location for each distro
✓ Troubleshooting methodology
✓ Interpret command output
✓ Understand common port numbers
Master these and you're ready!
Viewing:
Show all IPs: ip a
Show interfaces: ip link
Show routes: ip route
Show listening services: sudo ss -tulnp
DNS lookup: dig domain.com
Test connectivity: ping host
Modifying:
Add IP: sudo ip addr add IP/mask dev interface
Remove IP: sudo ip addr del IP/mask dev interface
Interface up: sudo ip link set interface up
Interface down: sudo ip link set interface down
Troubleshooting:
Test gateway: ping $(ip route | grep default | awk '{print $3}')
ping $(ip route | grep default | awk '{print $3}')
Find process on port: sudo ss -tulnp | grep :PORT
sudo ss -tulnp | grep :PORT
Check DNS: dig +short domain.com
dig +short domain.com
Quick connectivity: ping -c 4 8.8.8.8
ping -c 4 8.8.8.8
Last changeda month ago