Skip to main content

LPI E - netman test 1

LPI E - Linux Network Manager


Practice Test Text:

Network Manager provides two command-line tools for managing network settings in Linux: nmtui and nmcli.

nmtui is a simple text-based menu tool that offers a user-friendly interface for configuring network options.
nmcli, on the other hand, is a text-only command-line tool that provides a command-line interface to view and change network settings.

Unlike nmtui, nmcli does not utilize any graphical capabilities. It is designed to be used in a terminal or shell environment. By default, when running the nmcli command, it displays the current network devices and their settings.

For example, the default output of the nmcli command may look like this:

$ nmcli
eth0: connected to eth0
"Realtek RTL8111/8168/8411 Gigabit Ethernet Controller"
ethernet (r8169), 08:00:27:3D:5B:A6, hw, mtu 1500
ip4 default
inet4 192.168.1.100/24
route4 0.0.0.0/0
route4 192.168.1.0/24
inet6 fe80::a00:27ff:fe3d:5ba6/64
route6 ff00::/8
route6 fe80::/64
route6 fe80::/64


To configure network settings using nmcli, you can use command-line options. For instance, the command:
$ nmcli con add type ethernet con-name eth1 ifname enp0s3 ip4 10.0.0.5/24 gw4 10.0.0.1

In this example, the IP address is set to 10.0.0.5, the subnet mask is set to /24, and the default router is set to 10.0.0.1.

Understanding these Network Manager command-line tools is essential for managing network configurations in Linux. The nmtui tool provides an interactive menu-driven approach, while the nmcli tool offers a powerful command-line interface for advanced configuration and automation. Familiarity with both tools will enable Linux administrators to effectively manage and troubleshoot network settings in various scenarios.

Practice Test Scenario Question:

Scenario 1:
Bob wants to manually define a DNS server on his Linux system. Which file should he modify?

a) /etc/hosts
b) /etc/nsswitch.conf
c) /etc/resolv.conf
d) /etc/network/interfaces
/* --------------------- */

--------------------------

Answer 1 Below: 

--------------------------

/* --------------------- */

Explanation:
The /etc/resolv.conf file is used to manually define a DNS server on a Linux system. In this file, you can specify the domain, search domains, and nameservers. Modifying this file allows the system to use DNS host names.

Explanation of incorrect options:
a) Incorrect. The /etc/hosts file is used to manually enter host names and IP addresses for speeding up connections to commonly used hosts, but it is not used for defining DNS servers.
b) Incorrect. The /etc/nsswitch.conf file defines the order in which the Linux system checks different sources for name resolution, but it does not directly define DNS servers.
d) Incorrect. The /etc/network/interfaces file is used to configure network interfaces but does not directly specify DNS servers.

Correct answer 1: c) /etc/resolv.conf

Scenario 2:
Maria wants to specify multiple DNS servers for her network on her Linux system. How can she achieve this?

a) Add multiple entries in the /etc/hosts file.
b) Edit the /etc/nsswitch.conf file.
c) Add multiple entries in the /etc/network/interfaces file.
d) Add multiple nameserver entries in the /etc/resolv.conf file.
/* --------------------- */

--------------------------

Answer 2 Below: 

--------------------------

/* --------------------- */

Explanation:
To specify multiple DNS servers for a network on a Linux system, Maria can add multiple nameserver entries in the /etc/resolv.conf file. Each nameserver entry represents a separate DNS server.


Explanation of incorrect options:
a) Incorrect. The /etc/hosts file is used for mapping host names to IP addresses and does not directly specify DNS servers.
b) Incorrect. The /etc/nsswitch.conf file defines the order of name resolution sources but does not specify DNS servers.
c) Incorrect. The /etc/network/interfaces file is used for configuring network interfaces, not for specifying DNS servers.

Correct answer 2: d) Add multiple nameserver entries in the /etc/resolv.conf file.

Scenario 3:
John wants to speed up connections to commonly used hosts on his Linux system. Where should he manually enter their host names and IP addresses?

a) /etc/hosts
b) /etc/resolv.conf
c) /etc/nsswitch.conf
d) /etc/network/interfaces
/* --------------------- */

--------------------------

Answer 3 Below: 

--------------------------

/* --------------------- */

Explanation:
To manually enter host names and IP addresses for speeding up connections to commonly used hosts, John should edit the /etc/hosts file on his Linux system.


Explanation of incorrect options:
b) Incorrect. The /etc/resolv.conf file is used for specifying DNS servers and related configurations, not for manually entering host names and IP addresses.
c) Incorrect. The /etc/nsswitch.conf file defines the order of name resolution sources, but it does not involve manually entering host names and IP addresses.
d) Incorrect. The /etc/network/interfaces file is used for configuring network interfaces and does not serve the purpose of manually entering host names and IP addresses.


Correct answer 3: a) /etc/hosts

Scenario 4:
Sarah wants to determine whether her Linux system checks the /etc/hosts file before or after using DNS to look up host names. Which file should she examine?

a) /etc/hosts
b) /etc/resolv.conf
c) /etc/nsswitch.conf
d) /etc/network/interfaces
/* --------------------- */

--------------------------

Answer 4 Below: 

--------------------------

/* --------------------- */

Explanation:
The /etc/nsswitch.conf file defines the order in which the Linux system checks different sources for name resolution. Sarah should examine this file to determine whether the system checks the /etc/hosts file before or after using DNS to look up host names.


