rss logo

Some HP Switching useful commands

HP logo


  • Switch models : HP 5130-24G-4SFP+ EI JG932A, HP 5130-24G-SFP-4SFP+ EI JG933A


  • Enter system view/global configuration mode (equivalent to conf t in Cisco) :
<Switch> system-view
  • Undo parameter :
[Switch] undo stp enable
  • Change hostname :
[Switch] sysname Switch
  • Save current config :
[Switch] save [Switch] save force
  • Set switch ip :
[Switch] interface vlan-interface 1 ip address
  • Set default gateway :
[Switch] ip route-static
  • Reboot :
<Switch> reboot
  • Set clibanner :
[Switch] header legal "Configures the banner to be displayed before a user inputs the username and password to access the CLI" [Switch] header motd "Configures the greeting banner to be displayed before the legal banner appears"


  • Get firmware information and display boot order :
<Switch> display boot-loader
  • Display serial number :
<Switch> display device manuinfo slot 1
  • Display device informations :
<Switch> display device <Switch> display system stable state <Switch> display version
  • Display mac address learned :
<Switch> display mac-address


Old (Comware 5)

  • Create and set admin user :
[Switch] local-user admin [Switch-luser-manage-admin] password simple password [Switch-luser-manage-admin] authorization-attribute level 3

New (Comware 7)

  • Create and set admin user :
[Switch] local-user admin [Switch-luser-manage-admin] password p@ssw0rd:p p@ssw0rd:p [Switch-luser-manage-admin] authorization-attribute user-role network-admin


  • Generate rsa key :
[Switch] public-key local create rsa
  • Enable ssh service :
[Switch] ssh server enable
  • Disable ssh version 1 :
[Switch] undo ssh server compatible-ssh1x
  • Enable scheme authentication on the user lines for ssh users :
[Switch] local-user admin [Switch-luser-manage-admin] service-type ssh


  • Enable STP :
[Switch] stp enable
  • RTSP :
[Switch] stp mode rtsp
  • Set bridge priority :
[Switch] stp root primary
  • Show stp informations :
<Switch> display stp


  • Password to console access :
[Switch] line aux 0 [Switch-line-aux0] authentication-mode password [Switch-line-aux0] set authentication password simple "password"
  • Auto logoff :
[Switch] line aux 0 [Switch-line-aux0] idle-timeout "minutes" "seconds"
  • Timeout after 3 unsuccessful password :
[Switch] password-control login-attempt 3 exceed lock-time 120
  • Disable telnet :
[Switch] no telnet server enable
  • Deny username or reversed username in password :
[Switch] password-control complexity user-name check
  • Specify the minimum number of password composition types (letters, numbers, symbols) :
[Switch] password-control composition type-number "type number"


  • Specify the ntp server :
[Switch] ntp-service unicast-server
  • Specify the vlan in which the ntp server is (optionnal) :
[Switch] ntp-service source vlan-interface 10
  • Start ntp service :
[Switch] ntp-service enable
  • Display current time :
[Switch] show clock



  • Create VLAN and set name :
[Switch] vlan 10 [Switch-vlan10] name ADMIN
  • Associate VLAN to an interface :
[Switch] interface GigabitEthernet 1/0/1 [Switch-GigabitEthernet1/0/1] port link-type access [Switch-GigabitEthernet1/0/1] port access vlan 10


  • Configure TRUNK interface :
[Switch] interface GigabitEthernet 1/0/24 [Switch-GigabitEthernet1/0/24] port link-type trunk [Switch-GigabitEthernet1/0/24] port trunk permit vlan 1 10

Update Firmware

You can find new firmware on

  • Upload new firmware from a tftp server to the HP switch :
<Switch> tftp TFTP_SERVER get FIRMWARE.ipe
  • Set the switch to boot from the new release :
<Switch> boot-loader file flash:/FIRMWARE.ipe slot 1 main
  • Check boot order :
<Switch> display boot-loader
  • Reboot :
<Switch> reboot
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :

contact mail address