Solved ping: UDP connect: No route to host

Hello Gentlemen.

New 13-STABLE setup:
Code:
# uname -a
FreeBSD server.localnetwork 13.0-STABLE FreeBSD 13.0-STABLE #0: Wed Jul  7 01:15:25 +05 2021     me@server.local/usr/obj/usr/src-13/amd64.amd64/sys/GENERIC  amd64
Dummy /etc/resolv.conf
Code:
nameserver 8.8.8.8
nameserver 8.8.4.4
Code:
# nslookup google.com
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   google.com
Address: 142.251.1.101
Name:   google.com
Address: 142.251.1.113
Name:   google.com
Address: 142.251.1.100
Name:   google.com
Address: 142.251.1.138
Name:   google.com
Address: 142.251.1.139
Name:   google.com
Address: 142.251.1.102
Name:   google.com
Address: 2a00:1450:4010:c0b::66
Name:   google.com
Address: 2a00:1450:4010:c0b::8b
Name:   google.com
Address: 2a00:1450:4010:c0b::8a
Name:   google.com
Address: 2a00:1450:4010:c0b::71
Issue:
Code:
# ping google.com
ping: UDP connect: No route to host
But by IP is allright:
Code:
ping -c 3 142.251.1.101
PING 142.251.1.101 (142.251.1.101): 56 data bytes
64 bytes from 142.251.1.101: icmp_seq=0 ttl=105 time=165.703 ms
64 bytes from 142.251.1.101: icmp_seq=1 ttl=105 time=173.701 ms
64 bytes from 142.251.1.101: icmp_seq=2 ttl=105 time=165.114 ms

--- 142.251.1.101 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 165.114/168.173/173.701/3.917 ms

Any thought?
 
Ok, replied to myself.

ping is now combined -4 and -6 IP versions. So it needs to supply corresponding switch to distinguish that in uncertain situations.
 
I had the same problem. I discovered the default route was not set properly.
Execute netstat -nr command in your terminal to see whether the default route is Ok.
If not, set it by adding this configuration
Code:
defaultrouter="xx.xx.xx.xx"
to your /etc/rc.conf file. xx.xx.xx.xx is the router IP.
Then restart the network:
/etc/rc.d/netif restart && /etc/rc.d/routing restart.
 
When invoked with a hostname, the version to which the target is resolved
first is used. In that case, the options and arguments used must be
valid for the specific IP version, otherwise ping exits with an error.
If the target is resolved to both IPv4 and IPv6, the specific IP version
can be requested by -4 or -6 options, respectively. For backwards-
compatibility, ICMPv6 can also be selected by invoking the binary as
ping6.

when you have ipv6 network and ipv4 in the same time. the ping will use ping -6 to do it. if you want to use ping with ipv4 , you must use ping -4 to do it. it's not about default gateway problem.
 
Back
Top