Chapter 7 Configuring Network Connections
What directory do Red Hat-based systems use to store network configuration files? A. /etc/sysconfig/network-scripts B. /etc/network C. /etc/ifcfg-eth0 D. /etc/ifconfig E. /etc/iwconfig
A. /etc/sysconfig/network-scripts Red Hat-based systems use separate files to store the IP address and router information. Those files are stored in the /etc/sysconfig/network-scripts folder, making option A correct. Option B is where Debian-based systems store the interfaces file, which contains the network configuration settings. The ifcfg-eth0 is a file used to store the configuration, not a folder, so option C is incorrect. The ifconfig and iwconfig are commands and not folders, so options D and E are incorrect.
What network setting defines the network device that routes packets intended for hosts on remote networks? A. Default router B. Netmask C. Hostname D. IP address E. DNS server
A. Default router The default router is used to send packets from the local network to remote networks, so to communicate with a remote host you need to define the default router address, making option A correct. The netmask only defines the local network; it doesn't define what to do with packets for remote hosts, so option B is incorrect. The hostname and IP address only define features of the local host, so options C and D are incorrect. The DNS server defines how to retrieve the IP address of a host based on its domain name, so option E is incorrect.
Which command would you use to find the mail server for a domain? A. dig B. netstat C. ping6 D. host E. ss
A. dig The dig command can display individual host records for a domain, which you can use to find the MX mail host for the domain, so option A is correct. The host command only displays host IP address information; it can't determine the server type from the DNS records, so option D is incorrect. The netstat and ss commands display active network connections, but not the remote host types, so options B and E are both incorrect. The ping6 command sends IPv6 ICMP packets to test remote hosts but can't tell if the remote host is a mail server, so option C is incorrect.
Which command displays the duplex settings for an Ethernet card? A. ethtool B. netstat C. iwconfig D. iwlist E. route
A. ethtool The ethtool command displays features and parameters for network cards, so option A is the correct answer. The netstat command displays network statistics and connections, so option B is incorrect. The iwconfig and iwlist commands are used to set wireless network parameters and not Ethernet card settings, so options C and D are incorrect. The route command sets or displays routing information and not Ethernet card settings, so option E is incorrect.
Which ifconfig format correctly assigns an IP address and netmask to the eth0 interface? A. ifconfig eth0 up 192.168.1.50 netmask 255.255.255.0 B. ifconfig eth0 255.255.255.0 192.168.1.50 C. ifconfig up 192.168.1.50 netmask 255.255.255.0 D. ifconfig up E. ifconfig down
A. ifconfig eth0 up 192.168.1.50 netmask 255.255.255.0 The ifconfig command must specify the network interface, the IP address, then the netmask option before the netmask address. You can use the up or down option to place the network card in an active or inactive state by default, but it's not required. Option A is the only option that uses the correct values in the correct order. Option C is close but fails to specify the network interface. Option B is not in the correct format, and options D and E fail to list the necessary configuration settings.
What command displays all of the available wireless networks in your area? A. iwlist B. iwconfig C. ifconfig D. ip E. arp
A. iwlist The iwlist command displays the available wireless network access points detected by the wireless network card, so option A is correct. The iwconfig command configures the network card to connect to a specific access point but doesn't list all of the detected access points, making option B incorrect. Option C specifies the ifconfig command, which is used to assign an IP address to a wireless network card but doesn't list the access points. The ip command specified in option D likewise can be used to set the IP address of the card but doesn't list the access points. Option E, the arp command, maps hardware addresses to IP addresses so that you can find duplicate IP addresses on your network, but it doesn't list the wireless access points.
If your Linux server doesn't have a graphical desktop installed, what two tools could you use to configure network settings on a wired network card from the command line? A. nmcli B. iwconfig C. ip D. netstat E. ping
A. nmcli C. ip The nmcli and the ip commands both allow you to set and change network settings from the command line, so options A and C are both correct. The iwconfig command only sets wireless network information, so option B is incorrect. The netstat command displays open ports but doesn't change any network settings, so option D is incorrect. The ping command sends ICMP packets to remote hosts for testing, but it also doesn't set any network settings, so option E is incorrect.
Which file contains a list of DNS servers the Linux system can use to resolve hostnames? A. /etc/dhcpd.conf B. /etc/resolv.conf C. /etc/nsswitch.conf D. /etc/network/interfaces E. /etc/sysctl.conf
B. /etc/resolv.conf The DNS servers are listed in the /etc/resolv.conf configuration file using the nameserver setting, so option B is correct. The /etc/dhcpd.conf file defines configuration settings for a DHCP server, so option A is incorrect. The /etc/nsswitch.conf file defines the order in which the system searches for a hostname, not the list of DNS servers used, so option C is incorrect. The /etc/network/interfaces file defines the network interfaces for a Debian-based system, not the list of DNS servers, so option D is also incorrect. The /etc/sysctl.conf file defines kernel network parameters and not a list of DNS servers, so option E is incorrect.
What is used to automatically assign an IP address to a client? A. Default router B. DHCP C. ARP table D. Netmask E. ifconfig
B. DHCP The Dynamic Host Configuration Protocol (DHCP) is used to assign dynamic IP addresses to client workstations on a network, so option B is correct. The default router can't assign addresses to devices, so option B is incorrect. The ARP table maps the hardware address of the network card to IP addresses but doesn't assign the IP addresses, so option C is incorrect. The netmask value determines the network address but not the IP address of the host, so option D is incorrect. The ifconfig command can set the static IP address of the host but doesn't automatically assign the IP address, so option E is incorrect.
What type of address is used so local applications can use network protocols to communicate with each other? A. Dynamic address B. Loopback address C. Static address D. Hostname E. MAC address
B. Loopback address The loopback address is a special address assigned to the loopback interface that allows local applications to communicate with each other, making option B the correct answer. Dynamic and static IP addresses are assigned to network interfaces, which interact with remote systems, not local applications, so options A and C are incorrect. The hostname identifies the local host for remote connections, not for local applications, so option D is incorrect. The MAC address identifies the network card hardware address but isn't used by local applications, so option E is incorrect.
Which tool does newer versions of Ubuntu use to set network address information? A. netstat B. Netplan C. iwconfig D. route E. ifconfig
B. Netplan Starting with version 17.04, Ubuntu has switched to using the Netplan tool to set network address information. The netstat command doesn't set network information, but instead displays active network connections, so option A is incorrect. The iwconfig command sets wireless network parameters, but not network address information, so option C is incorrect. The route command sets default router information, but not network address information, so option D is incorrect. The ifconfig command does set network address information, but it isn't used by the newer versions of Ubuntu, so option E is incorrect.
Which configuration line sets a dynamic IP address for a Debian system? A. iface eth0 inet static B. iface eth0 inet dhcp C. auto eth0 D. iface eth0 inet6 auto E. BOOTPROTO=dynamic
B. iface eth0 inet dhcp The Debian system uses the iface setting to set features for an interface, and you must specify the dhcp option to dynamically obtain an IP address, making option B correct. Options C and E are incorrect since they don't use the iface setting. Option A sets a static IP address for the interface and not a dynamic address, so it's incorrect. Option D sets a link local IPv6 address and not a dynamic IP address, so it's incorrect.
What command would you use to find out what application was using a specific TCP port on the system? A. ip B. ss C. host D. dig E. ifconfig
B. ss The ss command can display both open ports and the applications that own them, so option B is correct. The ip and ifconfig commands just display or set network settings, so options A and E are incorrect. The host and dig commands only display hostname information, so options C and D are also incorrect.
You have a network application that fails to connect to a remote server. What command-line tool should you use to watch the network packets that leave your system to ensure that they use the correct network port? A. nc B. tcpdump C. ping D. traceroute E. mtr
B. tcpdump The tcpdump command displays network packets that traverse the system network interface, so you can use that for monitoring application packets on the network, making option B the correct answer. The nc command allows you to manually send packets on the network, but it doesn't allow you to monitor application packets, so option A is incorrect. The ping and traceroute commands only send ICMP packets to remote servers; they don't monitor packets, so options C and D are incorrect. The mtr command can display the connectivity status to a remote server, but it doesn't allow you to view application packets going to the server, so option E is incorrect.
Which two commands can be used to set the IP address, subnet mask, and default router information on an interface using the command line? A.netstat B. ping C. nmtui D. ip E. route
C. nmtui D. ip The nmtui command provides an interactive text menu for selecting a network interface and setting the network parameters, and the ip command provides a command-line tool for setting network parameters, so both options C and D are correct. The netstat command displays information about network connections, but it doesn't set the network parameters. The ping command can send ICMP packets to a remote host but doesn't set the local network parameters. The route command sets the routing network parameters, but not the IP address or subnet mask, so option E is incorrect.
What tool allows you to send ICMP messages to a remote host to test network connectivity? A. netstat B. ifconfig C. ping D. iwconfig E. ss
C. ping The ping command sends ICMP packets to a specified remote host and waits for a response, making option C the correct answer. The netstat command displays statistics about the network interface, so it's incorrect. The ifconfig command displays or sets network information but doesn't send ICMP packets, making option B incorrect. The iwconfig command displays or sets wireless network information, but it doesn't handle ICMP packets, making option D incorrect. The ss command displays information about open connections and ports on the system, so option E is also incorrect.
What option sets the wireless access point name in the iwconfig command? A. key B. netmask C. address D. essid E. channel
D. essid The SSID value defines the access point name, and it is set using the essid option in the iwconfig command, making option D the correct answer. The key option specifies the encryption key required to connect to the access point but not the access point name, making option A incorrect. The netmask and address values aren't set by the iwconfig command, so options B and C are incorrect. The channel option defines the radio frequency the access point uses, not the access point name, so option E is also incorrect.
What device setting defines a host that maps a host name to an IP address? A. Default router B. Netmask C.Hostname D. IP address E. DNS server
E. DNS server The DNS server maps the hostname to an IP address, so you must have a DNS server defined in your network configuration to be able to use hostnames in your applications. Thus, option E is correct. The default router only defines how to send packets to remote hosts; it doesn't map the host name to the IP address, so option A is incorrect. The netmask value defines the local network, but not how to map hostnames to IP addresses, so option B is incorrect. The hostname and IP address define features of the local host, so options C and D are incorrect.
What command can you use to both display and set the IP address, netmask, and default router values? A. ifconfig B. iwconfig C. router D. ifup E. ip
E. ip The ip command allows you to both display and set the IP address, netmask, and default router values for a network interface, so option E is correct. The ifconfig command can set the IP address and netmask values, but not the default router. The iwconfig command is used to set the wireless access point settings, and the router command is used to set the default router but not the IP address or netmask values. The ifup command only activates the network interface; it can't set the address values.
Which command displays what processes are using which ports on a Linux system? A. iwconfig B. ip C. ping D. nmtui E. ss
E. ss The ss command displays a list of the open ports on a Linux system, along with the processes associated with each port, so option E is correct. The iwconfig command sets wireless network information, not open ports, so option A is incorrect. The ip command displays or sets network information on a network interface but doesn't display open ports, so option B is incorrect. The ping command sends ICMP messages to a remote host but doesn't display any open ports, so option C is incorrect. The nmtui command allows you to configure network parameters for a network interface but doesn't display the open ports on the system, so option D is incorrect.