# Host name lookup failure on change of ISP



## balanga (Jan 16, 2018)

I'm in the process of changing ISP and have noticed that I am unable to resolve hostnames (at least on FreeBSD)... I presume that this is due to the settings in /etc/resolv.conf.

How does this file get updated? I don't remember updating it manually before... Doesn't DHCP update the IP address, routing and hostname resolution?


----------



## SirDice (Jan 16, 2018)

balanga said:


> Doesn't DHCP update the IP address, routing and hostname resolution?


Typically yes, but not always. And it doesn't get updated if you use static addresses, in which case you need to modify it by hand.


----------



## balanga (Jan 16, 2018)

I'm using DHCP, routing and resolving does not get updated. I'm not sure how this is supposed to work.

I know that on Windows, if I swap cables between routers, the TCP/IP configuration gets updated and I can carry on as though nothing had happened.
I assumed that `service netif restart` would effectively do the same on FreeBSD, but all it seems to do is assign a new IP address. Should it rebuild the routing table?


----------



## SirDice (Jan 16, 2018)

Routing table has nothing to do with it. The DHCP settings depend on the ISP's configuration. Yes, it's common to also supply DNS settings with DHCP but this is not required. I would ask the ISP about it. Ask them if DHCP provides DNS settings or if you have to configure it yourself.


----------



## balanga (Jan 16, 2018)

SirDice said:


> Routing table has nothing to do with it. The DHCP settings depend on the ISP's configuration. Yes, it's common to also supply DNS settings with DHCP but this is not required. I would ask the ISP about it. Ask them if DHCP provides DNS settings or if you have to configure it yourself.



Windows manages to configure DNS settings itself, so I guess I could use those settings for FreeBSD. 

Where does FreeBSD hold gateway information? Somehow FreeBSD knows how to `ping 8.8.8.8` but not `ping google.com`.
I manually changed /etc/resolv.conf to use 192.168.0.1 instead of 192.168.1.1, but that made no difference.


----------



## Snurg (Jan 16, 2018)

I don't think that 192.168.0.1 can work (except if you installed a dns server on that routing host).
What happens if you put 8.8.8.8 into resolv.conf?


----------



## SirDice (Jan 16, 2018)

Did you, at some point, create a /etc/dhclient-enter-hooks perhaps? Or configured /etc/dhclient.conf?


----------



## balanga (Jan 16, 2018)

Snurg said:


> I don't think that 192.168.0.1 can work (except if you installed a dns server on that routing host).
> What happens if you put 8.8.8.8 into resolv.conf?



I used 192.168.0.1 which is the address of the router. Unfortunately the ISP does not provide login details so I can't login and have a look...
192.168.1.1 works with the other router, so I thought I just needed to change this value.

Using 8.8.8.8 works, so thanks for the suggestion, although I'd still like to know how Windows auto-configures itself.


----------



## balanga (Jan 16, 2018)

SirDice said:


> Did you, at some point, create a /etc/dhclient-enter-hooks perhaps? Or configured /etc/dhclient.conf?



Never heard of these files....


----------



## OlivierW (Jan 16, 2018)

If your DHCP setup works, check if you have a "/var/db/dhclient.leases" file. There, you will find your DNS servers and other useful informations provided by your ISP.


----------