Explanation of incorrect options:
a) Incorrect. The /etc/hosts file is used for manually entering host names and IP addresses, but it does not determine the order of name resolution sources.
b) Incorrect. The /etc/resolv.conf file specifies DNS servers and configurations but does not determine the order of name resolution sources.
d) Incorrect. The /etc/network/interfaces file is used for configuring network interfaces and does not determine the order of name resolution sources.


Correct answer 4: c) /etc/nsswitch.conf

Scenario 5:
Lisa wants to ensure that her changes to the /etc/resolv.conf file persist across system reboots. What should she be aware of?

a) The file will automatically save changes upon modification.
b) The file may reset upon system reboot depending on the Linux distribution's configuration.
c) The changes made to the file will be discarded upon system reboot.
d) The file cannot be modified directly; changes must be made through a graphical tool.
/* --------------------- */

--------------------------

Answer 5 Below: 

--------------------------

/* --------------------- */

Explanation:
Lisa should be aware that the changes made to the /etc/resolv.conf file may reset upon system reboot depending on the Linux distribution's configuration. Some distributions regenerate the file during boot or use other mechanisms to manage its content.


Explanation of incorrect options:
a) Incorrect. The file does not automatically save changes upon modification; it can be affected by system reboot or other factors.
c) Incorrect. While changes are not automatically discarded upon system reboot, they may be reset depending on the Linux distribution's configuration.
d) Incorrect. The file can be modified directly using a text editor; it is not limited to changes through graphical tools.

Correct answer 5: b) The file may reset upon system reboot depending on the Linux distribution's configuration.

Scenario 6:
Tom wants to use a command-line tool to view and change network settings on his Linux system. Which command-line tool should he use?

a) nmtui
b) nmcli
c) ifconfig
d) ipconfig
/* --------------------- */

--------------------------

Answer 6 Below: 

--------------------------

/* --------------------- */

Explanation:
To view and change network settings using a command-line tool, Tom should use the nmcli command-line tool. It provides a text-only interface for managing network settings.


Explanation of incorrect options:
a) Incorrect. The nmtui command-line tool provides a simple text-based menu tool, but it is not used for viewing and changing network settings directly on the command line.
c) Incorrect. ifconfig is a command used in some Linux distributions to display and configure network interfaces, but it is not part of the Network Manager tools.
d) Incorrect. ipconfig is a command used in Windows systems to display and configure network settings, not in Linux.


Correct answer 6: b) nmcli

Scenario 7: Jane wants to use a command-line tool that offers a text-based menu for managing network settings on her Linux system. Which command-line tool should she use?
a) nmtui
b) nmcli
c) ifconfig
d) ipconfig
/* --------------------- */

--------------------------

Answer 7 Below: 

--------------------------

/* --------------------- */

Explanation: Jane should use the nmtui command-line tool to access a text-based menu for managing network settings on her Linux system. This tool provides a user-friendly interface for configuring network options.

Explanation of incorrect options:
b) Incorrect. nmcli is a text-only command-line tool and does not offer a text-based menu for managing network settings.
c) Incorrect. ifconfig is not a tool that provides a text-based menu for managing network settings.
d) Incorrect. ipconfig is a command used in Windows systems, not in Linux.

Correct answer 7: a) nmtui

Scenario 8: Mark wants to use the nmcli command-line tool to display the current network devices and their settings on his Linux system. Which command should he use?
a) nmcli show
b) nmcli list
c) nmcli view
d) nmcli display
/* --------------------- */

--------------------------

Answer 8 Below: 

--------------------------

/* --------------------- */

Explanation:
Mark should use the command "nmcli show" to display the current network devices and their settings using the nmcli command-line tool.


Explanation of incorrect options:
b) Incorrect. There is no "nmcli list" command. The correct command to display network device settings is "nmcli show."
c) Incorrect. There is no "nmcli view" command. The correct command to view network device settings is "nmcli show."
d) Incorrect. There is no "nmcli display" command. The correct command to display network device settings is "nmcli show."


Correct answer 8: a) nmcli show

Scenario 9: Lisa wants to set the IP address, subnet mask, and default router using the nmcli command-line tool. Which command should she use?
a) nmcli con add type ethernet con-name eth1 ifname enp0s3 ip4 192.168.1.15/24 gw4 192.168.1.254
b)
nmcli con modify eth1 ip4 192.168.1.15/24 gw4 192.168.1.254
c)
nmcli set eth1 ip4 192.168.1.15/24 gw4 192.168.1.254
d)
nmcli config add eth1 ip4 192.168.1.15/24 gw4 192.168.1.254
/* --------------------- */

--------------------------

Answer 9 Below: 

--------------------------

/* --------------------- */

Explanation:
Lisa should use the command "nmcli con add type ethernet con-name eth1 ifname enp0s3 ip4 192.168.1.15/24 gw4 192.168.1.254" to set the IP address to 192.168.1.15, the subnet mask to /24, and the default router to 192.168.1.254 using the nmcli command-line tool.


Explanation of incorrect options:
b) Incorrect. The "nmcli con modify" command is used to modify an existing connection, not to add a new connection with specified settings.
c) Incorrect. The "nmcli set" command is not used for adding or modifying network connections with specific IP address, subnet mask, and default router settings.
d) Incorrect. There is no "nmcli config add" command. The correct command to add a new connection with specified settings is "nmcli con add." 
 
Correct answer 9: a) nmcli con add type ethernet con-name eth1 ifname enp0s3 ip4 192.168.1.15/24 gw4 192.168.1.254