如何通过ESXi CLI配置HP ProLiant ILO/IPMI

时间:2020-02-23 14:38:20  来源:igfitidea点击:

本教程将向我们展示如何通过ESXi CLI配置HP ProLiant ILO/IPMI。
我最近部署了新的HPE ProLiant DL380 Gen10服务器,并在它们上安装了VMware ESXi虚拟机管理程序以进行虚拟化。
完成管理程序和虚拟机创建的设置后,我意识到我们错过了iLO配置以提供远程服务器管理。
由于我们不想重新启动服务器进入iLO配置界面,因此唯一的选项是通过ESXi CLI配置iLO。

HP ESXi ISO安装填充了可用于管理服务器ILO的脚本。
他们位于 /opt/hp/tools1.以root用户身份登录ESXi服务器:

$ssh Hyman@theitroad
Password: 
The time and date of this login have been sent to the system logs.
VMware offers supported, powerful system administration tools.  Please
see www.vmware.com/go/sysadmintools for details.
The ESXi Shell can be disabled by an administrative user. See the
vSphere Security documentation for more information.
~ #

2.将工作目录更改为/opt/hp/tools

~ # cd /opt/hp/tools
/opt/hp/tools # ls
conrep              hpbootcfg_esxcli    hptestevent_esxcli
conrep.xml          hponcfg            
hpbootcfg           hptestevent
/opt/hp/tools #

hponcfg是一个HP Lights-Out在线配置实用程序。
我们可以通过传递来查看其帮助页面 -h选项

/opt/hp/tools # ./hponcfg -h
HP Lights-Out Online Configuration utility
Version 4.4-0 (c) Hewlett-Packard Company, 2014
Firmware Revision = 2.20 Device type = iLO 4 Driver name = hpilo
iLO IP Address: 192.168.10.2 
USAGE:
  hponcfg  -?
  hponcfg  -h
  hponcfg  -m minFw
  hponcfg  -r [-m minFw ]
  hponcfg  [-a] -w filename [-m minFw]
  hponcfg  -g [-m minFw]
  hponcfg  -f filename [-l filename] [-s namevaluepair] [-v] [-m minFw]
  hponcfg  -i [-l filename] [-s namevaluepair] [-v] [-m minFw]
  -h,  --help           Display this message
  -?                    Display this message
  -r,  --reset          Reset the Management Processor to factory defaults
  -f,  --file           Get/Set Management Processor configuration from "filename" 
  -i,  --input          Get/Set Management Processor configuration from the XML input 
                        received through the standard input stream.
  -w,  --writeconfig    Write the Management Processor configuration to "filename"
  -a,  --all            Capture complete Management Processor configuration to the file.
                        This should be used along with '-w' option
  -l,  --log            Log replies to "filename"
  -v,  --xmlverbose     Display all the responses from Management Processor
  -s,  --substitute     Substitute variables present in input config file
                        with values specified in "namevaluepairs"
  -g,  --get_hostinfo   Get the Host information
  -m,  --minfwlevel     Minimum firmware level

检查IP:

/opt/hp/tools # ./hponcfg -g
HP Lights-Out Online Configuration utility
Version 4.4-0 (c) Hewlett-Packard Company, 2014
Firmware Revision = 2.20 Device type = iLO 4 Driver name = hpilo
iLO IP Address: 0.0.0.0
Host Information:
			Server Name: Esxi01
			Server Serial Number: CDJ5391DM4

3.将当前管理处理器配置导出到文件以进行编辑

/opt/hp/tools # ./hponcfg -w /tmp/hp-ilo.txt
HP Lights-Out Online Configuration utility
Version 4.4-0 (c) Hewlett-Packard Company, 2014
Firmware Revision = 2.20 Device type = iLO 4 Driver name = hpilo
iLO IP Address: 0.0.0.0
Management Processor configuration is successfully written to file "/tmp/hp-ilo.txt"

这将导出当前配置并保存到文件 /tmp/hp-ilo.txt
如果我们第一次修改iLO IP设置,则该文件应如下所示

