diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-06 18:04:32 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-06 18:04:32 +0200 |
commit | a7f89980e5b3f4b9a74c70dbc5ffe8aabd28be28 (patch) | |
tree | 41c4deec1fdfbafd7821b4ca7a9772ac0abd92f5 /scripts/ipdiff.sh |
Imported Upstream version 2.9.3upstream/2.9.3
Diffstat (limited to 'scripts/ipdiff.sh')
-rwxr-xr-x | scripts/ipdiff.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/ipdiff.sh b/scripts/ipdiff.sh new file mode 100755 index 0000000..1aeef2a --- /dev/null +++ b/scripts/ipdiff.sh @@ -0,0 +1,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 |