# Hostname not resolving to correct IP address



## Noris (Jul 17, 2015)

On a server running FreeBSD 10.0, I have an IP address of xx.x.x.28.
But when I `ping` this server using the hostname, it pings xx.x.x.33, which was its old IP address before I had to change.

This happens whether I ping the server from another server on the network or even from the server itself!

How do I get the hostname to resolve to its current IP address and why doesn't it do this automatically?

Thank you!


----------



## usdmatt (Jul 17, 2015)

Sounds like you need to update DNS.


----------



## wblock@ (Jul 17, 2015)

Noris said:


> On a server running FreeBSD 10.0, I have an IP address of xx.x.x.28.


How have you assigned that address to it?  Is it set statically in /etc/rc.conf?  Does it get an address with DHCP?  Are there entries in /etc/hosts?  Is a DNS server running on that machine?  It would be helpful to show the entries in these files, although remember to (carefully) hide the actual addresses if they are not private network addresses.


----------



## Noris (Jul 17, 2015)

The machine gets the address with DHCP.
Yes, there is a DNS server running on the machine and I do have the DNS addresses in /etc/resolv.conf.
I think usdmatt is correct, but I'm not sure how to update the DNS.


----------



## junovitch@ (Jul 18, 2015)

What is in your /etc/resolv.conf?  What is providing DHCP on your network?  Some applications, like dns/dnsmasq which is commonly used in small home routers handles DNS and DHCP in one application.  Others can get a bit more complicated.  Details will help here.  If you are doing DNS locally and presumably on your gateway, it would help if you post the results of a `drill @127.0.0.1 <hostname>` and `drill @x.x.x.1 <hostname>` where the the IP address for latter is your gateway.


----------



## junovitch@ (Jul 18, 2015)

When we get this all sorted out, something you'll want to address in the near future is an upgrade.  FreeBSD 10.0 has been end of life for some time now.   See https://www.FreeBSD.org/security/security.html#sup for more details on what is currently supported along with a link to the full list of unsupported versions.   

https://forums.FreeBSD.org/threads/topics-about-unsupported-freebsd-versions.40469/


----------



## Noris (Jul 22, 2015)

Update: I am currently working with the guys controlling the DNS to resolve this issue.
I am using FreeBSD 10 as it is the only version compatible with the software I am using.

How do I restart the dhclient(8)?


----------



## xavi (Jul 23, 2015)

Noris said:


> How do I restart the dhclient(8)?



Try

`service dhclient restart [I]interface[/I]`

or

`/etc/rc.d/dhclient restart [I]interface[/I]`


----------



## junovitch@ (Jul 25, 2015)

Newer versions of FreeBSD 10.x are ABI compatible with older versions of FreeBSD 10.x so that's no reason to pass on security updates.  Your software will still be compatible when you upgrade.


----------



## ds_aim (Jul 25, 2015)

You running FreeBSD on a virtual machine like VMWare? Or on a PC?


----------

