Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Question about host name in /etc/conf.d/hostname
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
sgao
Tux's lil' helper
Tux's lil' helper


Joined: 22 Apr 2006
Posts: 149

PostPosted: Tue Dec 04, 2007 7:27 pm    Post subject: Question about host name in /etc/conf.d/hostname Reply with quote

Hi,

I have one question about whether one should use fully qualified domain host name (FQDN) or just host name in /etc/conf.d/hostname.

If I just put a host name in /etc/conf.d/hostname, then mails going out of the machine will have incomplete address like user@host, instead of "user@host.domain.com", even if I set "dns_domain_eth0=domain.com" in /etc/conf.d/net.

If I put a FQDN host name, say "host.domain.com", in /etc/conf.d/hostname, then out going emails from the machine will have correct host address as "user@host.domain.com". However, my login console will display like "host.domain.com.domain.com" instead of just "host.domain.com". My question is why sometimes domain part of host address is used, but at other times on more important things like email address, domain address not appended?

The mail program in question is Postfix. In the main.cf config file, I do have one line to specify the host name like "host.domain.com". But without setting FQDN in /etc/conf.d/hostname, outgoing emails still have address with just host name part.

My impression is that it's preferred to just put host name part in /etc/conf.d/hostname, domain name part will be appended automatically based on settings in /etc/conf.d/net. Isn't that the case?

Anyone else has see the similar issue?

Simon
Back to top
View user's profile Send private message
timeBandit
Bodhisattva
Bodhisattva


Joined: 31 Dec 2004
Posts: 2719
Location: here, there or in transit

PostPosted: Tue Dec 04, 2007 9:11 pm    Post subject: Reply with quote

Set your host name (only) in /etc/conf.d/hostname. Set your DNS domain name (only) in /etc/conf.d/domainname. Restart all network services including Postfix to pick up the configuration. Addresses should then be suffixed with the FQDN.
_________________
Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others.


Last edited by timeBandit on Wed Dec 05, 2007 2:04 am; edited 1 time in total
Back to top
View user's profile Send private message
linear
Apprentice
Apprentice


Joined: 12 Aug 2004
Posts: 222

PostPosted: Tue Dec 04, 2007 9:25 pm    Post subject: Reply with quote

Okay,

You should just put the system's hostname in /etc/conf.d/hostname, not the FQDN. The FQDN goes into the system's entry in /etc/hosts. The domain name goes into /etc/conf.d/domainname on the "DNSDOMAIN=" line.

So, it should look something like this:

Code:
# /etc/conf.d/hostname

# Set to the hostname of this machine
HOSTNAME="host-system"


Code:
# /etc/conf.d/domainname

# When setting up resolv.conf, what should take precedence?
#  0 = let dhcp/whatever override DNSDOMAIN
#  1 = override dhcp/whatever with DNSDOMAIN

OVERRIDE=1

# To have a proper FQDN, you need to setup /etc/hosts and /etc/resolv.conf
# (domain entry in /etc/resolv.conf and FQDN in /etc/hosts).
#
# DNSDOMAIN merely sets the domain entry in /etc/resolv.conf, see
# the resolv.conf(5) manpage for more info.

DNSDOMAIN="domain.com"...


Code:
# /etc/hosts:  This file describes a number of hostname-to-address
#              mappings for the TCP/IP subsystem.  It is mostly
#              used at boot time, when no name servers are running.
#              On small systems, this file can be used instead of a
#              "named" name server.  Just add the names, addresses
#              and any aliases to this file...
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/hosts,v 1.8 2003/08/04 20:12:25 azarah Exp $
#

127.0.0.1       localhost.localdomain localhost
192.168.1.10    host-system.domain.com host-system


HTH.


/bk
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Tue Dec 04, 2007 10:16 pm    Post subject: Reply with quote

Are you guys on crack? baselayout removed the domainname init script over a year ago.

dns_domain_lo="foo.bar" in /etc/conf.d/net is now preferred.
OR you can set the FQDN in /etc/conf.d/hostname.

It all depends what you want - dns_domain_$IFACE confiures /etc/resolv.conf and hostname just configures the hostname.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
linear
Apprentice
Apprentice


Joined: 12 Aug 2004
Posts: 222

PostPosted: Wed Dec 05, 2007 12:54 am    Post subject: Reply with quote

?????

UberLord wrote:
Are you guys on crack? baselayout removed the domainname init script over a year ago.


Sir,

I was referring to the /etc/conf.d/domainname file *which is still there* after having long since upgraded to sys-apps/baselayout-1.12.9-r2! As I write this, I am sync'ing the portage cache to see if there was something I missed. (Apparently not... After sync'ing, baselayout-1.12.9-r2 is still the latest!)


Now, if you will look here at the original post:
sgao wrote:
If I just put a host name in /etc/conf.d/hostname, then mails going out of the machine will have incomplete address like user@host, instead of "user@host.domain.com", even if I set "dns_domain_eth0=domain.com" in /etc/conf.d/net.


So, UberLord, your solution was reportedly already tried in their specific situation and it did not work. Then, I recommend going with what we know has worked in the past.

Now, another good question might be, what email client and/or server are you using?

HTH.


/bk
Back to top
View user's profile Send private message
timeBandit
Bodhisattva
Bodhisattva


Joined: 31 Dec 2004
Posts: 2719
Location: here, there or in transit

PostPosted: Wed Dec 05, 2007 2:39 am    Post subject: Reply with quote

UberLord wrote:
Are you guys on crack? baselayout removed the domainname init script over a year ago.
I know I'm not but I can't speak for my Gentoo box. :P It has its own issues.
I also still have /etc/conf.d/domainname (corrected above; I misremembered the name earlier today). If there was a baselayout update that made a big deal over the change, I skipped over it on my way to 1.12.9-r2.

Back to the original question:
sgao wrote:
The mail program in question is Postfix. In the main.cf config file, I do have one line to specify the host name like "host.domain.com". But without setting FQDN in /etc/conf.d/hostname, outgoing emails still have address with just host name part.
Now that I can check my configs I see another rough spot my memory glossed over: Postfix might not rely on your network configuration. My configuration looks like so:
/etc/postfix/main.cf:
myhostname = host.example.net
mydomain = example.net
myorigin = $myhostname
and mails are addressed as user@host.example.net.
_________________
Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Wed Dec 05, 2007 8:56 am    Post subject: Reply with quote

Portage should have removed them .....

Oh well.

The domainname script is silly and pointless. I advise removing it.

Regarding Postfix - well, some people (like me) think it's a Postfix bug as other server applications Get It Right. I do what the prior poster does and specify the domain in the postfix config.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
sgao
Tux's lil' helper
Tux's lil' helper


Joined: 22 Apr 2006
Posts: 149

PostPosted: Tue Dec 18, 2007 7:49 am    Post subject: Reply with quote

I did followed the recent changes for domain name setup. /etc/conf.d/domainname has been replaced by dns_domain_lo and dns_domain_eth0 in /etc/conf.d/net.

It could be postfix issue since I did put in both hostname (FQDN) and domain name in main.cf file. I noticed this problem when logwatch sends out daily reports, the address is <logwatch@host> instead of <logwatch@host.domain.com>. Sometimes it's desirable to attach domain name if a network is divided into different subdomains. I will check out Sendmail and see how Sendmail does.

Simon
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum