[olug] Alternate IP Configuration?

Terry td3201 at gmail.com
Sun Oct 3 20:10:02 UTC 2004


You could hardcode it into the init scripts pretty easily....as simple
as in your rc.local do like:

IPADDR=`cat /etc/sysconfig/network-scripts/ifcfg-eth0  | grep IPADDR |
cut -d"=" -f2`
FOO=`ifconfig eth0`
if grep "inet addr" $FOO;then
  echo "true"
else
  ifconfig eth0 $IPADDR netmask 255.255.255.0 up
  route add default gw 192.168.1.1 eth0
fi

That's about the ugliest thing I have ever thought of....but it could work.

Also, again if you use redhat/fedora, you could alter the
/etc/sysconfig/network-scripts/ifup script to check for DHCP fails and
run the process with a different config somehow.  For example, have a
config for DHCP and a config for static.  That would take more work
but again, would work.

The script above would work with any linux except you have to find a
different way to extract the static IP address from your system
configuration on systems other than redhat/fedora.

Good luck,
Terry 

On Sun, 3 Oct 2004 18:46:14 +0000, Adam Lassek <adam.lassek at gmail.com> wrote:
> Is there are way to set up linux similar to Windows' alternate IP
> configuration, where it tries dhcp first and if that fails uses a
> static address you assign?
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug
>



More information about the OLUG mailing list