HP服务器在线配置ilo地址

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HP服务器在线配置ilo地址相关的知识,希望对你有一定的参考价值。

安装工具hponcfg

rpm -ivh /share/perdir/chaichuan/ipmi/hponcfg-4.3.0-0.x86_64.rpm

查看帮助 hponcfg ?

192.168.2.145 [/opt] 2015-12-15 16:16:06
[email protected]/0 # hponcfg ?
HP Lights-Out Online Configuration utility
Version 4.2.0 Date 6/10/2013 (c) Hewlett-Packard Company, 2013
Firmware Revision = 1.30 Device type = iLO 4 Driver name = hpilo
Error: Syntax Error.

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

HP DL388 gen9

导出ILO普通配置

 hponcfg -w /tmp/hp_ilo.xml

导出ILO所有配置

 hponcfg -aw /tmp/hp_ilo.xml

修改后导入配置

 hponcfg -f /tmp/hp_ilo.xml

HP DL380 gen8

导出ILO普通配置

 hponcfg -w /tmp/hp_ilo.xml

导出ILO所有配置

 hponcfg [-a] -w /tmp/hp_ilo.xml

修改后导入配置

 hponcfg -f /tmp/hp_ilo.xml

other

hponcfg -w /tmp/outpu.xml   导出ILO 配置文件

导入配置

需要删除用户信息:

 <USER_INFO MODE="write">
  <ADD_USER
    USER_NAME = "user"
    USER_LOGIN = "user"
    PASSWORD = "%user_password%">
    <ADMIN_PRIV value = "Y"/>
    <REMOTE_CONS_PRIV value = "Y"/>
    <RESET_SERVER_PRIV value = "Y"/>
    <VIRTUAL_MEDIA_PRIV value = "Y"/>
    <CONFIG_ILO_PRIV value = "Y"/>
  </ADD_USER>
</USER_INFO>

配置ilo脚本参考

#!/bin/bash
## the scripts from chaichuan
dell=$(dmidecode | grep -ci dell)
hp=$(dmidecode |grep -ci hp)
if [[ ${hp} -gt 0 ]]
then
hostip=`bash /share/yunwei/shell/commonapi/get_hostip_01.sh|awk -F ‘168.‘ ‘{print $2}‘`
echo -e "\033[32m ----check hponcfg---- \033[0m"
echo ""
rpm -qa|grep hponcfg
if [ $? != 0 ]
then
echo -e "\033[31m Warning: hponcfg faild \033[0m"
echo ""
echo  -e "\033[32m install hponcfg \033[0m"
rpm -ivh /share/perdir/chaichuan/ipmi/hponcfg-4.3.0-0.x86_64.rpm >/dev/null 2>&1
else
echo -e "\033[32m hponcfg is OK! \033[0m"
fi
echo ""
echo -e "\033[32m ----configure ilo---- \033[0m"
echo ""
if [ -f /root/ilo.xml ]
then
rm /root/ilo.xml
/sbin/hponcfg -w /root/ilo.xml >/dev/null 2>&1
else
/sbin/hponcfg -w /root/ilo.xml >/dev/null 2>&1
fi
grep user /root/ilo.xml >/dev/null 2>&1
if [ $? == 0 ]
then
cat << EOF > /root/ilo.xml
<!-- HPONCFG VERSION = "4.3.0" -->
 <LOGIN USER_LOGIN="Administrator" PASSWORD="password">
  <RIB_INFO MODE="write">
  <MOD_NETWORK_SETTINGS>
    <IP_ADDRESS VALUE = "172.17.$hostip"/>
    <SUBNET_MASK VALUE = "255.255.0.0"/>
    <GATEWAY_IP_ADDRESS VALUE = "172.17.0.1"/>
    <DHCP_ENABLE VALUE = "N"/>
    <DHCP_GATEWAY VALUE = "N"/>
    <DHCP_DNS_SERVER VALUE = "N"/>
    <DHCP_STATIC_ROUTE VALUE = "N"/>
    <DHCP_WINS_SERVER VALUE = "N"/>
  </MOD_NETWORK_SETTINGS>
  </RIB_INFO>
 </LOGIN>
</RIBCL>
EOF
/sbin/hponcfg -f /root/ilo.xml >/dev/null 2>&1
else
cat << EOF > /root/ilo.xml
<!-- HPONCFG VERSION = "4.3.0" -->
<RIBCL VERSION="2.1">
 <LOGIN USER_LOGIN="Administrator" PASSWORD="password">
  <RIB_INFO MODE="write">
  <MOD_NETWORK_SETTINGS>
    <IP_ADDRESS VALUE = "172.17.$hostip"/>
    <SUBNET_MASK VALUE = "255.255.0.0"/>
    <GATEWAY_IP_ADDRESS VALUE = "172.17.0.1"/>
    <DHCP_ENABLE VALUE = "N"/>
    <DHCP_GATEWAY VALUE = "N"/>
    <DHCP_DNS_SERVER VALUE = "N"/>
    <DHCP_STATIC_ROUTE VALUE = "N"/>
    <DHCP_WINS_SERVER VALUE = "N"/>
  </MOD_NETWORK_SETTINGS>
  </RIB_INFO>
  <USER_INFO MODE="write">
    <ADD_USER
    USER_NAME = "user"
    USER_LOGIN = "user"
    PASSWORD = "passwd">
    <ADMIN_PRIV value = "Y"/>
    <REMOTE_CONS_PRIV value = "Y"/>
    <RESET_SERVER_PRIV value = "Y"/>
    <VIRTUAL_MEDIA_PRIV value = "Y"/>
    <CONFIG_ILO_PRIV value = "Y"/>
  </ADD_USER>
  </USER_INFO>
 </LOGIN>
</RIBCL>
EOF
/sbin/hponcfg -f /root/ilo.xml >/dev/null 2>&1
fi
if [ $? == 0 ]
then
echo ""
echo -e "\033[32m configure is OK! \033[0m"
echo ""
else
echo ""
echo -e "\033[31m configure is error! \033[0m"
echo ""
exit 0
fi
sleep 2
echo ""
echo -e "\033[32m ----check ilo---- \033[0m"
echo ""
rpm -qa|grep -w nc >/dev/null 2>&1
if [ $? != 0 ]
then
yum -y install nc >/dev/null 2>&1
fi
/usr/bin/nc -z -w 3 172.17.$hostip 443
if [ $? != 0 ]
then
echo -e "\033[31m 172.17.$hostip: ilo is error! \033[0m"
echo ""
echo ""
else
echo -e "\033[32m ilo is OK! \033[0m"
echo ""
echo ""
fi
else
exit 0
fi

Ps:/share/yunwei/shell/commonapi/get_hostip_01.sh 脚本内容如下:

 echo `/sbin/ip a | grep -E "eth[0-9]$|em[0-9]$|br[0-9]$|bond[0-9]$" |grep "/2" | awk ‘{print $2}‘|awk -F "/" ‘{print $1}‘ | grep 192.168 | awk -F ‘.‘ ‘$3 < 30 {print $0}‘`

以上是关于HP服务器在线配置ilo地址的主要内容,如果未能解决你的问题,请参考以下文章

如何收集 HP ProLiant 系列服务器iLo日志,iLO出厂默认配置。不可以重启机器

HP ilo4 批量管理

通过check_ilo2_health.pl插件监控HP服务器健康状态

HP 服务器 iLO 远程控制软件 介绍

hp dl388g7服务器上有没有bmc口

HP服务器设置iLO步凑