By default, all ports of a switch are enabled. As we are talking about layer 2 switching, there is no need to configure IP address or any routing protocol on the switch. In such a situation, the configuration is not focused on the switch.
缺省情況下,交換機的所有端口均處于啟用狀態。 當我們談論第2層交換時 ,無需在交換器上配置IP地址或任何路由協議。 在這種情況下,配置不會集中在交換機上。
The normal configuration given below can be done on the switch:
下面給出的常規配置可以在交換機上完成:
You can define the hostname on the switch.
您可以在交換機上定義主機名。
You can set the password for the switch.
您可以設置交換機的密碼。
You can describe all the ports of the switch.
您可以描述交換機的所有端口。
You can set the password for the console ports.
您可以設置控制臺端口的密碼。
You can set the password of ports for Telnetting.
您可以設置用于Telnet的端口密碼。
The above mentioned configuration list can be seen with the following example:
通過以下示例可以看到上面提到的配置列表:
First, you have to execute the command execute using the command execution mode. You will see switch by default as soon as you open it. Once you run this command, you will enter into privileged execution mode. In this mode, you execute the config terminal command. By executing this command, you will be in the global configuration mode.
首先,必須使用命令執行模式執行命令執行。 默認情況下,您將在打開開關后立即看到它。 一旦運行此命令,您將進入特權執行模式。 在這種模式下,您將執行config terminal命令。 通過執行此命令,您將進入全局配置模式。
Switch>enable
Switch# config terminal
Switch(config)#
You can configure your switch after coming into the global configuration mode. You use the hostname command to configure hostname on the switch. After this command, you can mention the name that you want to give to the switch.
進入全局配置模式后,可以配置交換機。 您可以使用hostname命令在交換機上配置主機名。 執行此命令后,您可以提及要為交換機指定的名稱。
Switch(config)#hostname MRSwitch
As soon as this command is executed, the name of your switch is set up.
執行此命令后,即會設置交換機的名稱。
MRSwitch(config)#
The switch can be protected from password so that no unauthorized person can access it. You use the enable secret command for this. After this command, you type the password you want to set for the switch.
可以使用密碼保護該開關,以便任何未經授權的人都不能訪問它。 為此,請使用enable secret命令。 此命令后,鍵入要為交換機設置的密碼。
MRSwitch(config)#enable secret MR123
To configure an interface of the switch, first, you have to go to the interface configuration mode. For this, use the interface command. Next, to this command, you have to type the name of the interface.
要配置交換機的接口,首先,必須進入接口配置模式。 為此,請使用interface命令。 接下來,在此命令中,您必須鍵入接口的名稱。
MRSwitch(config)# interface f0/16
To define the description of an interface, you use the description command in the interface configuration mode. Next, to this command, you write the description of that interface.
要定義接口的描述,請在接口配置模式下使用description命令。 接下來,在此命令中,編寫該接口的描述。
MRSwitch(config-if)# description Description of of/16 interface
You use the password command to set the password of any console line. But for this, you have to first go to the configuration mode of the console line you want to set. For this, you execute the line console command. Next, to this command, you type the console number of the console.
您可以使用password命令來設置任何控制臺行的密碼。 但是為此,您必須首先進入要設置的控制臺行的配置模式。 為此,您執行line console命令。 接下來,在此命令中,鍵入控制臺的控制臺號。
MRSwitch(config-if)# line console 0 MRSwitch(config-line)#password mrconsole
After that, you can execute the login command. Anyone trying to access the console line by this command is forced to enter the password. If you do not execute the login command, then the password is set but the password is not compulsory to enter. You can execute this command even after the telnet password is set.
之后,您可以執行login命令。 任何試圖通過此命令訪問控制臺行的人都必須輸入密碼。 如果不執行login命令,則將設置密碼,但密碼不是必須輸入的。 即使設置了telnet密碼,您也可以執行此命令。
You use the line "vty" command to set the telnet password on the interfaces. Next, to this command, you give the range of virtual terminals lines. If you want to configure all 16 lines, then it gives 0 to 15 range. Then you set the telnet password with the password command and execute the login command.
您可以使用line “ vty”命令在接口上設置telnet密碼。 接下來,向該命令提供虛擬終端線的范圍。 如果要配置所有16條線,則其范圍為0到15。 然后,使用password命令設置telnet密碼并執行login命令。
MRSwitch(config-line)#line vty 0 15 MRSwitch(config-line)#password mrtelnet MRSwitch(config-line)#login
翻譯自: https://www.includehelp.com/computer-networks/configuring-cisco-switches.aspx