xref: /openbmc/ipmitool/contrib/bmclanconf (revision c18ec02f)
1*c18ec02fSPetter Reinholdtsen#!/bin/bash
2*c18ec02fSPetter Reinholdtsen#
3*c18ec02fSPetter Reinholdtsen# Copyright (c) 2003 Sun Microsystems, Inc.  All Rights Reserved.
4*c18ec02fSPetter Reinholdtsen#
5*c18ec02fSPetter Reinholdtsen# Redistribution and use in source and binary forms, with or without
6*c18ec02fSPetter Reinholdtsen# modification, are permitted provided that the following conditions
7*c18ec02fSPetter Reinholdtsen# are met:
8*c18ec02fSPetter Reinholdtsen#
9*c18ec02fSPetter Reinholdtsen# Redistribution of source code must retain the above copyright
10*c18ec02fSPetter Reinholdtsen# notice, this list of conditions and the following disclaimer.
11*c18ec02fSPetter Reinholdtsen#
12*c18ec02fSPetter Reinholdtsen# Redistribution in binary form must reproduce the above copyright
13*c18ec02fSPetter Reinholdtsen# notice, this list of conditions and the following disclaimer in the
14*c18ec02fSPetter Reinholdtsen# documentation and/or other materials provided with the distribution.
15*c18ec02fSPetter Reinholdtsen#
16*c18ec02fSPetter Reinholdtsen# Neither the name of Sun Microsystems, Inc. or the names of
17*c18ec02fSPetter Reinholdtsen# contributors may be used to endorse or promote products derived
18*c18ec02fSPetter Reinholdtsen# from this software without specific prior written permission.
19*c18ec02fSPetter Reinholdtsen#
20*c18ec02fSPetter Reinholdtsen# This software is provided "AS IS," without a warranty of any kind.
21*c18ec02fSPetter Reinholdtsen# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
22*c18ec02fSPetter Reinholdtsen# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
23*c18ec02fSPetter Reinholdtsen# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
24*c18ec02fSPetter Reinholdtsen# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
25*c18ec02fSPetter Reinholdtsen# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
26*c18ec02fSPetter Reinholdtsen# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.  IN NO EVENT WILL
27*c18ec02fSPetter Reinholdtsen# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
28*c18ec02fSPetter Reinholdtsen# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
29*c18ec02fSPetter Reinholdtsen# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
30*c18ec02fSPetter Reinholdtsen# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
31*c18ec02fSPetter Reinholdtsen# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
32*c18ec02fSPetter Reinholdtsen
33*c18ec02fSPetter Reinholdtsen
34*c18ec02fSPetter Reinholdtsen# This script is designed for Sun Fire LX50, V60x and V65x systems.
35*c18ec02fSPetter Reinholdtsen# It may work with other setups as long as you use the correct channel
36*c18ec02fSPetter Reinholdtsen# and interface settings.  It can be used on the V20z as long as you
37*c18ec02fSPetter Reinholdtsen# specify network settings on the command line.
38*c18ec02fSPetter Reinholdtsen#
39*c18ec02fSPetter Reinholdtsen# If the wrong channel is used you could lose network access to the
40*c18ec02fSPetter Reinholdtsen# box because your BMC will be sending out bad Gratuitous ARP packets
41*c18ec02fSPetter Reinholdtsen# with the wrong MAC address.  You will need to use a console or
42*c18ec02fSPetter Reinholdtsen# override your local ARP cache with the correct addr.
43*c18ec02fSPetter Reinholdtsen
44*c18ec02fSPetter Reinholdtsenusage ()
45*c18ec02fSPetter Reinholdtsen{
46*c18ec02fSPetter Reinholdtsen    echo "
47*c18ec02fSPetter Reinholdtsenusage: $0 -c <chan> -i <interface> [options]
48*c18ec02fSPetter Reinholdtsen       $0 -c <chan> [-v|w|x|y|z address] [options]
49*c18ec02fSPetter Reinholdtsen
50*c18ec02fSPetter Reinholdtsen    -c channel     Which BMC channel to configure [-c help for more info]
51*c18ec02fSPetter Reinholdtsen    -i interface   Auto-configure BMC based on interface network settings
52*c18ec02fSPetter Reinholdtsen    -v address     Use specified IP address
53*c18ec02fSPetter Reinholdtsen    -w address     Use specified Netmask address
54*c18ec02fSPetter Reinholdtsen    -x address     Use specified MAC address
55*c18ec02fSPetter Reinholdtsen    -y address     Use specified Gateway IP address
56*c18ec02fSPetter Reinholdtsen    -z address     Use specified Gateway MAC address
57*c18ec02fSPetter Reinholdtsen    -m interface   Which IPMI interface to use [default linux=open solaris=lipmi]
58*c18ec02fSPetter Reinholdtsen    -p password    Set BMC channel password
59*c18ec02fSPetter Reinholdtsen    -s string      Set SNMP community string
60*c18ec02fSPetter Reinholdtsen    -a interval    Set Gratuitous ARP interval, off=0, default=4
61*c18ec02fSPetter Reinholdtsen    -r             Reset BMC channel, zero all network settings, disable
62*c18ec02fSPetter Reinholdtsen    -d             Debug mode, does not make any changes
63*c18ec02fSPetter Reinholdtsen"
64*c18ec02fSPetter Reinholdtsen    exit 0;
65*c18ec02fSPetter Reinholdtsen}
66*c18ec02fSPetter Reinholdtsen
67*c18ec02fSPetter Reinholdtsenchannel_usage ()
68*c18ec02fSPetter Reinholdtsen{
69*c18ec02fSPetter Reinholdtsen    echo "
70*c18ec02fSPetter Reinholdtsen Sun Fire V60x and V65x - Linux 2.4
71*c18ec02fSPetter Reinholdtsen   eth0 = channel 6, top
72*c18ec02fSPetter Reinholdtsen   eth1 = channel 7, bottom
73*c18ec02fSPetter Reinholdtsen
74*c18ec02fSPetter Reinholdtsen Sun Fire V60x and V65x - Linux 2.6
75*c18ec02fSPetter Reinholdtsen   eth0 = channel 7, bottom
76*c18ec02fSPetter Reinholdtsen   eth1 = channel 6, top
77*c18ec02fSPetter Reinholdtsen
78*c18ec02fSPetter Reinholdtsen Sun Fire V60x and V65x - Solaris x86
79*c18ec02fSPetter Reinholdtsen   e1000g0 = channel 7, bottom
80*c18ec02fSPetter Reinholdtsen   e1000g1 = channel 6, top
81*c18ec02fSPetter Reinholdtsen
82*c18ec02fSPetter Reinholdtsen Sun LX50 - Linux
83*c18ec02fSPetter Reinholdtsen   eth0 = channel 7, bottom
84*c18ec02fSPetter Reinholdtsen   eth1 = channel 6, top
85*c18ec02fSPetter Reinholdtsen
86*c18ec02fSPetter Reinholdtsen Sun LX50 - Solaris x86
87*c18ec02fSPetter Reinholdtsen   le0 = channel 7, bottom
88*c18ec02fSPetter Reinholdtsen   le1 = channel 6, top
89*c18ec02fSPetter Reinholdtsen
90*c18ec02fSPetter Reinholdtsen Sun Fire V20z (-i option does not apply)
91*c18ec02fSPetter Reinholdtsen   channel 1
92*c18ec02fSPetter Reinholdtsen"
93*c18ec02fSPetter Reinholdtsen    exit 0
94*c18ec02fSPetter Reinholdtsen}
95*c18ec02fSPetter Reinholdtsen
96*c18ec02fSPetter Reinholdtsenhex_to_ip ()
97*c18ec02fSPetter Reinholdtsen{
98*c18ec02fSPetter Reinholdtsen    test $# -ge 1 || return;
99*c18ec02fSPetter Reinholdtsen    local HEX B1 B2 B3 B4;
100*c18ec02fSPetter Reinholdtsen    HEX=`echo $1 | tr '[:lower:]' '[:upper:]'`;
101*c18ec02fSPetter Reinholdtsen    H1=`echo $HEX | cut -c1-2`
102*c18ec02fSPetter Reinholdtsen    H2=`echo $HEX | cut -c3-4`
103*c18ec02fSPetter Reinholdtsen    H3=`echo $HEX | cut -c5-6`
104*c18ec02fSPetter Reinholdtsen    H4=`echo $HEX | cut -c7-8`
105*c18ec02fSPetter Reinholdtsen    B1=`echo 10 o 16 i $H1 p | dc`
106*c18ec02fSPetter Reinholdtsen    B2=`echo 10 o 16 i $H2 p | dc`
107*c18ec02fSPetter Reinholdtsen    B3=`echo 10 o 16 i $H3 p | dc`
108*c18ec02fSPetter Reinholdtsen    B4=`echo 10 o 16 i $H4 p | dc`
109*c18ec02fSPetter Reinholdtsen    echo "$B1.$B2.$B3.$B4"
110*c18ec02fSPetter Reinholdtsen}
111*c18ec02fSPetter Reinholdtsen
112*c18ec02fSPetter Reinholdtsenipmitool_lan_set ()
113*c18ec02fSPetter Reinholdtsen{
114*c18ec02fSPetter Reinholdtsen    [ $# -lt 1 ] && return
115*c18ec02fSPetter Reinholdtsen    local PARAM=$1
116*c18ec02fSPetter Reinholdtsen    local VALUE=
117*c18ec02fSPetter Reinholdtsen    [ $# -ge 2 ] && VALUE=$2
118*c18ec02fSPetter Reinholdtsen
119*c18ec02fSPetter Reinholdtsen    if [ $DEBUG -gt 0 ]; then
120*c18ec02fSPetter Reinholdtsen	echo "Setting LAN parameter $PARAM $VALUE"
121*c18ec02fSPetter Reinholdtsen	echo "$IPMITOOL -I $IPMIINTF lan set $CHANNEL $PARAM $VALUE"
122*c18ec02fSPetter Reinholdtsen	return
123*c18ec02fSPetter Reinholdtsen    fi
124*c18ec02fSPetter Reinholdtsen
125*c18ec02fSPetter Reinholdtsen    $IPMITOOL -I $IPMIINTF lan set $CHANNEL $PARAM $VALUE
126*c18ec02fSPetter Reinholdtsen}
127*c18ec02fSPetter Reinholdtsen
128*c18ec02fSPetter Reinholdtsenipmitool_lan_reset ()
129*c18ec02fSPetter Reinholdtsen{
130*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "ipsrc" "static"
131*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "ipaddr" "0.0.0.0"
132*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "netmask" "0.0.0.0"
133*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "macaddr" "00:00:00:00:00:00"
134*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "defgw ipaddr" "0.0.0.0"
135*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "defgw macaddr" "00:00:00:00:00:00"
136*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "password"
137*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "snmp" "public"
138*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "arp generate" "off"
139*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "access" "off"
140*c18ec02fSPetter Reinholdtsen    exit 0
141*c18ec02fSPetter Reinholdtsen}
142*c18ec02fSPetter Reinholdtsen
143*c18ec02fSPetter ReinholdtsenDEBUG=0
144*c18ec02fSPetter ReinholdtsenLINUX=0
145*c18ec02fSPetter ReinholdtsenSOLARIS=0
146*c18ec02fSPetter ReinholdtsenCHANNEL=0
147*c18ec02fSPetter ReinholdtsenIFACE=
148*c18ec02fSPetter ReinholdtsenPASSWORD=
149*c18ec02fSPetter ReinholdtsenSNMP=
150*c18ec02fSPetter ReinholdtsenGRATARP=8
151*c18ec02fSPetter ReinholdtsenPATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin
152*c18ec02fSPetter Reinholdtsen
153*c18ec02fSPetter Reinholdtsencase `uname -s` in
154*c18ec02fSPetter Reinholdtsen    Linux)
155*c18ec02fSPetter Reinholdtsen	IPMIINTF=open
156*c18ec02fSPetter Reinholdtsen	IPMITOOL=ipmitool
157*c18ec02fSPetter Reinholdtsen	PING=ping
158*c18ec02fSPetter Reinholdtsen	IFCONFIG=ifconfig
159*c18ec02fSPetter Reinholdtsen	ARP=arp
160*c18ec02fSPetter Reinholdtsen	ROUTE=route
161*c18ec02fSPetter Reinholdtsen	;;
162*c18ec02fSPetter Reinholdtsen    SunOS)
163*c18ec02fSPetter Reinholdtsen	IPMIINTF=lipmi
164*c18ec02fSPetter Reinholdtsen	IPMITOOL=ipmiadm
165*c18ec02fSPetter Reinholdtsen	PING=ping
166*c18ec02fSPetter Reinholdtsen	IFCONFIG=ifconfig
167*c18ec02fSPetter Reinholdtsen	ARP=arp
168*c18ec02fSPetter Reinholdtsen	ROUTE=route
169*c18ec02fSPetter Reinholdtsen	;;
170*c18ec02fSPetter Reinholdtsen    *)
171*c18ec02fSPetter Reinholdtsen	echo "Invalid OS!"
172*c18ec02fSPetter Reinholdtsen	exit 1
173*c18ec02fSPetter Reinholdtsenesac
174*c18ec02fSPetter Reinholdtsen
175*c18ec02fSPetter Reinholdtsenwhile getopts "dhri:c:m:p:s:a:v:w:x:y:z:" OPTION ; do
176*c18ec02fSPetter Reinholdtsen    case "$OPTION" in
177*c18ec02fSPetter Reinholdtsen	i) IFACE=$OPTARG ;;
178*c18ec02fSPetter Reinholdtsen	c) CHANNEL=$OPTARG ; test X$CHANNEL = Xhelp && channel_usage ;;
179*c18ec02fSPetter Reinholdtsen	m) IPMIINTF=$OPTARG ;;
180*c18ec02fSPetter Reinholdtsen	p) PASSWORD=$OPTARG ;;
181*c18ec02fSPetter Reinholdtsen	s) SNMP=$OPTARG ;;
182*c18ec02fSPetter Reinholdtsen	a) GRATARP=$OPTARG ;;
183*c18ec02fSPetter Reinholdtsen	d) DEBUG=1 ;;
184*c18ec02fSPetter Reinholdtsen	v) IP_ADDRESS=$OPTARG ;;
185*c18ec02fSPetter Reinholdtsen	w) IP_NETMASK=$OPTARG ;;
186*c18ec02fSPetter Reinholdtsen	x) MAC_ADDRESS=$OPTARG ;;
187*c18ec02fSPetter Reinholdtsen	y) GATEWAY_IP=$OPTARG ;;
188*c18ec02fSPetter Reinholdtsen	z) GATEWAY_MAC=$OPTARG ;;
189*c18ec02fSPetter Reinholdtsen	r) ipmitool_lan_reset ;;
190*c18ec02fSPetter Reinholdtsen	h) usage ;;
191*c18ec02fSPetter Reinholdtsen	*) echo "Ignoring invalid option : -$OPTARG" ;;
192*c18ec02fSPetter Reinholdtsen    esac
193*c18ec02fSPetter Reinholdtsendone
194*c18ec02fSPetter Reinholdtsen
195*c18ec02fSPetter Reinholdtsenif [ ! -x `which $IPMITOOL` ]; then
196*c18ec02fSPetter Reinholdtsen    echo "Error: unable to find $IPMITOOL"
197*c18ec02fSPetter Reinholdtsen    exit 1
198*c18ec02fSPetter Reinholdtsenfi
199*c18ec02fSPetter Reinholdtsen
200*c18ec02fSPetter Reinholdtsenif [ $CHANNEL -eq 0 ]; then
201*c18ec02fSPetter Reinholdtsen    echo
202*c18ec02fSPetter Reinholdtsen    echo "Error: you must specify a channel with -c"
203*c18ec02fSPetter Reinholdtsen    echo
204*c18ec02fSPetter Reinholdtsen    exit 1
205*c18ec02fSPetter Reinholdtsenfi
206*c18ec02fSPetter Reinholdtsen
207*c18ec02fSPetter Reinholdtsenif [ "$IFACE" ]; then
208*c18ec02fSPetter Reinholdtsen    if ! $IFCONFIG $IFACE 2>/dev/null | grep "inet " >/dev/null 2>&1 ; then
209*c18ec02fSPetter Reinholdtsen	echo
210*c18ec02fSPetter Reinholdtsen	echo "Error: unable to find interface $IFACE"
211*c18ec02fSPetter Reinholdtsen	echo
212*c18ec02fSPetter Reinholdtsen	exit 1
213*c18ec02fSPetter Reinholdtsen    fi
214*c18ec02fSPetter Reinholdtsen    echo "Auto-configuring $IFACE (channel $CHANNEL)"
215*c18ec02fSPetter Reinholdtsenfi
216*c18ec02fSPetter Reinholdtsen
217*c18ec02fSPetter Reinholdtsencase `uname -s` in
218*c18ec02fSPetter Reinholdtsen    SunOS)
219*c18ec02fSPetter Reinholdtsen	if [ X$IFACE != X ]; then
220*c18ec02fSPetter Reinholdtsen	    if [ X$IP_ADDRESS = X ]; then
221*c18ec02fSPetter Reinholdtsen		IP_ADDRESS=`$IFCONFIG $IFACE | grep inet | awk '{print $2}'`
222*c18ec02fSPetter Reinholdtsen	    fi
223*c18ec02fSPetter Reinholdtsen	    if [ X$IP_NETMASK = X ]; then
224*c18ec02fSPetter Reinholdtsen		HEX_NETMASK=`$IFCONFIG $IFACE | grep netmask | awk '{print $4}'`
225*c18ec02fSPetter Reinholdtsen		IP_NETMASK=`hex_to_ip $HEX_NETMASK`
226*c18ec02fSPetter Reinholdtsen	    fi
227*c18ec02fSPetter Reinholdtsen	    if [ X$MAC_ADDRESS = X ]; then
228*c18ec02fSPetter Reinholdtsen		MAC_ADDRESS=`$IFCONFIG $IFACE | grep ether | awk '{print $2}'`
229*c18ec02fSPetter Reinholdtsen	    fi
230*c18ec02fSPetter Reinholdtsen	    if [ X$GATEWAY_IP = X ]; then
231*c18ec02fSPetter Reinholdtsen		GATEWAY_IP=`$ROUTE -n get default | grep gateway: | awk '{print $2}'`
232*c18ec02fSPetter Reinholdtsen	    fi
233*c18ec02fSPetter Reinholdtsen	    if [ X$GATEWAY_MAC = X ]; then
234*c18ec02fSPetter Reinholdtsen		$PING -i $IFACE $GATEWAY_IP 1 >/dev/null 2>&1
235*c18ec02fSPetter Reinholdtsen		GATEWAY_MAC=`$ARP $GATEWAY_IP | awk '{print $4}'`
236*c18ec02fSPetter Reinholdtsen		if [ X$GATEWAY_MAC = Xno ]; then
237*c18ec02fSPetter Reinholdtsen		    GATEWAY_MAC=
238*c18ec02fSPetter Reinholdtsen		fi
239*c18ec02fSPetter Reinholdtsen	    fi
240*c18ec02fSPetter Reinholdtsen	fi
241*c18ec02fSPetter Reinholdtsen	;;
242*c18ec02fSPetter Reinholdtsen
243*c18ec02fSPetter Reinholdtsen    Linux)
244*c18ec02fSPetter Reinholdtsen	if [ X$IFACE != X ]; then
245*c18ec02fSPetter Reinholdtsen	    if [ X$IP_ADDRESS = X ]; then
246*c18ec02fSPetter Reinholdtsen		IP_ADDRESS=`$IFCONFIG $IFACE | grep "inet addr" | awk -F"[:[:space:]]+" '{print $4}'`
247*c18ec02fSPetter Reinholdtsen	    fi
248*c18ec02fSPetter Reinholdtsen	    if [ X$IP_NETMASK = X ]; then
249*c18ec02fSPetter Reinholdtsen		IP_NETMASK=`$IFCONFIG $IFACE | grep Bcast | awk -F"[:[:space:]]+" '{print $8}'`
250*c18ec02fSPetter Reinholdtsen	    fi
251*c18ec02fSPetter Reinholdtsen	    if [ X$MAC_ADDRESS = X ]; then
252*c18ec02fSPetter Reinholdtsen		MAC_ADDRESS=`$IFCONFIG $IFACE | grep HWaddr | awk '{print $5}'`
253*c18ec02fSPetter Reinholdtsen	    fi
254*c18ec02fSPetter Reinholdtsen	    if [ X$GATEWAY_IP = X ]; then
255*c18ec02fSPetter Reinholdtsen		GATEWAY_IP=`$ROUTE -n | awk '/^0.0.0.0/ {print $2}'`
256*c18ec02fSPetter Reinholdtsen	    fi
257*c18ec02fSPetter Reinholdtsen	    if [ X$GATEWAY_MAC = X ]; then
258*c18ec02fSPetter Reinholdtsen		$PING -q -c1 $GATEWAY_IP >/dev/null 2>&1
259*c18ec02fSPetter Reinholdtsen		GATEWAY_MAC=`$ARP -an | grep "$GATEWAY_IP[^0-9]" | awk '{print $4}'`
260*c18ec02fSPetter Reinholdtsen	    fi
261*c18ec02fSPetter Reinholdtsen	fi
262*c18ec02fSPetter Reinholdtsen	;;
263*c18ec02fSPetter Reinholdtsenesac
264*c18ec02fSPetter Reinholdtsen
265*c18ec02fSPetter Reinholdtsenif [ X$IP_ADDRESS != X ]; then
266*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "ipsrc" "static"
267*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "ipaddr" "$IP_ADDRESS"
268*c18ec02fSPetter Reinholdtsenfi
269*c18ec02fSPetter Reinholdtsen
270*c18ec02fSPetter Reinholdtsenif [ X$IP_NETMASK != X ]; then
271*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "netmask" "$IP_NETMASK"
272*c18ec02fSPetter Reinholdtsenfi
273*c18ec02fSPetter Reinholdtsen
274*c18ec02fSPetter Reinholdtsenif [ X$MAC_ADDRESS != X ]; then
275*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "macaddr" "$MAC_ADDRESS"
276*c18ec02fSPetter Reinholdtsenfi
277*c18ec02fSPetter Reinholdtsen
278*c18ec02fSPetter Reinholdtsenif [ X$GATEWAY_IP != X ]; then
279*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "defgw ipaddr" "$GATEWAY_IP"
280*c18ec02fSPetter Reinholdtsenfi
281*c18ec02fSPetter Reinholdtsen
282*c18ec02fSPetter Reinholdtsenif [ X$GATEWAY_MAC != X ]; then
283*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "defgw macaddr" "$GATEWAY_MAC"
284*c18ec02fSPetter Reinholdtsenfi
285*c18ec02fSPetter Reinholdtsen
286*c18ec02fSPetter Reinholdtsenif [ X$PASSWORD != X ]; then
287*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "password" "$PASSWORD"
288*c18ec02fSPetter Reinholdtsenfi
289*c18ec02fSPetter Reinholdtsen
290*c18ec02fSPetter Reinholdtsenif [ X$SNMP != X ]; then
291*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "snmp" "$SNMP"
292*c18ec02fSPetter Reinholdtsenfi
293*c18ec02fSPetter Reinholdtsen
294*c18ec02fSPetter Reinholdtsenif [ "$GRATARP" -ne 0 ]; then
295*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "arp generate" "on"
296*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "arp interval" "$GRATARP"
297*c18ec02fSPetter Reinholdtsenelse
298*c18ec02fSPetter Reinholdtsen    ipmitool_lan_set "arp generate" "off"
299*c18ec02fSPetter Reinholdtsenfi
300*c18ec02fSPetter Reinholdtsen
301*c18ec02fSPetter Reinholdtsenecho "Setting channel authentication capabilities"
302*c18ec02fSPetter Reinholdtsenipmitool_lan_set "auth callback,user,operator,admin" "md2,md5"
303*c18ec02fSPetter Reinholdtsen
304*c18ec02fSPetter Reinholdtsenecho "Enabling channel $CHANNEL"
305*c18ec02fSPetter Reinholdtsenipmitool_lan_set "access" "on"
306*c18ec02fSPetter Reinholdtsenipmitool_lan_set "user"
307*c18ec02fSPetter Reinholdtsen
308*c18ec02fSPetter Reinholdtsenexit 0
309