Quiz Module 7 - Network and Configuration
Instructions
This quiz contains 30 multiple-choice questions to validate your understanding of Module 7.
Tip: Answer each question before revealing the answer. The answers are hidden just after each question.
Question 1
Which command allows you to see network interfaces on Ubuntu 24.04?
See explanation
Correct answer: ip addr or ip a
Explanation: ip addr or ip a displays network interfaces and their IP addresses. It is the recommended modern command. ifconfig is still available but deprecated. On Ubuntu 24.04, netplan is also used for configuration.
Question 2
Which file configures the network on Ubuntu 24.04 with netplan?
See explanation
Correct answer: /etc/netplan/*.yaml
Explanation: On Ubuntu 24.04, network configuration is done with netplan in /etc/netplan/*.yaml. After modification, apply with sudo netplan apply. The old system /etc/network/interfaces is replaced by netplan.
Question 3
Which command allows you to test network connectivity?
See explanation
Correct answer: ping
Explanation: ping tests network connectivity by sending ICMP packets. Examples: ping google.com, ping -c 4 8.8.8.8 (4 packets), ping -i 2 google.com (2-second interval). Ctrl+C to stop.
Question 4
Which command allows you to see the routing table?
See explanation
Correct answer: ip route or route -n
Explanation: ip route or ip r displays the routing table (modern command). route -n does the same (old command). The table shows how packets are routed to different destinations.
Question 5
Which file contains the local DNS configuration?
See explanation
Correct answer: /etc/resolv.conf
Explanation: /etc/resolv.conf contains DNS servers. Format: nameserver 8.8.8.8. On Ubuntu 24.04 with systemd-resolved, this file can be managed automatically. Use resolvectl to see the current configuration.
Question 6
Which command allows you to resolve a domain name to an IP address?
See explanation
Correct answer: nslookup or dig
Explanation: nslookup domain.com and dig domain.com resolve a domain name to an IP address. dig is more modern and provides more information. host domain.com also performs a simple DNS resolution.
Question 7
Which command allows you to see active network connections?
See explanation
Correct answer: netstat or ss
Explanation: netstat -tuln displays network connections (old command). ss -tuln does the same (modern command, faster). Options: -t (TCP), -u (UDP), -l (listening), -n (numbers instead of names).
Question 8
Which command allows you to trace the path of a packet to a destination?
See explanation
Correct answer: traceroute
Explanation: traceroute destination traces the path of packets to a destination, showing each router (hop) crossed. tracepath is an alternative. On Ubuntu, traceroute may require installation: sudo apt install traceroute.
Question 9
Which command allows you to see open ports on a system?
See explanation
Correct answer: ss -l or netstat -l
Explanation: ss -l or netstat -l displays listening ports. ss -tuln shows all TCP/UDP listening ports with numbers. lsof -i can also show open ports by process.
Question 10
Which file contains the local name resolution (hosts)?
See explanation
Correct answer: /etc/hosts
Explanation: /etc/hosts contains local name resolution. Format: IP name. Example: 127.0.0.1 localhost. This file is consulted before DNS. Useful for testing or blocking domains.
Question 11
Which command allows you to configure an IP address on an interface?
See explanation
Correct answer: ip addr add or netplan
Explanation: sudo ip addr add 192.168.1.10/24 dev eth0 configures an IP temporarily. To make the change permanent, use netplan: edit /etc/netplan/*.yaml then sudo netplan apply. ifconfig can also be used but is deprecated.
Question 12
Which command allows you to see network statistics?
See explanation
Correct answer: ip -s link or ifconfig
Explanation: ip -s link displays network interface statistics (packets sent/received, errors). ifconfig also displays statistics. ip -s -s link shows more details.
Question 13
Which command allows you to see the system's hostname?
See explanation
Correct answer: hostname
Explanation: hostname displays the system's hostname. hostname new-name changes the name (temporary). To make the change permanent, edit /etc/hostname and restart or use hostnamectl set-hostname new-name.
Question 14
Which command allows you to scan open ports on a remote host?
See explanation
Correct answer: nmap
Explanation: nmap scans open ports on a host. Examples: nmap localhost, nmap -p 80,443 example.com, nmap -p- 192.168.1.1 (all ports). Requires installation: sudo apt install nmap. Use ethically only!
Question 15
Which command allows you to see processes using a specific port?
See explanation
Correct answer: lsof -i :port or ss -tulpn
Explanation: lsof -i :80 shows the process using port 80. ss -tulpn shows all ports with process PIDs. -p displays PIDs, -n avoids DNS resolution.
Question 16
Which command allows you to add a static route?
See explanation
Correct answer: ip route add or route add
Explanation: sudo ip route add 192.168.2.0/24 via 192.168.1.1 adds a route. sudo route add -net 192.168.2.0/24 gw 192.168.1.1 (old syntax). To make the change permanent, configure in netplan or /etc/network/interfaces.
Question 17
Which command allows you to see the default gateway?
See explanation
Correct answer: ip route | grep default or route -n
Explanation: ip route | grep default or ip route show default displays the default route (gateway). route -n | grep "^0.0.0.0" does the same. The gateway is the router's IP address.
Question 18
Which command allows you to test TCP connectivity to a specific port?
See explanation
Correct answer: telnet or nc (netcat)
Explanation: telnet host port tests TCP connectivity. nc -zv host port (netcat) does the same in a more modern way. -z = scan only, -v = verbose. Example: nc -zv google.com 80.
Question 19
Which command allows you to see detailed information about a network interface?
See explanation
Correct answer: ip link show or ifconfig
Explanation: ip link show or ip link show eth0 displays detailed information about an interface (state, MTU, MAC, etc.). ifconfig eth0 does the same. ip link lists all interfaces.
Question 20
Which command allows you to enable or disable a network interface?
See explanation
Correct answer: ip link set up/down or ifconfig up/down
Explanation: sudo ip link set eth0 up enables an interface, sudo ip link set eth0 down disables it. sudo ifconfig eth0 up/down does the same. Useful for reconfiguring the network.
Question 21
Which command allows you to see the current DNS configuration?
See explanation
Correct answer: resolvectl status or cat /etc/resolv.conf
Explanation: resolvectl status displays the DNS configuration of systemd-resolved (Ubuntu 24.04). cat /etc/resolv.conf shows configured DNS servers. systemd-resolve --status is the old command.
Question 22
Which command allows you to see files opened by a network process?
See explanation
Correct answer: lsof -i
Explanation: lsof -i lists all open network files (connections). lsof -i :80 shows connections on port 80. lsof -iTCP -sTCP:LISTEN shows only listening ports. Sometimes requires sudo.
Question 23
Which command allows you to see the MAC address of an interface?
See explanation
Correct answer: ip link show or ifconfig
Explanation: ip link show eth0 displays the MAC address (ether). ifconfig eth0 also shows the MAC address. The MAC address is the unique identifier of the network interface at the hardware level.
Question 24
Which command allows you to test reverse DNS resolution (IP to name)?
See explanation
Correct answer: dig -x or nslookup
Explanation: dig -x 8.8.8.8 performs a reverse DNS resolution (PTR record). nslookup 8.8.8.8 does the same. This converts an IP address to a domain name.
Question 25
Which command allows you to see routing statistics?
See explanation
Correct answer: ip -s route or netstat -s
Explanation: ip -s route displays routing statistics. netstat -s shows global network statistics (TCP, UDP, ICMP, etc.). Useful for diagnosing routing issues.
Question 26
Which command allows you to see established connections to a specific port?
See explanation
Correct answer: ss -tn sport = :port or netstat -tn
Explanation: ss -tn sport = :80 shows TCP connections to port 80. netstat -tn | grep :80 does the same. -t = TCP, -n = numbers, sport = source port, dport = destination port.
Question 27
Which command allows you to see the complete network configuration of an interface?
See explanation
Correct answer: ip addr show dev eth0 or ifconfig eth0
Explanation: ip addr show dev eth0 or ip a show eth0 displays the complete configuration of an interface: IP addresses, mask, broadcast, state. ifconfig eth0 does the same with a different format.
Question 28
Which command allows you to see processes listening on network ports?
See explanation
Correct answer: ss -tulpn or netstat -tulpn
Explanation: ss -tulpn displays all listening ports with processes. -t = TCP, -u = UDP, -l = listening, -p = processes, -n = numbers. netstat -tulpn does the same.
Question 29
Which command allows you to see the MTU (Maximum Transmission Unit) of an interface?
See explanation
Correct answer: ip link show or ifconfig
Explanation: ip link show eth0 displays the MTU of the interface. ifconfig eth0 also shows the MTU. The default MTU is generally 1500 for Ethernet. It can be modified with sudo ip link set eth0 mtu 9000.
Question 30
Which command allows you to apply netplan configuration on Ubuntu 24.04?
See explanation
Correct answer: netplan apply
Explanation: sudo netplan apply applies the netplan configuration from /etc/netplan/*.yaml. sudo netplan try tests the configuration with a timeout (reverts if not confirmed). sudo netplan generate generates the configuration without applying it.
Quiz Result
Congratulations on completing the Module 7 quiz!
Score:
- 25-30 correct answers: Excellent! You master Linux network configuration.
- 20-24 correct answers: Very good! Review the concepts where you had difficulties.
- 15-19 correct answers: Good! Review the chapters on networking.
- Less than 15: Recommended to review the module before continuing.
Next Steps
Now that you have validated your knowledge:
Module 8: Services and Daemons
Practical Labs: Practice network configuration with Module 7 labs
Quiz created on: December 2024 - Tested on Ubuntu 24.04