Whereami or guessnet?
Before my hard disk adventure, I used to use whereami to manage my laptop network setup. Whereami is pretty good. It allows me to detect whether a cable is connected to my NIC, and not even bother wasting several minutes in trying to get a DHCP lease. It can run tests on several interfaces, and decide that I am "home" if it finds a known network on either the wireless or the wired interface. Most importantly, it allows me to build a script based on where I actually am, so that I can have my laptop modify several configuration settings that depend on the actual network I'm on -- say, whether or not to use a proxy, or whether or not to use an SMTP smarthost.
I was having issues with whereami lately, however, and thought to look for something else. After all, it's true what they say; whereami does not properly integrate with ifupdown. If you use whereami, modifying the network configuration involves "/etc/init.d/whereami start" or some such; just "ifup eth0" will break things horribly. Additionally, I was having issues with my WPA setup; there is a testwpa, but it does not seem to work for me for some reason—and I can't seem to figure out what's going on in order to file a bug.
Apart from the two issues above, I was having some minor annoyances with my setup; enough so that after reinstalling my system, I thought to try something else. The guessnet package is designed to properly integrate with ifupdown, so I thought I'd give it a try.
I don't think it is what I'm looking for, though.
# route_data = ${lookup{ # ${readfile{/etc/whereami/topmost_location}} # }lsearch{/etc/exim4/smarthosts}} route_data = ${lookup{ ${extract{eth0}{ ${readfile{/etc/network/run/ifsftate}} }} }lsearch{/etc/exim4/smarthosts}} ${lookup{ ${extract{wlan0}{ ${readfile{/etc/network/run/ifstate}} }} }lsearch{/etc/exim4/smarthosts}}
The upper version is what I used with whereami (but not active, see the comment marks :). My script would write something to /etc/whereami/topmost_location, and several other things (including my exim configuration, as shown above) would use that to automagically modify their configuration. Which is pretty cool.
The lower version is the equivalent of the upper version with guessnet. How ugly. And then I didn't even see a way to avoid ifup from trying to 'up' eth0 if the MII tells me there is no cable in the NIC. Oh my.