+ if [ -z "$LAVA_SERVER_IP" ]; then
+ # try the IP associated with the default gateway
+ LAVA_SERVER_IP=$(ip route | awk '{ if ($1 == "default") { print($3) } }')
+ fi
Doesn't this return the IP of the gateway? ie, my "ip route" returns:
default via 192.168.0.1 dev eth0 proto static
the idea is pretty good though. just print $5, which would give you "eth0". and then you can pull the ip address via ifconfig $iface
+ if [ -z "$LAVA_SERVER_IP" ]; then
+ # try the IP associated with the default gateway
+ LAVA_SERVER_IP=$(ip route | awk '{ if ($1 == "default") { print($3) } }')
+ fi
Doesn't this return the IP of the gateway? ie, my "ip route" returns:
default via 192.168.0.1 dev eth0 proto static
the idea is pretty good though. just print $5, which would give you "eth0". and then you can pull the ip address via ifconfig $iface