2023年5月23日星期二

ubuntu 20.04通过ssh连接2960X

 注意最后一句

要在Ubuntu上通过SSH连接到Cisco 2960x交换机,你需要执行以下步骤来设置SSH连接:

  1. 在Ubuntu上安装OpenSSH客户端:打开终端,运行以下命令来安装OpenSSH客户端:

    sql
    sudo apt-get update sudo apt-get install openssh-client
  2. 在Cisco 2960x交换机上启用SSH服务:使用串行控制台或Telnet连接到交换机,并执行以下步骤: a. 进入特权模式:输入enable命令,并输入特权密码(如果设置了密码)。 b. 进入全局配置模式:输入configure terminal命令。 c. 生成RSA密钥对:输入crypto key generate rsa命令,选择密钥位大小(推荐2048位)。 d. 启用SSH服务:输入ip ssh version 2命令,确保只使用SSH版本2。 e. 设置登录用户名和密码:输入username your_username password your_password命令,替换"your_username"为你的用户名,"your_password"为你的密码。 f. 退出全局配置模式:输入exit命令。 g. 保存配置:输入write memory命令,将配置保存到闪存中。

  3. 从Ubuntu上的终端使用SSH连接到Cisco 2960x交换机:在终端中运行以下命令:

    css
    ssh username@switch_ip_address

    替换"username"为你在交换机上设置的用户名,"switch_ip_address"为交换机的IP地址。

  4. 如果SSH连接仍然遇到问题,你可能需要在连接命令中指定密钥交换算法。尝试以下命令来连接:

    sql
    ssh -oKexAlgorithms=+diffie-hellman-group-exchange-sha1 username@switch_ip_address

    这将指定使用"diffie-hellman-group-exchange-sha1"作为密钥交换算法。

解决办法

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 root@192.168.5.245

root@192.168.5.245's password:

要是觉得-o后面这一堆参数很难记的话, 有个简单的办法,其实这部分内容就在错误提示信息里面了,从错误信息里面复制就好了.
-oKexAlgorithms=+diffie-hellman-group1-sha1
KexAlgorithms就是指交换秘钥算法的意思.
另一个解决办法

su
echo "KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1" >>/etc/ssh/ssh_config.d/weak.conf

cat /etc/ssh/ssh_config.d/weak.conf

KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1

有加就有减,不支持diffie-hellman-group-exchange-sha1的就使用

ssh -oKexAlgorithms-=diffie-hellman-group-exchange-sha1 



没有评论:

发表评论

在PVE使用虚拟 USB 存储设备 + ARPL 引导 DSM

  部分内容来自: https://blog.myds.cloud/archives/synoboot-usb-image-in-pve-virtual-machine.html 虚拟机建好之后,打开配置文件 nano /etc/pve/qemu-server/100.conf ...