Linux Networking Essentials: ifconfig, netstat, curl Quiz Quiz

Challenge your understanding of crucial Linux networking commands including ifconfig, netstat, and curl. This quiz covers practical scenarios, syntax, and essential networking concepts for configuring interfaces, viewing connection details, and retrieving web content.

  1. Identifying a Network Interface IP Address with ifconfig

    Which ifconfig command output line directly displays the IPv4 address assigned to an interface such as eth0 on a Linux system?

    1. broadcast 255.255.255.0
    2. network 192.168.1.0
    3. netmask 255.255.255.0
    4. inet 192.168.1.15

    Explanation: The line beginning with 'inet' followed by an IP address, such as 'inet 192.168.1.15', shows the IPv4 address assigned to the interface. 'Broadcast' refers to the broadcast address, not the main IP. 'Netmask' shows the subnet mask, not the device’s IP. 'Network' is not a standard field in ifconfig output for current distributions, and does not display the assigned IP.

  2. Using netstat to List Listening TCP Ports

    A user wants to display all currently listening TCP ports on their Linux system. Which netstat command option should they use for this purpose?

    1. -pa
    2. -ul
    3. -lt
    4. -ni

    Explanation: The '-lt' option with netstat lists all listening TCP ports. '-ul' is used for listing listening UDP ports, '-ni' shows network interfaces in a numeric format, and '-pa' displays PID and program name for connections but doesn't specifically filter for TCP listening ports.

  3. Retrieving a Web Page with curl

    What does the basic command 'curl http://example.com' accomplish on a Linux system?

    1. It opens the web page in the system's default browser.
    2. It pings the server to test connectivity.
    3. It downloads the page and saves it as index.html automatically.
    4. It fetches and displays the web page content in the terminal.

    Explanation: Issuing 'curl http://example.com' fetches the content from the URL and prints it to standard output in the terminal. It doesn't save the file automatically; to do that you must specify '-o' or '-O'. The command doesn't open a browser or perform a network ping; those are separate functions with different tools.

  4. Distinguishing netstat Information Types

    Which of the following network details is NOT typically displayed by netstat by default on a Linux system?

    1. Routing tables
    2. ARP cache
    3. Interface queues
    4. Current network connections

    Explanation: Netstat by default shows active network connections, routing tables, and interface statistics but does not display the ARP cache unless specifically asked with extra options. The ARP cache is typically shown using 'arp' or 'ip neigh' commands. Interface queues are not shown by default either, but the ARP cache is specifically excluded from standard netstat output.

  5. Using ifconfig to Enable an Interface

    How can you use ifconfig to enable or bring up a network interface, for example eth1, that is currently down?

    1. ifconfig eth1 enable
    2. ifconfig up eth1
    3. ifconfig eth1 up
    4. ifconfig eth1 on

    Explanation: The command 'ifconfig eth1 up' brings the specified interface up and activates it for network use. 'Ifconfig eth1 on' and 'ifconfig eth1 enable' are not valid commands or options in ifconfig, and 'ifconfig up eth1' has the arguments in the wrong order and will not work.