Linux Networking 3 — Questions and Answers
Question 1: What does CIDR notation `/24` indicate about a network?
- The first 24 bits are the network portion (Correct answer)
- There are 24 available hosts
- The subnet has 24 subnets
- The TTL is set to 24
Correct answer: The first 24 bits are the network portion
In CIDR notation, `/24` means 24 bits are used for the network prefix, leaving 8 bits for host addresses (254 usable hosts).
Question 2: Which command would you use to test if a remote host is reachable at the network layer?
- ping (Correct answer)
- curl
- netstat
- nslookup
Correct answer: ping
`ping` sends ICMP echo request packets to test basic connectivity and measure round-trip time to a host.
Question 3: What is the loopback IP address in IPv4?
- 127.0.0.1 (Correct answer)
- 192.168.0.1
- 10.0.0.1
- 0.0.0.0
Correct answer: 127.0.0.1
127.0.0.1 is the IPv4 loopback address (also `localhost`) used by the system to communicate with itself.
Question 4: Which tool scans for open ports and services on a target host?
- nmap (Correct answer)
- dig
- ss
- mtr
Correct answer: nmap
`nmap` (Network Mapper) is a widely-used tool for port scanning, service detection, and network discovery.
Question 5: What does the ARP protocol resolve?
- IP addresses to MAC addresses (Correct answer)
- Hostnames to IP addresses
- MAC addresses to port numbers
- IP addresses to domain names
Correct answer: IP addresses to MAC addresses
ARP (Address Resolution Protocol) maps an IPv4 address to the corresponding hardware (MAC) address on a local network segment.
Question 6: Which `netstat` flag shows only listening sockets?
- -l (Correct answer)
- -a
- -n
- -p
Correct answer: -l
The `-l` flag in `netstat` (or `ss -l`) filters output to display only sockets in the listening state.
Question 7: What is the default gateway's role in a network?
- Routes traffic destined for networks outside the local subnet (Correct answer)
- Assigns IP addresses via DHCP
- Resolves hostnames to IP addresses
- Filters packets using firewall rules
Correct answer: Routes traffic destined for networks outside the local subnet
The default gateway is the router that handles traffic destined for IP addresses not in the local subnet.
What does CIDR notation `/24` indicate about a network?