Huawei switch

From T2B Wiki
Jump to navigation Jump to search

Enable SSH key-based connection

> rsa peer-public-key MYNAME
> public-key-code begin

then you need to convert the opennssh ssh-rsa public key to this exact format:

ssh-keygen -f id_rsa.pub -e -m pem

Get the text without the surrounding lines

-----BEGIN RSA PUBLIC KEY-----
-----END RSA PUBLIC KEY-----

paste it in this website to get it converted into HEX.

The next step is to format it nicely for the switch:

echo "MY-HEX-KEY" | sed 's/.\{8\}/& /g'|fmt -w 44

which should give you something like that:

30820108 02820101 00B9A077 0AE7C1B7
2285F7DC C6D1CDDC 4D18989C D33BA519
...

Paste all the lines in the switch interface, then finish the key input with

> public-key-code end
> peer-public-key end

The formatting in 8 characters per packet and 5 packets per line was suggested by the output of

> display rsa local-key-pair public