sudo yum -y install ipmitool #安装相关工具
#加载相关内核模块
sudo modprobe ipmi_msghandler
sudo modprobe ipmi_devintf
sudo modprobe ipmi_si
ipmi_ipaddr=’172.16.10.21’
ipmi_netmask=’255.255.255.0’
ipmi_gw=’172.16.10.1’
ipmi_user=admin
ipmi_passwd=V88888
ipmi_channel_no=1
sudo ipmitool user list ${ipmi_channel_no} #显示当前所有用户列表
ipmi_user_id=$(sudo ipmitool user list ${ipmi_channel_no}|grep “${ipmi_user}”|awk ‘{print $1}’) #获取特定用户的id
sudo ipmitool user set password ${ipmi_user_id} ${ipmi_passwd} #给特定用户设置密码。
sudo ipmitool lan set ${ipmi_channel_no} ipsrc static #给ipmi设置IP为静态地址
sudo ipmitool lan set ${ipmi_channel_no} ipaddr ${ipmi_ipaddr} #设置IP
sudo ipmitool lan set ${ipmi_channel_no} netmask ${ipmi_netmask} #设置掩码
#sudo ipmitool lan set ${ipmi_channel_no} defgw ipaddr ${ipmi_gw} #设置网关
sudo ipmitool lan print ${ipmi_channel_no} #显示ipmi网络设置信息。
NONE_COMMNET=
Set in Progress : Set Complete
Auth Type Support : MD2 MD5 PASSWORD
Auth Type Enable : Callback : MD2 MD5 PASSWORD
: User : MD2 MD5 PASSWORD
: Operator : MD2 MD5 PASSWORD
: Admin : MD2 MD5 PASSWORD
: OEM :
IP Address Source : Static Address
IP Address : 172.16.10.21
Subnet Mask : 255.255.255.0
MAC Address : 6c:92:bf:31:71:25
SNMP Community String : Inspur
IP Header : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10
BMC ARP Control : ARP Responses Enabled, Gratuitous ARP Disabled
Gratituous ARP Intrvl : 0.0 seconds
Default Gateway IP : 0.0.0.0
Default Gateway MAC : 00:00:00:00:00:00
Backup Gateway IP : 0.0.0.0
Backup Gateway MAC : 00:00:00:00:00:00
802.1q VLAN ID : Disabled
802.1q VLAN Priority : 0
RMCP+ Cipher Suites : 1,2,3,6,7,8,11,12
Cipher Suite Priv Max : aaaaXXaaaXXaaXX
: X=Cipher Suite Unused
: c=CALLBACK
: u=USER
: o=OPERATOR
: a=ADMIN
: O=OEM