Which of the following command sets is correct? (Assume the commands are executed at the correct prompt.)

Last Updated on August 7, 2021 by Admin

You are creating a configuration to use on a switch. The configuration must enable you to remotely manage the switch.

Which of the following command sets is correct? (Assume the commands are executed at the correct prompt.)

  • interface vlan 1
    ip address 192.168.20.244 255.255.255.240
    no shutdown
    exit
    ip default-gateway 192.168.20.241
    line vty 0 15
    password cisco
    login
    exit
  • interface fastethernet 0/1
    
    ip address 192.168.20.244 255.255.255.240
    
    no shutdown
    
    exit
    
    ip default-gateway 192.168.20.241
    
    line vty 0 15
    
    password cisco
    
    login
    
    exit
  • interface vlan 1
    
    ip address 192.168.20.244 255.255.255.240
    
    no shutdown
    
    exit
    
    ip route 192.168.20.241
    
    line vty 0 15
    
    login
    
    exit
  • interface vlan 1
    
    ip address 192.168.20.244 255.255.255.240
    
    no shutdown
    
    exit
    
    ip default-gateway 192.168.20.241
    
    line con 0 15
    
    password cisco
    
    login
    
    exit
  • interface vlan 1
    
    ip address 192.168.20.244 255.255.255.240
    
    no shutdown
    
    exit
    
    ip default-gateway 192.168.20.27
    
    line vty 0 15
    
    password cisco
    
    login
    
    exit
  • interface vlan 1
    
    ip address 192.168.20.244 255.255.255.240
    
    shutdown
    
    exit
    
    ip default-gateway 192.168.20.241
    
    line vty 0 15
    
    password cisco
    
    login
    
    exit
Explanation:
The following command set is correct:

interface vlan 1
ip address 192.168.20.244 255.255.255.240
no shutdown
exit
ip default-gateway 192.168.20.241
line vty 0 15
password cisco
login
exit

It sets an IP address for VLAN 1, which is the management VLAN. Next, it sets a default gateway that is in the same network with the IP address. It correctly enables the interface, sets a required password on the VTY lines, and sets the switch to prompt for the password.

Switches do not need IP addresses unless you want to remotely manage the devices. When an IP address is assigned to a switch for this purpose, it is not applied to a physical interface. It is applied to the VLAN 1 interface, which is the management VLAN by default.

The following command set is incorrect because it applies the IP address to the fastethernet 0/1 interface, rather than the management VLAN. When you set an IP address for the switch, you do so on the management VLAN, not one of the physical interfaces.

interface fastethernet 0/1
ip address 192.168.20.244 255.255.255.240
no shutdown
exit
ip default-gateway 192.168.20.241
line vty 0 15
password cisco
login
exit

The following command set is incorrect because it does not set a password on the VTY lines, which is required to connect with Telnet unless you include the no login command.

interface vlan 1
ip address 192.168.20.244 255.255.255.240
no shutdown
exit
ip default-gateway 192.168.20.241
line con 0 15
login
exit

The following command set is incorrect because it sets the password in the console line rather than the VTY lines.

interface vlan 1
ip address 192.168.20.244 255.255.255.240
no shutdown
exit
ip default-gateway 192.168.20.241
line con 0 15
password cisco
login
exit

The following command set is incorrect because the address for VLAN1 and the gateway are not in the same subnet. With a 28-bit mask the interval is 16, which means the network that the gateway is in is the 192.168.20.16/28 network and VLAN 1 is in the 192.1683.20.240/28 network.

interface vlan 1
ip address 192.168.20.244 255.255.255.240
no shutdown
exit
ip default-gateway 192.168.20.27
line vty 0 15
password cisco
login
exit

The following command set is incorrect because the VLAN 1 interface has been disabled with the shutdown command.

interface vlan 1
ip address 192.168.20.244 255.255.255.240
shutdown
exit
ip default-gateway 192.168.20.241
line vty 0 15
password cisco
login
exit

Objective:
Infrastructure Management
Sub-Objective:
Configure and verify device management