Exercise: Exploring Network Interfaces and Basic Connectivity
Using Command-Line Tools
1 Purpose
This exercise provides your first hands-on experience with command-line networking tools in a Linux environment. Before you can diagnose complex network problems, you must be able to verify the status of your own machine’s network connection. This exercise walks you through the fundamental commands to inspect your network interfaces, check your IP address, and test connectivity to other devices on the network and the internet.
2 What You’ll Accomplish
By the end of this exercise, you will be able to:
- Use
ip addrto identify network interfaces and their IP addresses. - Use
ip routeto find your default gateway. - Use
pingto test connectivity to your router and to a public internet server. - Install the
mtrtool and use it to map the path to a destination.
This exercise maps to the following program and course learning outcomes:
- Program Learning Outcomes (PLOs):
- 3. Apply terminology and numeric or system concepts: You will use commands that display and require understanding of IP addresses, interfaces, and network routes.
- Course Learning Outcomes (CLOs):
- 3. Troubleshoot hardware and basic network components: Identifying your IP address and testing connectivity are the first steps in any network troubleshooting process.
This exercise develops the following skills, which align with the O*NET SOC Code 15-1232.00 for Computer User Support Specialists.
| Learning Objective | O*NET KSAs | Technologies Used |
|---|---|---|
| Identify local network configuration in Linux. | Knowledge: Telecommunications, Computers & Electronics Abilities: Information Ordering |
ip, ping |
| Test connectivity to local and remote hosts. | Knowledge: Telecommunications Skills: Troubleshooting, Systems Analysis |
mtr |
3 Prerequisites
This exercise requires a running Fedora 42 virtual machine with internet access and a user account with sudo privileges.
4 Step-by-Step Guide
Open a terminal window in your Fedora VM to begin.
4.1 Step 1: List Network Interfaces
The ip addr command (or ip a for short) is used to show all network interfaces on your system and their configuration.
Run the command:
ip addrAnalyze the output. You will see at least two interfaces:
lo: The loopback interface, which always has the IP address127.0.0.1. This is used for the system to talk to itself.- A second interface, likely named
enp1s0or similar. This is your primary Ethernet adapter. Find theinetline under this interface to see your IPv4 address.
In your student notebook, write down the name of your primary network interface and its IPv4 address.
4.2 Step 2: Find Your Default Gateway
The default gateway is your router, the device that connects you to other networks. You can find its address using the ip route command.
Run the command:
ip routeLook for the line that starts with
default via. The IP address listed on this line is the address of your router.
In your notebook, write down the IP address of your default gateway.
4.3 Step 3: Test Local Connectivity
Now you will use the ping command to see if you can communicate with your default gateway.
Run
pingusing the gateway address you found in the previous step. The-c 4flag tells ping to send 4 packets and then stop.# Replace 192.168.1.1 with your gateway address ping -c 4 192.168.1.1If successful, you will see four replies from the gateway. This confirms your local network connection is working.
ping a reliable test?
ping is an excellent first step, but it is not 100% reliable for determining if a host is online. Many firewalls are configured to silently drop ping requests as a basic security measure.
If a ping fails, it could mean the host is offline, or it could simply mean that a firewall is blocking the request. A successful ping proves a host is up, but an unsuccessful ping is not definitive proof that a host is down.
4.4 Step 4: Test Internet Connectivity
Next, test if you can reach a server on the public internet. We’ll use 8.8.8.8, which is a reliable public DNS server run by Google.
Run the
pingcommand again, this time to the public IP:ping -c 4 8.8.8.8Successful replies here confirm that your router is correctly configured and you have a live internet connection.
4.5 Step 5: Install and Use mtr
The mtr command (My Traceroute) is a modern network diagnostic tool that combines the functionality of ping and traceroute into a single, more advanced utility. It may not be installed by default.
Install the
mtrpackage usingdnf:sudo dnf install -y mtrRun
mtrto8.8.8.8. We will use the--reportflag, which sends 10 packets to each hop and generates a single report, similar to the classictraceroutecommand.mtr --report 8.8.8.8Analyze the output. By default,
mtrwill try to look up the hostname for each IP address, which can be slow. The first hop should be your default gateway. Each subsequent line is another router your traffic passes through.mtralso provides useful statistics like packet loss (Loss%) and average latency (Avg) for each hop.To speed up the test or to see only IP addresses, use the
--no-dns(or-n) flag. Run this command now:mtr --report --no-dns 8.8.8.8
In your notebook, write down the IP address of the first two hops in the output from your last command.
5 Reflect and Review
Now that you have completed this exercise, reflect on your experience in your Microsoft Teams Student Notebook:
- 3 key pieces of network information you can find using the
ipcommand. - 2 different destinations you tested with
pingand what each result told you. - 1 question you still have about the output of
mtr.
Answer these questions in your notebook to solidify your understanding:
- What command would you use to find your computer’s IP address in Linux?
- You run
ip addrand see your IP address is169.254.50.100. What does this likely mean? - You can successfully
pingyour default gateway, but you get “Destination Host Unreachable” when you try toping 8.8.8.8. Where is the problem most likely located? - What is the purpose of the
mtrcommand?