LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Hostname does not persist on LAN (https://www.linuxquestions.org/questions/linux-general-1/hostname-does-not-persist-on-lan-917566/)

int0x80 12-07-2011 08:39 AM

Hostname does not persist on LAN
 
I recently moved my home server OS to Debian from Ubuntu. The hardware is the same, so during the install, it was offered the previous hostname, which I accepted. Internally, DNS and DHCP are served up by dnsmasq from dd-wrt running on my WRT54G. None of the settings have changed on the WRT54G, but now the server cannot be reached by name.

LAN domain: meta.verse
Hostname: blacksun

Code:

blacksun:~ $ sudo uname -n
blacksun
blacksun:~ $ sudo hostname -a
blacksun
blacksun:~ $ sudo hostname -s
blacksun
blacksun:~ $ sudo hostname -d
meta.verse
blacksun:~ $ sudo hostname -f
blacksun.meta.verse
blacksun:~ $ sudo hostname --fqdn
blacksun.meta.verse
blacksun:~ $ cat /etc/hostname
blacksun

I can reach the box just fine via its IP address, but if contact is attempted via the hostname, then nothing happens:

Code:

reason:~$ ping blacksun.meta.verse
ping: unknown host blacksun.meta.verse

There are no firewall rules, everything is ACCEPT, and the box knows its own hostname. I did try changing the hostname on the server, but still could not reach it without using the IP address. Not sure what the cause could be.

rodrifra 12-07-2011 08:51 AM

Either you have an entry in your /etc/hosts with the IP for blacksun.meta.verse or your DNS knows how to resolve it. Otherwise, you will get the unknown host error.

So the solution is either edit your hosts file or configure your DNS (if you are the owner).

int0x80 12-07-2011 09:08 AM

Yup, DNS is served by dnsmasq on the WRT54G. All other hosts on the network resolve fine, just not this one. The /etc/hosts file looks alright to me:

Code:

blacksun:~ $ head /etc/hosts
127.0.0.1      localhost
127.0.1.1      blacksun.meta.verse    blacksun

Comparatively on one of the hosts:

Code:

reason:~$ head /etc/hosts
127.0.0.1      localhost
127.0.1.1      reason

I tried removing the 'blacksun.meta.verse' column from /etc/hosts on blacksun, but that didn't solve the problem.

int0x80 12-07-2011 09:41 AM

Well I rebooted the WRT54G and now it works alright. Worst solution ever.


All times are GMT -5. The time now is 12:03 AM.