simplified the detection of ip address to use ip route