rss logo

Some HP Switching useful commands

HP logo

Configuration

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

Commands

  • 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 192.168.20.10 255.255.255.0
  • Set default gateway :
[Switch] ip route-static 0.0.0.0 0.0.0.0 192.168.1.254
  • 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"

Display

  • 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

Users

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

SSH

  • 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

STP

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

Security

  • 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"

NTP

  • Specify the ntp server :
[Switch] ntp-service unicast-server 192.168.1.100
  • 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

VLAN and TRUNK

VLAN

  • 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

Trunk

  • 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 https://h10145.www1.hpe.com/downloads/

  • 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