I have a laptop with one wired ethernet interface (eth0) and one wireless interface (eth1). I'm using ifupdown. When the computer is not connected to a wired network, while starting up, it is associated with my wireless network and requests and receives an IP address with DHCP. That, however, doesn't satisfy the machine. It proceeds by requesting an address for the wired network as well, despite there being no attached network cable, which holds up the boot process until the DHCP client times out and gives up. What I would like to happen in this situation is that the machine would only try to get an address over the wired network interface if it is actually connected to a network. Otherwise it should try the wireless interface directly.
Here's my solution to this problem. I'm in a similar boat, but on my laptop the two interfaces always request addresses in order: eth0, then eth1. What I wanted to do was similar to what you describe - if it has an address on eth0, don't bother checking on eth1. Here's a snippet from my /etc/network/interfaces file which works well on my machine:
iface eth1 inet dhcp pre-up [ -z "$(ifconfig eth0 | grep 'inet addr:')" ] && true pre-up /sbin/iwconfig eth1 essid <snip> pre-up /sbin/iwconfig eth1 enc on pre-up /sbin/iwconfig eth1 key <snip>I added the pre-up command that queries eth0 before eth1 attempts to get an address. If eth0 has one, it stops the eth1 attempt. But if eth0 does not have an address, then eth1 is permitted to continue through the rest of the pre-up lines.
BTW, I'm not 100% sure that I'm doing that in the most efficient way possible (i.e. I'm not remembering at this moment why I put the '&& true' on the end). Enhancements to this method are certainly welcome.
Thanks, Rick Reynolds --"Released in 1996, Microsoft Visual Basic 6.0 cemented the product as the first choice of buggy front-ends to databases everywhere. In fact, if you wanted a buggy front-end to your corporate database, there was no better choice." -- Andrew Orlowski