/opt/hp/tools # cat /tmp/hp-ilo.txt 
<!-- HPONCFG VERSION = "4.4-0.0" -->
<!-- Generated 11/2/2016 17:17:32 -->
<RIBCL VERSION="2.1">
 <LOGIN USER_LOGIN="Administrator" PASSWORD="password">
  <DIR_INFO MODE="write">
  <MOD_DIR_CONFIG>
    <DIR_AUTHENTICATION_ENABLED VALUE = "N"
    <DIR_LOCAL_USER_ACCT VALUE = "Y"
    <DIR_SERVER_ADDRESS VALUE = ""
    <DIR_SERVER_PORT VALUE = "636"
    <DIR_OBJECT_DN VALUE = ""
    <DIR_OBJECT_PASSWORD VALUE = ""
    <DIR_USER_CONTEXT_1 VALUE = ""
    <DIR_USER_CONTEXT_2 VALUE = ""
    <DIR_USER_CONTEXT_3 VALUE = ""
  </MOD_DIR_CONFIG>
  </DIR_INFO>
  <RIB_INFO MODE="write">
  <MOD_NETWORK_SETTINGS>
    <SPEED_AUTOSELECT VALUE = "Y"
    <NIC_SPEED VALUE = "10"
    <FULL_DUPLEX VALUE = "N"
    <IP_ADDRESS VALUE = "0.0.0.0"
    <SUBNET_MASK VALUE = "0.0.0.0"
    <GATEWAY_IP_ADDRESS VALUE = "0.0.0.0"
    <DNS_NAME VALUE = "ILOCZJ5380DM1"
    <PRIM_DNS_SERVER value = "0.0.0.0"
    <DHCP_ENABLE VALUE = "Y"
    <DOMAIN_NAME VALUE = ""
    <DHCP_GATEWAY VALUE = "Y"
    <DHCP_DNS_SERVER VALUE = "Y"
    <DHCP_STATIC_ROUTE VALUE = "Y"
    <DHCP_WINS_SERVER VALUE = "Y"
    <REG_WINS_SERVER VALUE = "Y"
    <PRIM_WINS_SERVER value = "0.0.0.0"
    <STATIC_ROUTE_1 DEST = "0.0.0.0" GATEWAY = "0.0.0.0"
    <STATIC_ROUTE_2 DEST = "0.0.0.0" GATEWAY = "0.0.0.0"
    <STATIC_ROUTE_3 DEST = "0.0.0.0" GATEWAY = "0.0.0.0"
  </MOD_NETWORK_SETTINGS>
  </RIB_INFO>
  <USER_INFO MODE="write">
  </USER_INFO>
 </LOGIN>
</RIBCL>

4.编辑文件以设置iLO IP地址,子网掩码和默认网关

# vi /tmp/hp-ilo.txt

使用正确的值替换值:

<IP_ADDRESS VALUE = "192.168.10.2"
<SUBNET_MASK VALUE = "255.255.255.0"
<GATEWAY_IP_ADDRESS VALUE = "192.168.10.1"
<PRIM_DNS_SERVER value = "192.168.10.1"

还禁用DHCP,因为这是一个静态IP地址

<DHCP_ENABLE VALUE = "N"

我们还可以更改其他设置以适合用例。
完成后,通过按<ESC>键保存文件,然后:WQ

6.启动固件重置以通过运行命令来应用新设置

/opt/hp/tools # ./hponcfg -f  /tmp/hp-ilo.txt
HP Lights-Out Online Configuration utility
Version 4.4-0 (c) Hewlett-Packard Company, 2014
Firmware Revision = 2.20 Device type = iLO 4 Driver name = hpilo
iLO IP Address: 0.0.0.0 
<INFORM> DHCP is currently disabled, enable DHCP to use any DHCP setting.</INFORM>
<INFORM>Integrated Lights-Out will reset at the end of the script.</INFORM>
Please wait while the firmware is reset. This might take a minute    
Script succeeded

如果收到消息"脚本成功",则表示新的IP设置已成功设置。 5.通过打印主机信息确认新的IP设置:

/opt/hp/tools # ./hponcfg -g
HP Lights-Out Online Configuration utility
Version 4.4-0 (c) Hewlett-Packard Company, 2014
Firmware Revision = 2.20 Device type = iLO 4 Driver name = hpilo
iLO IP Address: 192.168.10.2 
Host Information:
			Server Name: Esxi01
			Server Serial Number: CDJ5391DM4

现在登录iLO配置Web控制台 https://<iLO IP Address>