FreeBSD. No route to host
The message “No route to host” appears when the system is unable to deliver packets to the destination host. This can happen if no default route is defined or the cable is not connected. Check the output of netstat -rn and make sure there is a working route to the host in question.
Sometimes the default route cannot be set automatically, so you have to specify “defaultroute” yourself. For example, you’ve configured the interfaces and brought them up, and everything seems fine, but ping doesn’t work…
# ping example.com
ping: sendto: no route to host
Check the routes:
# netstat -r
If you don’t find a “default” route, add it yourself:
# route add default 10.20.30.1
, where 10.20.30.1 is your gateway.
Or add this to /etc/rc.conf
defaultrouter="10.20.30.1"
So that the route is set when the system starts.
FreeBSD Handbook: Gateways and Routes
Comments are closed. Read the original discussion in Russian →
