Solved FreeBSD 10.2 Fresh Install: Hostname Not Resolving

I have a fresh FreeBSD 10.2 install.

Problem: The hostname is not resolving. Meaning, if I try to log in from another machine on my LAN with ssh if I use the IP address, it works, but the hostname doesn't.

I tried adding that machine to the hosts file, as well as another machine beside it, the result being I can ping that machine from FreeBSD box and it resolves fine.

resolv.conf
Code:
Search: blank
DNS#1: xxx.xxx.xx.xx
DNS#2:xxx.xxx.xx.xxx

Should the search be this?
Code:
search freebsdbox.my.domain

Anywhere else I should check?
 
Sorry!

/etc/resolv.conf

Code:
#Generated by resolv.conf
#nameserver 216.xxx.xx.22
#nameserver 216.xxx.xx.222

nameserver 127.0.0.1
options edns0

I did not have this problem with FreeBSD 10.1 and I installed 10.2 in the same manner.
 
I have no idea.

I did a straight and fresh dhcp install-and, so far, there I stand, till I resolve this issue.

/etc/rc.conf:

Code:
hostname="freebsdbox.my.domain"
defaultrouter="192.168.0.1"
ifconfig_bge0="dhcp"
local_unbound_enable=YES"
sshd_enable="YES"
ntpd_enable="YES"
#Set dumpdev to....
dumpdev="AUTO"

I tried adding to /etc/hosts:

Code:
192.168.0.12   freebsdbox freebsdbox.my.domain

That didn't solve the problem, so I'll keep digging-and reading.
 
Try ssh -v user@host and let ssh(1) tell you what the problem is.

On the server, check auth.log for errors
sudo tail -f /var/log/auth.log

Furthermore /etc/resolv.conf must not be changed by unbound. So use dhclient(8) to rewrites /etc/resolv.conf with information received from the DHCP server.
 
I reinstalled to see if I could catch any error I might have made. The same problem is there, but here's the above files now:

/etc/rc.conf

Code:
hostname="freebsdbox.my.domain
ifconfig_bge0="DHCP"
sshd_enable="YES"
ntpd_enable="YES"
#Set dumpdev to "AUTO"...
dumpdev="AUTO"

/etc/resolv.conf:

Code:
#Generated by resolvconf
nameserver 216.xxx.xx.22
nameserver 216.xxx.xx.222

Nothing else done yet.

cpm :

tail -f /var/log/auth.log
Code:
Aug 25 20:04:50 freebsdbox newsyslog[429]: logfile first created
Aug 25 20:04:52 freebsdbox sshd[640]: Server listening on :: port 22.
Aug 25 20:04:52 freebsdbox sshd[640]: Server listening on 0.0.0.0 port 22.
Aug 25 20:05:49 freebsdbox sshd[729]: Accepted keyboard-interactive/pam for richard from 192.168.0.16 port 49910 ssh2
Aug 25 20:05:59 freebsdbox su: richard to root on /dev/pts/0
Aug 25 20:06:57 freebsdbox login: login on ttyv1 as root
Aug 25 20:06:57 freebsdbox login: ROOT LOGIN (root) ON ttyv1
Aug 25 20:21:23 freebsdbox sshd[755]: Accepted keyboard-interactive/pam for richard from 192.168.0.16 port 50212 ssh2
Aug 25 20:21:40 freebsdbox su: richard to root on /dev/pts/0
Aug 25 20:26:00 freebsdbox sshd[772]: error: PAM: authentication error for richard from 192.168.0.15
Aug 25 20:26:12 freebsdbox sshd[772]: error: PAM: authentication error for richard from 192.168.0.15
Aug 25 20:26:26 freebsdbox sshd[772]: Accepted keyboard-interactive/pam for richard from 192.168.0.15 port 6486 ssh2

On this Windows 10 PC (192.168.0.16), using Putty, I can log in with the IP address, but if I try to log into freebsdbox with the hostname, I get an error message saying "Unable to open connection to freebsdbox, host does not exist."

On my OpenBSD laptop (192.168.0.15), using a terminal I SSH in fine using the hostname, but on my Chromebook[?], using "Secure Shell", the connection was refused(separate issue maybe).
 
I updated the OS, added the pkg installer, webmin 1.760 and apache24.

Interesting that http://freebsdbox and http://freebsdbox:10000 both work fine on the OpenBSD laptop, but, on Windows 10 and on the Chromebook, the hostname is not getting resolved, so I have to use the IP address.


Thanks everyone for your help.
 
Last edited by a moderator:
It sounds like all hosts are behind NAT and have 192.168.0.x IPs. In this case, the easiest thing to do is add an entry in the known hosts database on each system. Maybe you already added an entry for freebsdbox in /etc/hosts on the OpenBSD laptop? Next, do the equivalent on the Chrombook and the Windows 10 system.
 
Yeah. Cable Modem/Router.

I'll do so as I find out how. Google is my friend.

Update:

In case anybody needs to know:

1) Windows 10: After I found out how to run Notepad as administrator, I added my FreeBSD machine to its hosts file (after making a backup -elsewhere). Works!

2) Chromebook: A Google search shows you have to enter developer mode to change the hosts file, but when you reboot in normal mode it reverts back to its original state.
 
Back
Top