This command is nice but I do not have an access to fixtures during the setup phase. I've just tried this command: 

<pre>ifconfig | grep "inet addr" | sed -r -e 's/^[[:blank:]]+//' | cut -d' ' -f 2 | cut -d: -f2 | grep -vE '^(192|127)' | head -n1</pre>

If we work with ipv4 only here, that might work.