#!/bin/bash # # # checkip # v1.0 (initial) # 08/4/2006 # # Brett Krueger # brett.krueger@ficoh.com # http://www.ficoh.com # # # Check to see if FICOH gateway is on the network, if not... switch to DR type IP scheme # For our DR IFL Linux boxes in Colorado to come up with the correct IP and not # have to manually intervene to bring it online. #defaults FICOH_ROUTER=x.x.x.x DR_ROUTER=x.x.x.x # we start with a bogus ip address # to avoid collisions of any kind. BOGUS_IP=x.x.x.x FICOH_IP=x.x.x.x DR_IP=x.x.x.x # we test to see what network we are on # by hitting the routers with pings. /bin/ping -c 2 -i 3 $FICOH_ROUTER if [ $? != 0 ] ; then /bin/echo "Couldn't ping $FICOH_ROUTER, we're not in FICOH anymore toto" && /sbin/ifconfig eth0 -net $DR_IP netmask 255.255.255.0 up && /sbin/route del 172.17 && /sbin/route add default gw $DR_ROUTER && /bin/rm /etc/resolv.conf && /bin/echo "192.168.25.1" >> /etc/resolv.conf else /bin/echo "Going into FICOH production mode" && /sbin/ifconfig eth0 -net $FICOH_IP netmask 255.255.0.0 up && /sbin/route add default gw $FICOH_ROUTER && /bin/rm /etc/resolv.conf && /bin/echo "nameserver x.x.x.x" >> /etc/resolv.conf && /bin/echo "nameserver x.x.x.x" >> /etc/resolv.conf && /bin/echo "search ficoh.com" >> /etc/resolv.conf fi