交换机配置ssh服务实验

交换机端

Switch>en    //进入特权模式

Switch#conf t    //进入配置模式

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#hostname R1    //命名交换机为“R1”

R1(config)#vl 10   //创建vlan10

R1(config-vlan)#int vl 10    //进入vlan10

R1(config-if)#

%LINK-5-CHANGED: Interface Vlan10, changed state to up

R1(config-if)#ip add 1.1.1.1 255.255.255.0    //为vlan10配置IP地址及子网掩码

R1(config-if)#no sh    //启用vlan10

R1(config-if)#int f0/1    //进入f0/1接口

R1(config-if)#sw a vl 10    //将f0/1划分到vlan10

R1(config-if)#

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up

R1(config)#line vty 0 4     //配置虚拟终端

R1(config-line)#login local    //本地账户登录

R1(config-line)#transport input ssh    //使用ssh登录

R1(config)#ip domain-name tony.com    ​//配置域名为tony.com

R1(config)#username tony privilege 15 password root    ​/设置用户名为tony,权限等级为15,密码为root

R1(config)#crypto key generate rsa    ​//设置rsa密钥

*Mar 1 0:14:39.27: RSA key size needs to be at least 768 bits for ssh version 2

*Mar 1 0:14:39.27: %SSH-5-ENABLED: SSH 1.5 has been enabled

% You already have RSA keys defined named R1.tony.com .

% Do you really want to replace them? [yes/no]: yes    ​//保存

The name for the keys will be: R1.tony.com

Choose the size of the key modulus in the range of 360 to 4096 for your

  General Purpose Keys. Choosing a key modulus greater than 512 may take

  a few minutes.

How many bits in the modulus [512]: 2048    ​//设置rsa密钥长度为2048

% Generating 2048 bit RSA keys, keys will be non-exportable...[OK]

R1(config)#

*Mar 1 0:14:55.469: %SSH-5-ENABLED: SSH 1.99 has been enabled

pc端

配置pc端ip与vlan10处于同一网段

使用  ssh -l username ip address 登录进行测试

C:\>ssh -l tony 1.1.1.1

Password:

% Login invalid

Password:

root#

root#en

root#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

root(config)#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值