View previous topic :: View next topic |
Author |
Message |
nein Guru
Joined: 14 Nov 2003 Posts: 346 Location: Spain
|
Posted: Wed Jun 16, 2004 8:47 am Post subject: Domainname and how to deal with /etc/hosts [Solved] |
|
|
Hi,
I did not set the domain name for my laptop during the installation, but yesterday I decided I did not want to see the greeting "This is myhost.(none)" at the login prompt.
I edited /etc/dnsdomainname and wrote "valhala" in it and added dnsdomainname to the defualt boot level.
Next time I rebooted I expected to see "This is myhost.valhala" but I still get "(none)" as domain. In my desktop box it did work but for that box I have a real domain name and not just a fake one.
Any ideas about what is happening ?
Last edited by nein on Wed Jun 16, 2004 6:34 pm; edited 2 times in total |
|
Back to top |
|
|
yosi n00b
Joined: 30 Mar 2004 Posts: 18 Location: Sweden, Stockholm
|
Posted: Wed Jun 16, 2004 8:58 am Post subject: |
|
|
shouldn't you have this line
domain valhala
before "nameserver" in resolv.conf?
thats what I have _________________ // yosi |
|
Back to top |
|
|
nein Guru
Joined: 14 Nov 2003 Posts: 346 Location: Spain
|
Posted: Wed Jun 16, 2004 9:14 am Post subject: |
|
|
I don't have my laptop here. I will report later but it sounds good. I forgot about resolv.conf |
|
Back to top |
|
|
smart Guru
Joined: 19 Nov 2002 Posts: 455
|
Posted: Wed Jun 16, 2004 10:04 am Post subject: |
|
|
Quote: |
shouldn't you have this line
domain valhala
before "nameserver" in resolv.conf?
|
not related.
While i'd expect those scripts to use /etc/dnsdomainname actually, if i rememerb right, it used /etc/hosts.
try like this in /etc/hosts:
127.0.0.1 imin.valhalla.drinkingfromskullstill.drunk imin localhost |
|
Back to top |
|
|
nein Guru
Joined: 14 Nov 2003 Posts: 346 Location: Spain
|
Posted: Wed Jun 16, 2004 1:16 pm Post subject: |
|
|
I edited the /etc/hosts file and it did the trick . Thanks
Now the question is, do I need to change /etc/hosts manually if I get my ip address by DHCP ? Is there a way to get this file updated automatically after eth0 gets configured.
I know how to patch /etc/hosts with a script or by editing /etc/init.d/net.eth0, but I was wondering if this has already been solved |
|
Back to top |
|
|
smart Guru
Joined: 19 Nov 2002 Posts: 455
|
Posted: Wed Jun 16, 2004 1:55 pm Post subject: |
|
|
Quote: |
do I need to change /etc/hosts manually if I get my ip address by DHCP ?
|
No you don't. This is a mini-trick actually, since originially, you will often find the advice to have a line in /etc/hosts like
yourrealip yourmachinename
instead we went:
127.0.0.1 machinename localhost
which will always stay valid.
so no change should be needed ever with respect to your own machine. for all the other stuff it would go to DNS or whatever you chose in /etc/nsswitch.conf. |
|
Back to top |
|
|
nein Guru
Joined: 14 Nov 2003 Posts: 346 Location: Spain
|
Posted: Wed Jun 16, 2004 2:31 pm Post subject: |
|
|
Thank you very much. First I was surprised because that was how my /etc/hosts looked like before posting. So I thought I had to add another entry with the eth0 ip address.
Having a look at my backups I noticed the change that makes the difference:
I had:
Code: |
127.0.0.1 localhost machinename
|
instead of
Code: | 127.0.0.1 machinename localhost | Notice the change in the order
Now I see my domain name and even openoffice starts fast even if I unplug my net cable. |
|
Back to top |
|
|
powdahound n00b
Joined: 21 Jan 2004 Posts: 26 Location: NH, USA
|
Posted: Wed Jul 14, 2004 6:48 pm Post subject: |
|
|
Incoming noob questions here...
I set /etc/dnsdomainname and I still get "atomic.(none)" when I boot up. How do I add dnsdomainname to startup? I don't see any script for it in /etc/init.d/
When I start up I see the line "Setting DNS domainname to powdahound.com... [ok]" but I still show up as atomic.(none)...
Thanks. |
|
Back to top |
|
|
nein Guru
Joined: 14 Nov 2003 Posts: 346 Location: Spain
|
Posted: Thu Jul 15, 2004 7:16 am Post subject: |
|
|
See my previous post. In /etc/hosts you need a line like this one:
127.0.0.1 atomic.powdahound.com localhost
It seems that the domain name is read form /etc/hosts so you have to give the full name of your computer in that file. |
|
Back to top |
|
|
powdahound n00b
Joined: 21 Jan 2004 Posts: 26 Location: NH, USA
|
Posted: Thu Jul 15, 2004 2:18 pm Post subject: |
|
|
Ah ok. I had 127.0.0.1 atomic localhost
Didn't know I needed the full thing. Think it'd be a little more clear...
Although now when I start up apache2 fails to start saying Code: | [Thu Jul 15 10:19:22 2004] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "atomic"
Configuration Failed |
And my computer shows as atomic.unknown_domain... hmm |
|
Back to top |
|
|
cdunham Apprentice
Joined: 06 Jun 2003 Posts: 211 Location: Rhode Island
|
Posted: Tue Jul 20, 2004 8:55 pm Post subject: |
|
|
This seems so un-Gentoo like.
What I really want to be able to do is manage machine names through dnsmasq, and do as little locally as possible, and have other things work. To wit:
- /etc/ethers contains MAC to IP mappings (works, optional)
- dnsmasq server /etc/hosts has IP to A mappings (works)
- workstations get IP address, ntp server, proxy server, host name, routes, etc. etc. through DHCP (works)
- workstations know that 'localhost' is 127.0.0.1 and login prompts, etc. all show host name or fqdn (not working)
If /etc/hosts contains
Code: | 127.0.0.1 localhost |
then the prompts, etc. are all wrong.
If /etc/hosts contains
Code: | 127.0.0.1 imahost.int.example.com localhost |
then the prompts work, but connections to local mySQL servers break because gethostbyaddr('127.0.0.1') returnd the fqdn, not localhost.
Yes, the local mySQL server config can be changed, but that's not very clean. There should be a way for gethostbyaddr to to the right thing, and everything else work also.... _________________ This post more meaningful in a scalar context. |
|
Back to top |
|
|
cdunham Apprentice
Joined: 06 Jun 2003 Posts: 211 Location: Rhode Island
|
Posted: Tue Jul 20, 2004 8:57 pm Post subject: |
|
|
Oh, and having the fqdn in /etc/hosts, the hostname in /etc/hostname, the domain in both /etc/resolv.conf AND /etc/dnsdomainname (where is is aparently ignored by everyone except dnsdomainname(1), for some reason), is both redunant and counter to the desire to centrally manage host names without having to set them in the workstations. _________________ This post more meaningful in a scalar context. |
|
Back to top |
|
|
|