Improved net connection testing

Previously relied on ping, which gives false negative if icmp is blocked. Now uses dns.