I have a Ubuntu 12.04 VM (VirtualBox) with two adapters, which are bridged to the cabled LAN (eth0) and Wireless LAN (eth2). Both of them are configured as DHCP. Since the host will always be connected via either the LAN or the Wireless adapter (i.e. one of the two will always be disconnected), one of the two adapters in Ubuntu will always be without IP, because it won't be able to query the DHCP server. In such case, I would like to trigger an
ifconfig eth(x) down when the interface doesn't have an IP address.
I've read that it's possible to run scripts related to the network adapters, but I'm not really sure how to do so.
Thanks in advance for the answers.