Refactor find_node_ip_in_network

Refactor find_node_ip_in_network so that it is simplier and works
with multiple interfaces, networks and ipv4/ipv6.