PDA

View Full Version : [Solved] last(1) not showing hostnames, only IP addresses (8.0-RC1)


draenan
October 27th, 2009, 12:11
Just installed FreeBSD for the first time in a number of years, and noticed a weird problem.

Forward and reverse look-ups using host and dig work fine on my server. I'm also running BIND for my own local network and look-ups of LAN addresses work fine. Yet only IP addresses are appearing in the output of commands like last(1), and the content of the auth.log file.

I've used tcpdump to verify that look-ups are occurring when connecting with SSH, and they are, so I can't figure out what the problem is. Can anyone help?

Thanks in advance.

DutchDaemon
October 27th, 2009, 15:26
As far as I can see, last only prints the hostname in these two cases:
1) the IP address has a hostname in /etc/hosts
2) the rDNS entry is the same as the forward lookup.

So if you connect from 123.123.123.123, which resolves to 123.some.net, last will still print 123.123.123.123 if 123.some.net does not resolve to that IP address.

The same probably goes for services logging to auth.log.

draenan
October 28th, 2009, 00:49
Thanks for your reply.

tcpdump shows that the forward and reverse look-ups that occur at login are correct, and just to be sure it wasn't my BIND setup at fault I changed resolv.conf to point at my ISP's server and logged in via an external server. I'm still getting the IP addresses instead of hostnames. I even tried putting hostnames into /etc/hosts and I'm still getting IP addresses instead of hostnames. Beginning to think this is a FreeBSD 8 bug. I think I'll try the mailing lists.

Thanks again.

DutchDaemon
October 28th, 2009, 12:09
I'm on FreeBSD 8 RC2 and my 'last' shows correct hostnames from /etc/hosts. Note that old records in 'last' output don't change when you fix resolving issues. Only newer records will be affected.

crash9877
March 10th, 2011, 13:23
Hello,

Sorry for grabbing this old thread but I'm having the same problem with FreeBSD 8.2 i386 final. I even tried a fresh installation with vmware and only using /etc/hosts 192.168.1.100 testhost.my.domain testhost and it still doesn´t work. The same compares to FreeBSD 7.4. At home I have no problems with it since there are only four clients but in the company with 500 clients ;-)

BTW, it works with all linux distros and OpenBSD. Maybe somebody knows what the problem with FreeBSD might be? I asked in IRC chat #FreeBSD and with two guys it was working with the others not.

crash9877
May 4th, 2011, 00:45
Fixed it. :)

DutchDaemon
May 4th, 2011, 01:28
How? Share solutions, that's what forums are about.

crash9877
May 4th, 2011, 21:45
Actually it was easy. I have tried several versions with FreeBSD on vmware. They all have the same problem (well, I don´t know if it is) correct me if I´m wrong. The way I fixed it without using named and dhcpd just a plain /etc/hosts instead of using:
test.my.domain test
test test.my.domain


Then everything works as expected. Hope this helps someone.

DutchDaemon
May 5th, 2011, 00:41
Thanks. Hope you manage to fix your Shift key (http://en.wikipedia.org/wiki/Capitalization) soon as well.