交换机初始配置

环境:Packet Tracer

CLI命令行的几种模式

Switch>            #用户模式
Switch>enable 
Switch#            #特权模式
Switch#configure terminal
Switch(config)#    #全局模式
Switch(config)#int vlan 1
Switch(config-if)#      #接口配置
Switch(config)#line vty 0 4 
Switch(config-line)#          #线路模式

基础配置

1、给交换机进行初始配置

Switch>enable
Switch#setup
...
前面有两个“yes”,
Enter host name [Switch]: aaa       #配置交换机的主机名
Enter enable password: zbzr0823     #设置交换机密码
Enter virtual terminal password: zbzr0823   #确认密码
Configure SNMP Network Management? [no]:no    #不设置SNMP协议
management network from the above interface summary: vlan1        #选择要设置的接口
Configuring interface Vlan1:
  Configure IP on this interface? [yes]: yes          #是否给交换机设置IP
    IP address for this interface: 192.168.9.2        #设置交换机的IP
    Subnet mask for this interface [255.255.255.0] : 255.255.255.0        #设置交换机的子网掩码
Would you like to enable as a cluster command switch? [yes/no]:yes        #是否要启用群集命令开关?
之后输入”2“选择生效以上的配置即可。
...

2、进vlan1,配置IP

aaa>en
aaa>enable 
Password: 
aaa#confi
aaa#configure t
aaa#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
aaa(config)#int vlan 1
aaa(config-if)#ip add
aaa(config-if)#ip address 192.168.9.2 255.255.255.0

以Console,和telnet的方式连接交换机

1、Console方式:
在这里插入图片描述
选择蓝色的线,用PC的RS 232接口连接交换机的Console接口,然后进入,双击PC的”Terminal“,然后确认即可。
设置Console登陆时需要密码:

Switch(config)#line console 0
Switch(config-line)#password 123456
Switch(config-line)#login

此后在使用Console登陆时就需要这个密码。
2、使用Telnet远程连接的方式:
在这里插入图片描述

  1. 先给交换机,PC配置IP。需要在同一网段。
  2. 进入到交换机的线路模式,配置用户登陆vty
Switch#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#line vty 0 4
Switch(config-line)#password 123456      #设置密码,不设置不行。
Switch(config-line)#login 
  1. 开启vlan1的端口
Switch(config-if)#no shutdown 

4、查看所做的配置

Switch#show running-config 

5、在PC的命令行登陆

PC>telnet 192.168.9.2
Trying 192.168.9.2 ...Open
User Access Verification
Password: 
Switch>

6、给交换机本身设置密码

Switch(config)#enable password qqq      #设置明文密码
Switch(config)#enable secret zzz        #设置密文密码

注意此时在使用telnet远程连接时就要输入密文密码。

7、清除配置信息

Switch#erase startup-config 

8、将配置全部加密

Switch(config)#service password-encryption 

9、直接设置主机名

Switch(config)#hostname ff

10、显示当前运行配置信息

ff#show running-config 

快捷键

1、出现如下情况,点击啥不没反应的,如下:

Ctrl+shift+6

2、直接回到特权模式

Ctrl+z

3、补全

Tab键

4、显示历史命令

Ctrl+P     上一条历史命令
Ctrl+N     下一条历史命令

5、移动光标

Ctrl+A     #将光标移到命令行之首
Ctrl+E     #将光标移到命令行之尾
  • 3
    点赞
  • 33
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

让我三行代码

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值