blob: 1aeef2a8e27eac68b7fbed039aee7d2f38aa8502 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# ipdiff.sh
# For non-shared BMC LAN channels, take the OS IP and add an increment,
# then run pefconfig -I to set the new BMC LAN IP.
#
# eth: Get the OS IP from eth0 by default
# incr: Increment is 128. by default
# Customers may wish to customize the $eth and $incr parameters below to
# vary these for their network environments.
#
# This produces a series of systems with IP addresses allocated like this:
# OS IP BMC LAN IP
# system1 192.168.0.1 192.168.0.129
# system2 192.168.0.2 192.168.0.130
# system3 192.168.0.3 192.168.0.131
# ...
eth=eth0
incr=128
ip=`ifconfig $eth |grep "inet addr:" |cut -f2 -d':' |awk '{print $1}'`
last=`echo $ip |cut -f4 -d'.'`
first=`echo $ip |cut -f1-3 -d'.'`
sysname=`uname -n`
newlast=`expr $last + $incr`
if [ $newlast -ge 255 ]
then
# overflow, so wrap IP (could return error instead)
newlast=`expr $newlast - 255`
fi
newip=${first}.${newlast}
echo "$sysname: $eth IP = $ip, BMC IP = $newip"
ipmiutil lan -e -I $newip
|