Networking :: if dhcp else static ip?



Hmm. Well, eth0 is recognized after I use the netcard config script to setup an ip if I boot and no dhcp address is assigned at start. I don't think it is a problem if the card isn't initialized unless it finds an ip.

Maybe its because I'm using a pcmia ethernet card?

Quote

Maybe its because I'm using a pcmia ethernet card?


Yes. Maybe that is it.  I am not familar with that configuration.  I was testing using an internal ethernet card.

There are many way you could write the script but I think the ifconfig command is what would drive your check.  Like or something close to this

ETH0=

ETH0=`ifconfig | grep eth0`
if [  -z ${ETH0}  ]; then
   setup static ip.

etc.


original here.