详解ACL限制SSH、Telnet远程登录及抓包实验

小编:霸主 更新时间:2022-05-18


详解ACL限制SSH、Telnet远程登录及抓包实验

组网要求:SW2、SW3交换机与SW1连接,为了保证核心交换机SW1的安全,要求在SW1上配置SSH,允许SW2通过远程登录,不允许其他交换机远程登录。在SW2上配置Telnet,允许PC1远程登录。

一、eNSP实际操作视频:

视频加载中...

二、主要知识点:

Telnet缺少安全的认证方式,而且传输过程采用TCP进行明文传输,存在很大的安全隐患。单纯提供Telnet服务容易招致DoS(Deny of Service)、主机IP地址欺骗、路由欺骗等恶意攻击。

随着人们对网络安全的重视,传统的Telnet和FTP通过明文传送密码和数据的方式,已经慢慢不被人接受。SSH(Secure Shell)是一个网络安全协议,通过对网络数据的加密,解决了这个问题。它在一个不安全的网络环境中,提供了安全的远程登录和其他安全网络服务。

SSH通过TCP进行数据交互,它在TCP之上构建了一个安全的通道。另外SSH服务除了支持标准端口22外,还支持其他服务端口,以防止受到非法攻击。

STelnet

STelnet是基于SSH的安全Telnet服务。与Telnet相比,SSH服务器通过对客户端进行认证及双向的数据加密,为网络终端访问提供了安全的服务。

三、IP设置:

PC1:192.168.10.10/24

SW1:vlanif1:192.168.10.1/24

SW2:vlanif1:192.168.10.2/24

SW3:vlanif1:192.168.10.3/24

四、SW1的主要配置文件:

#

sysname SW1

#

acl number 2000

rule 5 permit source 192.168.10.2 0

#

aaa

authentication-scheme default

authorization-scheme default

accounting-scheme default

domain default

domain default_admin

local-user admin password simple admin

local-user admin service-type http

local-user sshsw1 password cipher %NS[+B0ZNI]NZPO3JBXBHA!! #创建SSH用户,用户名为:sshsw1,配置的密码为123456

local-user sshsw1 privilege level 15 #sshsw1的权限为15级为最高级

local-user sshsw1 service-type ssh #本地用户的服务类型为ssh

#

interface Vlanif1

ip address 192.168.10.1 255.255.255.0

#

stelnet server enable #启用Stelnet服务

ssh user sshsw1

ssh user sshsw1 authentication-type password #ssh的认证类型为密码认证

ssh user sshsw1 service-type stelnet #ssh的服务类型为stelnet

#

rsa local-key-pair create #生成本地秘钥对 ,当其他交换机第一次访问时,要在客户机上执行ssh client first-time enable 命令,下载秘钥

#

user-interface con 0

user-interface vty 0 4

acl 2000 inbound #只允许访问控制列表允许的源地址访问用户界面,其他默认地被拒绝

authentication-mode aaa #用户界面的认证方式为aaa

protocol inbound ssh #访问的协议为ssh

#

return


五、SW2的主要配置文件:

#

sysname SW2

#

acl number 2000

rule 5 permit source 192.168.10.10 0

#

aaa

authentication-scheme default

authorization-scheme default

accounting-scheme default

domain default

domain default_admin

local-user admin password simple admin

local-user admin service-type http

local-user telsw2 password cipher %NS[+B0ZNI]NZPO3JBXBHA!!

local-user telsw2 privilege level 15

local-user telsw2 service-type telnet

#

interface Vlanif1

ip address 192.168.10.2 255.255.255.0

#

user-interface con 0

user-interface vty 0 4

acl 2000 inbound

authentication-mode aaa

#

return


六:验证结果

1、在SW2上远程登录SW1

[SW2]stelnet 192.168.10.1

Please input the username:sshsw1

Trying 192.168.10.1 ...

Press CTRL+K to abort

Connected to 192.168.10.1 ...

The server's public key does not match the one catched before.

The server is not authenticated. Continue to access it? [Y/N]:y

Update the server's public key now? [Y/N]:

Dec 29 2020 13:43:45-08:00 SW2 %%01SSH/4/CONTINUE_KEYEXCHANGE(l)[0]:The server h

ad not been authenticated in the process of exchanging keys. When deciding wheth

er to continue, the user chose Y.y


Dec 29 2020 13:43:46-08:00 SW2 %%01SSH/4/UPDATE_PUBLICKEY(l)[1]:When deciding wh

ether to update the key 192.168.10.1 which already existed, the user chose Y.

Enter password:

Info: The max number of VTY users is 5, and the number

of current VTY users on line is 1.

The current login time is 2020-12-29 13:43:50.

2、在SW3上远程登录SW2

telnet 192.168.10.2

Trying 192.168.10.2 ...

Press CTRL+K to abort

因为SW2做了ACL,只允许PC1远程登录。


本实验是通过华为模拟器eNSP1.3.00.100版(最新版)完成。该软件还包含CE、CX、NE40E、NE5000E、NE9000E、USG6000V的设备IOS,可完成复杂网络测试,需要该模拟器的朋友,可以转发此文关注小编,私信小编【666】即可获得。