2023年5月26日星期五

2960X设定启动变量

 

要设置 Cisco 2960x 交换机的启动(boot)变量,可以按照以下步骤进行操作:

  1. 连接到 Cisco 2960x 交换机:使用 SSH 或串行控制台连接到交换机,并进入特权模式。

  2. 输入以下命令以进入全局配置模式:

    configure terminal
  3. 设置启动变量:使用以下命令设置启动变量,将 <image_filename> 替换为实际的启动映像文件名:

    perl
    boot system flash:/<image_filename>

    注意,flash:/ 表示映像文件位于交换机的闪存中。


重复以上命令可以设置多个备用设置












2023年5月24日星期三

2960X救砖方法

 注意那个冒号和斜杠,还有空格,格式要绝对正确,在这个模式下tftp是单向的,只能下载,不能上传,还有,源文件名和目标文件名必须相同,血的教训阿。。。

Initialize the flash:
switch: flash_init

Initialize the management interface:(这一步好像没必要)
switch: mgmt_init

Then assign an IP address to the management interface:
switch: set IP_ADDR 10.1.100.2/255.255.255.0
switch: set DEFAULT_ROUTER 10.1.100.1

Then configure your TFTP server to have an IP on the same subnet and connect it to the management interface of the switch (ie 10.1.100.1/24)

Now to tell the switch to retrieve the firmware image:(这一步前有些机器要做 fsck flash:)
switch: copy tftp://10.1.100.1/c2960x-universalk9-mz.152-5b.E.bin flash:c2960x-universalk9-mz.152-5b.E.bin

The switch should then retrieve the image and save it flash.

Once the copy is complete boot from it with:

switch: boot flash:c2960x-universalk9-mz.152-5b.E.bin

然后可以直接重启,或者重新设定boot变量的值



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 



cisco 配置ssh登陆

 

要配置用户通过 SSH 登录到 Cisco 2960X 交换机,您可以按照以下步骤进行操作:

  1. 连接到 Cisco 2960X 交换机。您可以使用 SSH 客户端(例如 PuTTY)或通过串口进行连接。

  2. 输入管理员凭据登录到交换机的命令行界面。

  3. 进入特权 EXEC 模式,通过输入以下命令:

    bash
    enable
  4. 进入全局配置模式,通过输入以下命令:

    configure terminal
  5. 创建一个新的用户,通过输入以下命令:

    php
    username <username> privilege <privilege-level> secret <password>
    • <username>: 要创建的用户的用户名。
    • <privilege-level>: 用户的特权级别(0-15),其中 15 是最高特权级别。一般情况下,管理员用户的特权级别为 15。
    • <password>: 用户的密码。

    例如,创建一个名为 "user1" 的用户,特权级别为 15,密码为 "password123" 的命令如下:

    username user1 privilege 15 secret password123
    1. 配置域名: ip domain name oyzjin.com
    2. 生成 SSH 密钥对。您可以使用以下命令生成密钥对:
      vbnet
      crypto key generate rsa general-keys modulus <key-size>
      <key-size> 是密钥的大小,可以选择 1024、2048 或 4096。例如,生成一个 2048 位的密钥对,可以使用以下命令:
      perl
      crypto key generate rsa general-keys modulus 2048
    1. 启用 SSH 服务,通过输入以下命令:
      ip ssh version 2
      这将启用 SSHv2 协议。
  6. 配置 VTY 线路以允许用户通过 SSH 登录。输入以下命令:

    lua
    line vty 0 15
    transport input ssh
    login local

    这将配置 VTY 线路以允许通过 SSH 连接登录,并要求进行本地身份验证。


  7. 保存配置并退出配置模式,通过输入以下命令:

    arduino
    end
    write memory

完成上述步骤后,您已成功配置了用户通过 SSH 登录到 Cisco 2960X 交换机。现在,用户可以使用其所创建的用户名和密码通过 SSH 连接到交换机。请确保在使用 SSH 连接之前测试连接以确保一切正常运行。





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

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