Which of the following represents the correct method of…

Which of the following represents the correct method of assigning an IP address and default gateway to a
switch?

Which of the following represents the correct method of assigning an IP address and default gateway to a
switch?

A.
Switch(config)# interface vlan1
Switch(config-if)# ip address 10.0.0.1 255.0.0.0
Switch(config-if)# default-gateway 10.0.0.254

B.
Switch(config)# ip default-gateway 10.0.0.254
Switch(config)# interface vlan1
Switch(config-if)# ip address 10.0.0.1 255.0.0.0

C.
Switch(config)# ip address 10.0.0.1 255.0.0.0
Switch(config)# default-gateway 10.0.0.254

D.
Switch(config)# ip address 10.0.0.1 255.0.0.0
Switch(config)# interface vlan1
Switch(config)# ip default-gateway 10.0.0.254

Explanation:
IP addresses are assigned to switches by assigning the address to VLAN 1 using the ip address command,
while the default gateway is configured in global configuration mode using the ip default-gateway command. A
default gateway is assigned to a Layer 2 switch using the following command syntax, where h.h.h.h is the IP
address of the default gateway:
Switch(config)# ip default-gateway h.h.h.h
An IP address is assigned to a Layer 2 switch using the following command syntax, where h.h.h.h is the IP
address and m.m.m.m is the subnet mask:
Switch(config)# interface vlan1
Switch(config-if)# ip address h.h.h.h m.m.m.m
Configuring an IP address on a switch is usually accompanied by adding a default gateway as well. Switches do
not require an IP address to perform their function on the network. IP addresses are added so that an
administrator can make a Telnet connection to the switch to manage the switch. If this Telnet access does not
occur on the same local subnet with the switch, which is unlikely, or if the administrator is trying to Telnet to the
switch using a host that resides a VLAN other VLAN1 (the management VLAN) the absence of a gateway
address will render the switch incapable of answering Telnet connection attempts. Therefore, a gateway
address is usually required on the switch to make a telnet connection.
The following command set is incorrect because the command setting the default gateway must be executed in
global configuration mode, not in configuration mode, for VLAN1:
Switch(config)# interface vlan1
Switch(config-if)# ip address 10.0.0.1 255.0.0.0
Switch(config-if)# default-gateway 10.0.0.254
The following command set is incorrect because the IP address must be configured in configuration mode for
VLAN1, not global configuration mode:
Switch(config)# ip address 10.0.0.1 255.0.0.0
Switch(config)# default-gateway 10.0.0.254
The following command set is incorrect because an IP address must be configured in configuration mode for
VLAN1. Also, if you executed the command interface vlan1, the prompt would change to Switch(config-if)#.
Once it did, that would be an incorrect mode for entering the default gateway.
Switch(config)# ip address 10.0.0.1 255.0.0.0
Switch(config)# interface vlan1
Switch(config)# ip default-gateway 10.0.0.254
Objective:
Infrastructure Management
Sub-Objective:
Configure and verify device management



Leave a Reply 0

Your email address will not be published. Required fields are marked *