# freebsd 11 no route to host



## alf (Mar 23, 2017)

Hola buena tarde soy nuevo en la utilización de FreeBSD y autodidacta en informática por eso le pido ayuda, por que yo no se lo que debo hacer y estoy desorientado, con un problema.

Me descargue una iso concretamente FreeBSD 11.0 reléase amd-64disc1. Iso la instale y al ejecutar el comando portsnap fetch extract update me dice que NO ROUTE TO HOST. E estado mirando por google y no encontrado la solución, e mirado los siguentes ficheros :

Hello Good afternoon I'm new to using FreeBSD and self-taught in computer science so I ask for help, because I do not know what I should do and I'm disoriented, with a problem.

I downloaded an iso specifically FreeBSD 11.0 read amd-64disc1. Iso install it and when executing the portsnap command fetch extract update says NO ROUTE TO HOST. E been looking for google and not found the solution, and looked at the following files:


 
    



Sinceramente no se que e podido hacer mal o que no e echo que tendría que haber hecho, si ustedes tienen alguna sugerencia sera bien recibida.

Les doy las gracias por su comprensión.

Honestly I do not know that I could do wrong or that I should not have done, if you have any suggestions, it will be well received.

I thank you for your understanding.


----------



## balanga (Mar 23, 2017)

If you are connected to the Internet I would download this installation image to a USB stick and boot from that

https://download.freebsd.org/ftp/re.../FreeBSD-11.0-RELEASE-amd64-mini-memstick.img


----------



## SirDice (Mar 23, 2017)

"No route to host" typically happens when you're not connected.


----------



## alf (Mar 24, 2017)

Thank you for replying so quickly.
If I have internet connection ago ifconfig and I have active network and ping -c 3 I send a return image, the cable is fine.
I keep looking


----------



## balanga (Mar 24, 2017)

Check /etc/resolv.conf

Sounds like hostname resolution isn't working... Try running `dhclient`.


----------



## SirDice (Mar 24, 2017)

If DNS resolving is an issue you would get messages like "Unknown host" or "No address record".

"No route to host" typically means the (local) host cannot find a route to the destination. That usually happens when there's no default gateway or if the gateway can't be reached because the host is not connected.


----------



## gkontos (Mar 24, 2017)

It also could be a temporary problem with the network. Have you tried again?


----------



## tingo (Mar 24, 2017)

Yes. Therefore, if this happens, always try to ping the host in question (pkg.freebsd.org in this case). In my experience, it will work afterwards.


----------



## sk8harddiefast (Mar 24, 2017)

From images I saw that you put `defaultrouter="YES"`. You don't give the ip for where the package should go. The package leaving your computer has your router as his next destination. To know that and where to go, you should tell him what's the ip of the router.

Try to put this on your /etc/rc.conf

`defaultrouter="192.168.1.1"
ifconfig_re0="inet 192.168.1.18 netmask 255.255.255.0"`

On /etc/resolv.conf (if is empty)

`nameserver 8.8.8.8`


----------



## Phishfry (Mar 24, 2017)

My resolv.conf is different:

`cat /etc/resolv.conf
# Generated by resolvconf
search localdomain
nameserver 192.168.1.1`

Also I do not think 'default router' setting is needed at all for a client.

I also see local_unbound_enable=YES in your /etc/rc.conf. 
That is not needed.

What about your /etc/hosts? Mine has this: 
127.0.0.1 localhost


----------



## sk8harddiefast (Mar 24, 2017)

All this years in FreeBSD never saw `defaultrouter="YES"`

My /etc/hosts

::1                     localhost localhost.my.domain
127.0.0.1               localhost localhost.my.domain

On /etc/resolv.conf you should have ISP's nameservers or Google's defaults

Mine is


```
nameserver 78.87.0.162
nameserver 78.87.0.195
```

But this is Cyta's nameservers from Greece.


----------



## alf (Mar 25, 2017)

Thanks for your answers
Dhclients does not work, I have dhcp from the installation bsd 11 before in another installation I work.
E I ping pkg.freebsd and it works,
Then tried portsnap fetch and was impossible as well as pkg upgrade.
E modified my /etc/rc.conf and post 192.168.1.1 and in /etc/resolv.conf from the beginning have nameserver 8.8.8.8 twice.
In the / etc / host have the same as you indicated me.
What do you think of the information of netstat -r commented on them
The cable is good.
I keep looking


----------



## Phishfry (Mar 25, 2017)

I would not set the IP but use DHCP like you have showing with:
ifconfig_re0="DHCP"
Most routers have DHCP and will assign you an IP
The user is showing an IP of 192.168.1.1 so I assume a router is involved.

Does your system get an IP when you check `ifconfig re0` after bootup? Sometimes you might need to add a delay.

My belief is you would use your upstream router IP(nameserver 192.168.1.1) for resolv.conf.
That way if you want to switch DNS provider you change it at the router layer. Not per machine. Either way it does work.

Did you remove `local_unbound_enable="YES"`
It is not needed and will cause troubles if you have not configured it.
_"Unbound is a very secure validating, recursive, and caching DNS server"_

For troubleshooting try traceroute:
`traceroute pkg.freebsd.org`
`traceroute 8.8.8.8`

`dhclient` needs to be running. Check with this command:
`pgrep -lf dhclient`


----------



## balanga (Mar 25, 2017)

SirDice said:


> If DNS resolving is an issue you would get messages like "Unknown host" or "No address record".
> 
> "No route to host" typically means the (local) host cannot find a route to the destination. That usually happens when there's no default gateway or if the gateway can't be reached because the host is not connected.



But `ping`ing 8.8.8.8 is 100% successful, so a route from localhost must exist.... Maybe a `traceroute` should be tried..


----------



## balanga (Mar 25, 2017)

Just as a side note, where is gateway information stored when using `dhclient`?


----------



## Phishfry (Mar 25, 2017)

Another troubleshooting command:
`host pkg.freebsd.org`

Gateway information is not stored. It is part of the routing table.

More troubleshooting commands:
`route get 8.8.8.8`


----------



## alf (Mar 27, 2017)

And tested dhclient and not working
Pink a freebsd.org.org answers me normally without problem.
Tracerouter normally responds to pkg.freebsd.org with the route get not noticed anything different.
I honestly do not know what to do and tried all the suggestions but keep looking everywhere


----------



## Phishfry (Mar 28, 2017)

What happens when your run dhclient on the interface?
`dhclient re0`

Can you post your `ifconfig re0` output.


----------



## alf (Mar 31, 2017)

Phishfry sorry but as I have and run the dhclient re0 as follows # cat / etc / dhclient re0 from /.
Is that I execute the command cat dhclient re0 and also cat / etc / dhclient re0 and not obtube response so I have doubts

Thank you


----------



## alf (Apr 1, 2017)

Hello and installed from scratch completely from an iso, and the first command to been portsnap fetch and the same no route to host HUY.
I honestly do not know what else to do, thank you for all the ideas you can comment on.
Thank you


----------



## Phishfry (Apr 1, 2017)

OK so do you have a router tied to your modem/internet connection? Have you accessed it with a working PC to make sure it is configured correctly?

When you ran the FreeBSD installer did you use DHCP for IPv4? Did it get a lease from your DHCP server when using bsdinstaller?

Back to the original trobleshooting post did you run these again?
`traceroute 8.8.8.8`
`traceroute google.com`

Hardware wise:
I am a little worried about the Realtek ethernet interface. They are not ideal on FreeBSD. Some don't work well at all.
Please give us your exact Realtek ethernet adapter on board or at least your board/machine model.


----------



## alf (Apr 11, 2017)

Forgive the delay but I was busy.
Mr. phishfry yes when install bsd utylice dhcp for ipv4. Eejecutado traceroute 8.8.8.8 and tells me all the route as more or less ping so I understand the internet I have and the cable is well the router also the installation is correct.
Regarding the network card is Realtek 811F gigabit lan controller.
Sorry my ignorance but whenever I try portnap fetch tells me about the route, and nothing else because at this point I'm lost. I can with the editor ee manually put the address of ls web where the repositories are, this is possible.
I keep looking online if I find the solution.
Thank you for your patience.


----------



## Jimmy1977 (Apr 22, 2017)

Alf, can you please try to edit your /etc/resolv.conf file? By removing both of the nameserver 8.8.8.8 lines... And then type service netif restart... And let me know if that fixes your problem... because a lot of times these ip4s in the /etc/resolv.conf can conflict with one another... At least this has been my experience...


----------

