Re: hostname question during Debian installation

2012-09-13 Thread Martin T
Hello,

in order to wrap this hostname question up, then hostname set during
the Debian installation is:

1) mapped to an address from 127.0.0.0/8 range in /etc/hosts file.
Specifically to IPv4 address 127.0.1.1
2) written to MTA(for example exim4) configuration file
3) written to /etc/mailname
4) written to /etc/hostname file


Are there any local services which listen on hostname(127.0.1.1)
address? As much as I have seen, they(for example Internet Printing
Protocol or SMTP) all use localhost(127.0.0.1) address instead.

Last but not least, is somebody able to name few utilities which use
hostname for various purposes? I could name mail  transfer agents.


regards,
Martin


2012/3/20 Bob Proulx b...@proulx.com:
 Tom H wrote:
  What I find somewhat weird is that when you install Debian,
  /etc/hostname and /etc/mailname are the same.
  So if it's box.company.internal and bob runs mail tom, bob's
  address'll be bob@box.company.internal.
 
  Yes. Seems reasonable to me. That is exactly what I want. It is
  traditional BSD/Unix behavior.

 But the address should be bob@company.internal!

 If that is what you desire (it isn't what I want) then it is probably
 easiest to set myorigin through /etc/mailname.  There are also a
 number of other possibilities including masquading and various Postfix
 addresses rewriting processes.

  It would be perfectly nice if the package installation dialog were to
  ask the user if they want to set up address masquerading and to do it
  automatically. But for anyone who wants it the configuration is very
  easily accomplished with one of the above. I prefer to leave
  /etc/mailname along and to configure postfix explicitly. Then I can
  control over masquerade_classes and local_header_rewrite_clients too.

 IIUC, what you mean by masquerading is that if you send an email from
 box.company.internal, the email address is bob@company.internal
 rather than bob@box.company.internal.

 Yes.  That is correct.  But not sure if we are poking at the box
 removal part or the .internal part.  I guess pedantically I would
 say yes to both if that is the hostname and fqdn.  But I would
 probably have a different domain name and not be using an .internal
 name.  If I were actually using a .internal name then I would
 probably be wanting to do address rewriting.  But it is my turn to say
 that I have never been in an environment that actually used that type
 of name strategy.

 I've never worked in or set up an environment where the sender's
 address is bob@box.company.internal. But this explains why you
 didn't think bob@box.company.internal above was wrong.

 If company.internal is the name of the dns domain then that seems
 a reasonable default to me.  Because 99.44% of the time it will be
 something really reasonable such as example.com which is actually a
 real domain name.  I figure anyone that is actually using a literal
 .internal domain name would also know what they are doing and set up
 some type of address translation for it.  But if they are setting up a
 box trouble.proulx.com for example then I would expect the mail to
 come from u...@trouble.proulx.com.  :-)

 Anyway, I don't think that their argument was about masquerading; it
 was about what the canonical form of /etc/mailname should be.

 Whatever the result it is easy to change /etc/mailname to be correct.
 But if it should be enhanced to have a specific question then an
 enhancement request to exim and postfix both would probably be in
 order since neither of them ask about it but just assume and set it.

 dpkg-reconfigure postfix doesn't change myhostname either with a
 prompt for a hostname or through a hostname call so if you change
 the box's hostname, you have to edit /etc/postfix.main.cf by hand.

 It doesn't seem to.  I suppose it should.  But it does edit
 /etc/mailname and that is probably enough.  I am sure that is what the
 postfix maintainer is thinking.

  You can then change /etc/hostname
 Changing /etc/hostname has no effect for postfix.
  and /etc/mailname, install postfix, and see what gets pulled in as
  myhostname into /etc/postfix/main.cf.
 
  Changing mailname doesn't really have an effect on the
  /etc/postfix/main.cf configuration. Because there is a Debian
  specific patch to in enable reading myorigin from a file. So it has
  an effect only through the patched code that pulls in the value
  dynamically when postfix starts from /etc/mailname instead of needing
  to specify myorigin in the main.cf file explicitly.

 I don't follow. Changing /etc/mailname changes myorigin because of
 that patch.

 Right.  But it doesn't cause the postinst script or any other process
 to change main.cf.  So above you postulated that setting hostname and
 mailname could possibly affect the settings in main.cf.  But they
 don't.  The main.cf file won't be changed regardless of what is set in
 mailname due to using the contents dynamically.

 (I usually change myorigin = /etc/mailname to its actual
 value on my 

Re: hostname question during Debian installation

2012-03-19 Thread Bob Proulx
Tom H wrote:
  What I find somewhat weird is that when you install Debian,
  /etc/hostname and /etc/mailname are the same.
  So if it's box.company.internal and bob runs mail tom, bob's
  address'll be bob@box.company.internal.
 
  Yes. Seems reasonable to me. That is exactly what I want. It is
  traditional BSD/Unix behavior.
 
 But the address should be bob@company.internal!

If that is what you desire (it isn't what I want) then it is probably
easiest to set myorigin through /etc/mailname.  There are also a
number of other possibilities including masquading and various Postfix
addresses rewriting processes.

  It would be perfectly nice if the package installation dialog were to
  ask the user if they want to set up address masquerading and to do it
  automatically. But for anyone who wants it the configuration is very
  easily accomplished with one of the above. I prefer to leave
  /etc/mailname along and to configure postfix explicitly. Then I can
  control over masquerade_classes and local_header_rewrite_clients too.
 
 IIUC, what you mean by masquerading is that if you send an email from
 box.company.internal, the email address is bob@company.internal
 rather than bob@box.company.internal.

Yes.  That is correct.  But not sure if we are poking at the box
removal part or the .internal part.  I guess pedantically I would
say yes to both if that is the hostname and fqdn.  But I would
probably have a different domain name and not be using an .internal
name.  If I were actually using a .internal name then I would
probably be wanting to do address rewriting.  But it is my turn to say
that I have never been in an environment that actually used that type
of name strategy.

 I've never worked in or set up an environment where the sender's
 address is bob@box.company.internal. But this explains why you
 didn't think bob@box.company.internal above was wrong.

If company.internal is the name of the dns domain then that seems
a reasonable default to me.  Because 99.44% of the time it will be
something really reasonable such as example.com which is actually a
real domain name.  I figure anyone that is actually using a literal
.internal domain name would also know what they are doing and set up
some type of address translation for it.  But if they are setting up a
box trouble.proulx.com for example then I would expect the mail to
come from u...@trouble.proulx.com.  :-)

 Anyway, I don't think that their argument was about masquerading; it
 was about what the canonical form of /etc/mailname should be.

Whatever the result it is easy to change /etc/mailname to be correct.
But if it should be enhanced to have a specific question then an
enhancement request to exim and postfix both would probably be in
order since neither of them ask about it but just assume and set it.

 dpkg-reconfigure postfix doesn't change myhostname either with a
 prompt for a hostname or through a hostname call so if you change
 the box's hostname, you have to edit /etc/postfix.main.cf by hand.

It doesn't seem to.  I suppose it should.  But it does edit
/etc/mailname and that is probably enough.  I am sure that is what the
postfix maintainer is thinking.

  You can then change /etc/hostname
 Changing /etc/hostname has no effect for postfix.
  and /etc/mailname, install postfix, and see what gets pulled in as
  myhostname into /etc/postfix/main.cf.
 
  Changing mailname doesn't really have an effect on the
  /etc/postfix/main.cf configuration. Because there is a Debian
  specific patch to in enable reading myorigin from a file. So it has
  an effect only through the patched code that pulls in the value
  dynamically when postfix starts from /etc/mailname instead of needing
  to specify myorigin in the main.cf file explicitly.
 
 I don't follow. Changing /etc/mailname changes myorigin because of
 that patch.

Right.  But it doesn't cause the postinst script or any other process
to change main.cf.  So above you postulated that setting hostname and
mailname could possibly affect the settings in main.cf.  But they
don't.  The main.cf file won't be changed regardless of what is set in
mailname due to using the contents dynamically.

 (I usually change myorigin = /etc/mailname to its actual
 value on my boxes...)

I don't need to now but previously used to ensure that myhostname was
set and then remove the myorigin line.  Then it defaults to
myhostname.  But of course if you want to masquarade then myorigin
makes sense.

 Anyway, I was only suggesting the mailname change because on my
 boxes hostname and mailname are the same and I just wanted to
 ensure that they were different to trace what info the installer is
 picked up from where by the installer.

Good.  A good pilot is always learning.  :-)

Bob


signature.asc
Description: Digital signature


Re: hostname question during Debian installation

2012-02-27 Thread Tom H
 I'm going to try it too.

 Ha! Beat you to it! :-)

:)

I'd forgotten about this hostname and postfix business until your
email arrived last Monday but I haven't had the time to do my (far
less thorough) test.



On Sun, Feb 19, 2012 at 4:46 PM, Bob Proulx b...@proulx.com wrote:
 Tom H wrote:
  Bob Proulx wrote:



 AFAIR, myhostname is /etc/hostname

 Not quite. For Debian's Postfix configuration the postfix myhostname
 variable is set to the fqdn in /etc/postfix/main.cf. Postfix requires
 myhostname to be the fqdn. The default value for Postfix is to use
 the value of `hostname`. However in Debian the default hostname is
 the short hostname without the domain name. Therefore Postfix's
 default of `hostname` isn't suitable and must be supplemented by
 setting the FQDN explicitly.

 Well... What I said wasn't quite true. It is the summary of the
 overall result. What Postfix actually does is somewhat circular.
 Here are the official docs and a somewhat longer explanation.

 mydomain (default: see postconf -d output)

   The internet domain name of this mail system. The default is to
   use $myhostname minus the first component, or localdomain
   (Postfix 2.3 and later). $mydomain is used as a default value for
   many other configuration parameters.

 myhostname (default: see postconf -d output)

   The internet hostname of this mail system. The default is to use
   the fully-qualified domain name (FQDN) from gethostname(), or to
   use the non-FQDN result from gethostname() and append
   .$mydomain. $myhostname is used as a default value for many
   other configuration parameters.

 If not set then it sets mydomain from the fqdn obtained from hostname
 or to localdomain if that isn't a fqdn.  On Debian with a short
 hostname set that means mydomain always defaults to localdomain.

 If not set then it sets myhostname from the non-fqdn obtained from
 hostname and appends mydomain. On Debian with a short hostname that
 means myhostname always defaults to somename.localdomain. And if the
 hostname was chosen to be localhost then it would default to
 localhost.localdomain which is one consistent and desirable strategy
 for thin client systems without a network and without a network domain
 name.

 [Postfix was born on systems where the hostname was normally set to
 the fqdn. In that environment the above makes a lot of sense. On
 Debian with the short hostname it means that myhostname should always
 be set to provide that supplemental domain name information.]

I set /etc/hostname to the fqdn so my memory was correct but my
setup non-standard. Apologies for the misinformation!



 and myorigin is /etc/mailname.

 Yes. If an MTA has been installed. That file does not exist if no
 MTA has been installed.

 What I find somewhat weird is that when you install Debian,
 /etc/hostname and /etc/mailname are the same.

 They are only the same if you choose a fqdn for the hostname. By your
 comment I read that it implies that you do choose a fqdn for your
 hostnames? (And that you always choose either Standard system or
 otherwise install an MTA?) That is why they would be the same for
 you. If you choose a short name for the hostname, which is the worded
 with recommendation from the debian-installer and so most people
 probably choose it, then they are different. /etc/hostname will be
 the short name and /etc/mailname will be the fqdn.

I usually use preseed with
d-i netcfg/get_hostname string box
d-i netcfg/get_domain string company.internal
but then overwrite /etc/hostname with the fqdn in late_command and
install various packages starting with
tasksel tasksel/first multiselect standard
I'll have to try
d-i netcfg/get_hostname string box.company.internal



 What I find somewhat weird is that when you install Debian,
 /etc/hostname and /etc/mailname are the same.
 So if it's box.company.internal and bob runs mail tom, bob's
 address'll be bob@box.company.internal.

 Yes. Seems reasonable to me. That is exactly what I want. It is
 traditional BSD/Unix behavior.

But the address should be bob@company.internal!



 There was a debian-devel thread where there was an argument about
 whether /etc/mailname should be box.company.internal or
 company.internal.

 Oh! Well... If you want address masquarading then I think that
 should be an explicit choice. I wouldn't default to address
 masquarading by default. That would be wrong for many environments.
 It assumes that an environment has a central mail relay to handle mail
 for the entire domain and it routes all mail through that central mail
 relay. But in a simple environment with a few machines (or several
 thousand) that wants email to route directly from machine to machine
 then that is the wrong configuration. I have environments both ways.
 It is easy enough to set up address masquarading if desired.

 Either set the local domain in /etc/mailname for an MTA agnositc
 solution OR for postfix explicitly set:

 masquerade_domains = example.com
 masquerade_exceptions = 

Re: hostname question during Debian installation

2012-02-19 Thread Bob Proulx
Tom H wrote:
  Bob Proulx wrote:
  Yes. And also to /etc/postfix/main.cf if postfix is installed.  Or to
  other places if other MTAs are installed.
 
  When you use dpkg-reconfigure exim4-config or dpkg-reconfigure
  postfix, /etc/mailname is updated; in postfix's case because my
  origin is set to it in /etc/postfix/main.cf.
 
  I thought it set 'myhostname'.  No?  I should try a pristine
  installation and look.

And a quite long response from doing this results below.  :-)

 AFAIR, myhostname is /etc/hostname

Not quite.  For Debian's Postfix configuration the postfix myhostname
variable is set to the fqdn in /etc/postfix/main.cf.  Postfix requires
myhostname to be the fqdn.  The default value for Postfix is to use
the value of `hostname`.  However in Debian the default hostname is
the short hostname without the domain name.  Therefore Postfix's
default of `hostname` isn't suitable and must be supplemented by
setting the FQDN explicitly.

Well...  What I said wasn't quite true.  It is the summary of the
overall result.  What Postfix actually does is somewhat circular.
Here are the official docs and a somewhat longer explanation.

  mydomain (default: see postconf -d output)

  The internet domain name of this mail system. The default is to
  use $myhostname minus the first component, or localdomain
  (Postfix 2.3 and later). $mydomain is used as a default value for
  many other configuration parameters.

  myhostname (default: see postconf -d output)

  The internet hostname of this mail system. The default is to use
  the fully-qualified domain name (FQDN) from gethostname(), or to
  use the non-FQDN result from gethostname() and append
  .$mydomain. $myhostname is used as a default value for many
  other configuration parameters.

If not set then it sets mydomain from the fqdn obtained from hostname
or to localdomain if that isn't a fqdn.  On Debian with a short
hostname set that means mydomain always defaults to localdomain.

If not set then it sets myhostname from the non-fqdn obtained from
hostname and appends mydomain.  On Debian with a short hostname that
means myhostname always defaults to somename.localdomain.  And if the
hostname was chosen to be localhost then it would default to
localhost.localdomain which is one consistent and desirable strategy
for thin client systems without a network and without a network domain
name.

[Postfix was born on systems where the hostname was normally set to
the fqdn.  In that environment the above makes a lot of sense.  On
Debian with the short hostname it means that myhostname should always
be set to provide that supplemental domain name information.]

Something similar happens with Exim because exim4-config sets up
/etc/exim4/update-exim4.conf.conf with the fqdn too.

 and myorigin is /etc/mailname.

Yes.  If an MTA has been installed.  That file does not exist if no
MTA has been installed.

 What I find somewhat weird is that when you install Debian,
 /etc/hostname and /etc/mailname are the same.

They are only the same if you choose a fqdn for the hostname.  By your
comment I read that it implies that you do choose a fqdn for your
hostnames?  (And that you always choose either Standard system or
otherwise install an MTA?)  That is why they would be the same for
you.  If you choose a short name for the hostname, which is the worded
with recommendation from the debian-installer and so most people
probably choose it, then they are different.  /etc/hostname will be
the short name and /etc/mailname will be the fqdn.

The debian-installer says:

  Please enter the hostname for this system.

  The hostname is a single word that identifies your system to the
  network.  If you don't know what your hostname should be, consult your
  network administrator.  If you are setting up your own home network,
  you can make something up here.

By saying single word and defaulting to a single word such as
dhcp224 for the hostname I think most people wouldn't type in the
fully qualified domain name.  Although typing in a fqdn results in a
perfectly valid system configuration.  And if you do so then it
doesn't ask you for a domain name separately.  I always used to use
that configuration.  In previous releases I recall that the wording
was much more strong that it should not be the fqdn.  I would need to
try previous releases in order to know for sure but I think that
wording has been softened in Squeeze.

Additionally if you choose Standard system utilities from the task
selection menu then you get Exim installed since exim4 is graced with
being marked as Priority: standard.  If you unselect that box then
you don't get any MTA installed (which I do in many configurations)
unless you have preseeded in Postfix or something else.  If you don't
have an MTA installed then /etc/mailname is also not installed.

In which case /etc/mailname is different from /etc/hostname by virtue
of not being there.  A valid system configuration is one without 

Re: hostname question during Debian installation

2012-02-15 Thread Tom H
On Wed, Feb 15, 2012 at 2:12 AM, Bob Proulx b...@proulx.com wrote:
 Martin T wrote:


 thank you for replies! So am I correct, that hostname set during the
 installation is:

You're welcome.


 1) mapped to an address from 127.0.0.0/8 range in /etc/hosts file

 Specifically 127.0.1.1 so that it is always available and doesn't
 conflict or confuse with 127.0.0.1 localhost.  The newer networking
 subsystem is event driven and supports hotplug devices.  It may come
 and go.  Having a local address 127.0.1.1 will always exist and will
 always map back to the hostname even if the main networking is
 unplugged.

 It's different from traditional systems but it solves problems
 introduced by event driven hotpluggable network devices.  It allows a
 system to always be able to contact itself and the reverse mapping of
 the IP address back to a name always maps back to itself.

 This is important on mobile devices which may be offline but is a
 consistent strategy and works well on non-mobile devices too.

+1

libnss-myhostname provides the same functionality as adding the
127.0.1.1 line in /etc/hosts.


 2) written to /etc/mailname

 Yes. And also to /etc/postfix/main.cf if postfix is installed.  Or to
 other places if other MTAs are installed.

When you use dpkg-reconfigure exim4-config or dpkg-reconfigure
postfix, /etc/mailname is updated; in postfix's case because my
origin is set to it in /etc/postfix/main.cf.

Mutt also uses it but it can be overridden by ~/.muttrc.


 3) written to message of the day file

 No.  The /etc/motd doesn't include the hostname.  You are thinking of
 /etc/issue but it also doesn't include the hostname either.  It
 may include @char and \char sequences which substitute the dynamically
 hostname at runtime though.

/etc/motd is a symlink to /var/run/motd, which is generated at
boot by /etc/init.d/bootlogs and contains the output uname -snrvm,
so /etc/motd does contain a box's hostname.


 4) usually used in shell prompt(for example \[\e]0;\u@\h:
 \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$)

Like /etc/issue (where the hostname's set by /n), the hostname in
the prompt's set
 by \h so it's changed dynamically at boot.


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAOdo=SzOiK84jW+miJixSsagaa7=qhb6kyaaymdq1wsjkha...@mail.gmail.com



Re: hostname question during Debian installation

2012-02-15 Thread Bob Proulx
Tom H wrote:
 Bob Proulx wrote:
  Yes. And also to /etc/postfix/main.cf if postfix is installed.  Or to
  other places if other MTAs are installed.
 
 When you use dpkg-reconfigure exim4-config or dpkg-reconfigure
 postfix, /etc/mailname is updated; in postfix's case because my
 origin is set to it in /etc/postfix/main.cf.

I thought it set 'myhostname'.  No?  I should try a pristine
installation and look.

 Mutt also uses it but it can be overridden by ~/.muttrc.

Doesn't mutt simply use `hostname`?

  3) written to message of the day file
 
  No.  The /etc/motd doesn't include the hostname.  You are thinking of
  /etc/issue but it also doesn't include the hostname either.  It
  may include @char and \char sequences which substitute the dynamically
  hostname at runtime though.
 
 /etc/motd is a symlink to /var/run/motd, which is generated at
 boot by /etc/init.d/bootlogs and contains the output uname -snrvm,
 so /etc/motd does contain a box's hostname.

You are right.  It does have the hostname.  But it isn't something
that needs to be updated.  It is fully dynamic.  I think it falls into
the category of things that /use/ the hostname but don't need to be
/set/ to it.

  4) usually used in shell prompt(for example \[\e]0;\u@\h:
  \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$)
 
 Like /etc/issue (where the hostname's set by /n), the hostname in
 the prompt's set
  by \h so it's changed dynamically at boot.

Yep.  So nothing needs to be done about it.

Bob


signature.asc
Description: Digital signature


Re: hostname question during Debian installation

2012-02-15 Thread Tom H
On Wed, Feb 15, 2012 at 4:35 PM, Bob Proulx b...@proulx.com wrote:
 Tom H wrote:
 Bob Proulx wrote:


 Yes. And also to /etc/postfix/main.cf if postfix is installed.  Or to
 other places if other MTAs are installed.

 When you use dpkg-reconfigure exim4-config or dpkg-reconfigure
 postfix, /etc/mailname is updated; in postfix's case because my
 origin is set to it in /etc/postfix/main.cf.

 I thought it set 'myhostname'.  No?  I should try a pristine
 installation and look.

(Gmail's ever helpful autocorrect turned myorigin above into my origin...)

AFAIR, myhostname is /etc/hostname and myorigin is /etc/mailname.

What I find somewhat weird is that when you install Debian,
/etc/hostname and /etc/mailname are the same. So if it's
box.company.internal and bob runs mail tom, bob's address'll be
bob@box.company.internal. That's fine when emailing on a box or from
one box to another within company.internal.

There was a debian-devel thread where there was an argument about
whether /etc/mailname should be box.company.internal or
company.internal.

If you you do a regular install or don't use a preseed that installs
postfix, you'll have exim4 by default. You can then change
/etc/hostname and /etc/mailname, install postfix, and see what
gets pulled in as myhostname into /etc/postfix/main.cf. I'm going
to try it too.


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAOdo=szxpn9tarycdah5nhmdvjt5orig6tyn6rb3fu+c04s...@mail.gmail.com



Re: hostname question during Debian installation

2012-02-14 Thread Martin T
Andrei, Tom:

thank you for replies! So am I correct, that hostname set during the
installation is:

1) mapped to an address from 127.0.0.0/8 range in /etc/hosts file
2) written to /etc/mailname
3) written to message of the day file
4) usually used in shell prompt(for example \[\e]0;\u@\h:
\w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$)

..and this is it? Or did I miss any other uses of the hostname? For
some reason I always thought that hostname is definitely used by at
least other hosts in the LAN and local processing running in the
server, but turns out out was wrong(?). I mean one needs to configure
local processes(for example cupsd or snmpd) to use hostname IP
address if he wants to- by default they all use 127.0.0.1 which is
mapped to localhost in /etc/hosts file.


regards,
martin



Kuupäeval 13. veebruar 2012 15:21 kirjutas Tom H tomh0...@gmail.com:
 On Sun, Feb 12, 2012 at 8:16 PM, Martin T m4rtn...@gmail.com wrote:


 During Debian installation there is a question about hostname using
 expert installation mode.

 In both modes but I don't think that regular mode asks you for a domain.


 Am I correct, that hostname inserted during Debian installation is
 associated with a local(address from 127.0.0.0/8 range) IP address:

 If you choose DHCP.


 martin@martin-ThinkPad-T60:~$ hostname
 martin-ThinkPad-T60
 martin@martin-ThinkPad-T60:~$ grep martin-ThinkPad-T60 /etc/hosts
 192.168.1.67    martin-ThinkPad-T60
 ::1     martin-ThinkPad-T60     localhost6.localdomain6 localhost6
 127.0.1.1       martin-ThinkPad-T60
 martin@martin-ThinkPad-T60:~$

 You must've set a static IP address after installation because the
 installer doesn't have the 127.0.1.1 line if you set a static IP
 address within it.


 ..and it's used by few software programs(for example Apache, MySQL),
 but hostname is usable only locally and not reachable from any other
 machine even inside the LAN? In addition, aren't most of the programs
 using 127.0.0.1 address which is mapped to localhost in /etc/hosts
 file not to hostname I set:

 
 martin@martin-desktop:~$ sudo netstat -lnpt
 Active Internet connections (only servers)
 Proto Recv-Q Send-Q Local Address           Foreign Address
 State       PID/Program name
 tcp        0      0 127.0.0.1:8118          0.0.0.0:*
 LISTEN      1233/polipo
 tcp        0      0 127.0.0.1:631           0.0.0.0:*
 LISTEN      1057/cupsd
 tcp6       0      0 ::1:631                 :::*
 LISTEN      1057/cupsd
 martin@martin-desktop:~$


 If yes, then changing the hostname shouldn't break any
 services/programs associated with it?

 You're getting 127.0.0.1 in your netstat output because you're using
 the -n switch. Without -n you'll get localhost.

 To change your hostname, check /etc/hostname, /etc/hosts,  and
 /etc/mailname.


 --
 To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
 with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
 Archive: 
 http://lists.debian.org/caodosylf4vhbyqz+epwq3n2f-196rd6-nogtkf_q2wudpq...@mail.gmail.com



--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/cajx5yvgjmrqkagh+uqj-mamunb7q3wabsjosbsjdbanl1s3...@mail.gmail.com



Re: hostname question during Debian installation

2012-02-14 Thread Bob Proulx
Martin T wrote:
 thank you for replies! So am I correct, that hostname set during the
 installation is:
 
 1) mapped to an address from 127.0.0.0/8 range in /etc/hosts file

Specifically 127.0.1.1 so that it is always available and doesn't
conflict or confuse with 127.0.0.1 localhost.  The newer networking
subsystem is event driven and supports hotplug devices.  It may come
and go.  Having a local address 127.0.1.1 will always exist and will
always map back to the hostname even if the main networking is
unplugged.

It's different from traditional systems but it solves problems
introduced by event driven hotpluggable network devices.  It allows a
system to always be able to contact itself and the reverse mapping of
the IP address back to a name always maps back to itself.

This is important on mobile devices which may be offline but is a
consistent strategy and works well on non-mobile devices too.

 2) written to /etc/mailname

Yes.  And also to /etc/postfix/main.cf if postfix is installed.  Or to
other places if other MTAs are installed.

 3) written to message of the day file

No.  The /etc/motd doesn't include the hostname.  You are thinking of
/etc/issue but it also doesn't include the hostname either.  It
may include @char and \char sequences which substitute the dynamically
hostname at runtime though.

 4) usually used in shell prompt(for example \[\e]0;\u@\h:
 \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$)

Yes.  But lots of programs use the hostname with emphasis on use.
But you will have a very long list if you head down that path of
discovery.

 ..and this is it? Or did I miss any other uses of the hostname?

You missed the most important and primary use of it! :-)

  /etc/hostname

The /etc/hostname is read at boot time and sets the hostname.

 For some reason I always thought that hostname is definitely used by
 at least other hosts in the LAN and local processing running in the
 server, but turns out out was wrong(?). I mean one needs to
 configure local processes(for example cupsd or snmpd) to use
 hostname IP address if he wants to- by default they all use
 127.0.0.1 which is mapped to localhost in /etc/hosts file.

For the most part only processes local to the system need to know the
hostname.  By default the system is a pure client.  If you want to
contact the host from other systems then it is convenient to register
a DNS name to ip address mapping for it so that you can refer to the
host by a hostname.  But that isn't required and neither is it set up
by default.  If you want that then you would need to set it up
yourself.

Bob


signature.asc
Description: Digital signature


Re: hostname question during Debian installation

2012-02-13 Thread Andrei Popescu
On Lu, 13 feb 12, 03:16:17, Martin T wrote:
 During Debian installation there is a question about hostname using
 expert installation mode.
 
During normal mode as well ;)

 Am I correct, that hostname inserted during Debian installation is
 associated with a local(address from 127.0.0.0/8 range) IP address:
 
 
 martin@martin-ThinkPad-T60:~$ hostname
 martin-ThinkPad-T60
 martin@martin-ThinkPad-T60:~$ grep martin-ThinkPad-T60 /etc/hosts
 192.168.1.67  martin-ThinkPad-T60
 ::1   martin-ThinkPad-T60 localhost6.localdomain6 localhost6
 127.0.1.1 martin-ThinkPad-T60
 martin@martin-ThinkPad-T60:~$
 

Yes, as you have shown

 ..and it's used by few software programs(for example Apache, MySQL),
 but hostname is usable only locally and not reachable from any other
 machine even inside the LAN?

This depends a lot on the rest of your network, but I assume you have 
complete control over it and you would have known if you did some 
configuration for that (e.g. added it to /etc/hosts on another 
computer).

 In addition, aren't most of the programs
 using 127.0.0.1 address which is mapped to localhost in /etc/hosts
 file not to hostname I set:
 
 
 martin@martin-desktop:~$ sudo netstat -lnpt
 Active Internet connections (only servers)
 Proto Recv-Q Send-Q Local Address   Foreign Address
 State   PID/Program name
 tcp0  0 127.0.0.1:8118  0.0.0.0:*
 LISTEN  1233/polipo
 tcp0  0 127.0.0.1:631   0.0.0.0:*
 LISTEN  1057/cupsd
 tcp6   0  0 ::1:631 :::*
 LISTEN  1057/cupsd
 martin@martin-desktop:~$
 
 
 If yes, then changing the hostname shouldn't break any
 services/programs associated with it?
 
 All the explanations and clarifications are most welcome!

1. grep -r martin-ThinkPad-T60 /etc/*
2. change all occurrences
3. restart

Kind regards,
Andrei
-- 
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic


signature.asc
Description: Digital signature


Re: hostname question during Debian installation

2012-02-13 Thread Tom H
On Sun, Feb 12, 2012 at 8:16 PM, Martin T m4rtn...@gmail.com wrote:


 During Debian installation there is a question about hostname using
 expert installation mode.

In both modes but I don't think that regular mode asks you for a domain.


 Am I correct, that hostname inserted during Debian installation is
 associated with a local(address from 127.0.0.0/8 range) IP address:

If you choose DHCP.


 martin@martin-ThinkPad-T60:~$ hostname
 martin-ThinkPad-T60
 martin@martin-ThinkPad-T60:~$ grep martin-ThinkPad-T60 /etc/hosts
 192.168.1.67    martin-ThinkPad-T60
 ::1     martin-ThinkPad-T60     localhost6.localdomain6 localhost6
 127.0.1.1       martin-ThinkPad-T60
 martin@martin-ThinkPad-T60:~$

You must've set a static IP address after installation because the
installer doesn't have the 127.0.1.1 line if you set a static IP
address within it.


 ..and it's used by few software programs(for example Apache, MySQL),
 but hostname is usable only locally and not reachable from any other
 machine even inside the LAN? In addition, aren't most of the programs
 using 127.0.0.1 address which is mapped to localhost in /etc/hosts
 file not to hostname I set:

 
 martin@martin-desktop:~$ sudo netstat -lnpt
 Active Internet connections (only servers)
 Proto Recv-Q Send-Q Local Address           Foreign Address
 State       PID/Program name
 tcp        0      0 127.0.0.1:8118          0.0.0.0:*
 LISTEN      1233/polipo
 tcp        0      0 127.0.0.1:631           0.0.0.0:*
 LISTEN      1057/cupsd
 tcp6       0      0 ::1:631                 :::*
 LISTEN      1057/cupsd
 martin@martin-desktop:~$


 If yes, then changing the hostname shouldn't break any
 services/programs associated with it?

You're getting 127.0.0.1 in your netstat output because you're using
the -n switch. Without -n you'll get localhost.

To change your hostname, check /etc/hostname, /etc/hosts,  and
/etc/mailname.


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAOdo=sylf4vhbyqz+epwq3n2f-196rd6-nogtkf_q2wudpq...@mail.gmail.com



hostname question during Debian installation

2012-02-12 Thread Martin T
During Debian installation there is a question about hostname using
expert installation mode.

Am I correct, that hostname inserted during Debian installation is
associated with a local(address from 127.0.0.0/8 range) IP address:


martin@martin-ThinkPad-T60:~$ hostname
martin-ThinkPad-T60
martin@martin-ThinkPad-T60:~$ grep martin-ThinkPad-T60 /etc/hosts
192.168.1.67martin-ThinkPad-T60
::1 martin-ThinkPad-T60 localhost6.localdomain6 localhost6
127.0.1.1   martin-ThinkPad-T60
martin@martin-ThinkPad-T60:~$


..and it's used by few software programs(for example Apache, MySQL),
but hostname is usable only locally and not reachable from any other
machine even inside the LAN? In addition, aren't most of the programs
using 127.0.0.1 address which is mapped to localhost in /etc/hosts
file not to hostname I set:


martin@martin-desktop:~$ sudo netstat -lnpt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address   Foreign Address
State   PID/Program name
tcp0  0 127.0.0.1:8118  0.0.0.0:*
LISTEN  1233/polipo
tcp0  0 127.0.0.1:631   0.0.0.0:*
LISTEN  1057/cupsd
tcp6   0  0 ::1:631 :::*
LISTEN  1057/cupsd
martin@martin-desktop:~$


If yes, then changing the hostname shouldn't break any
services/programs associated with it?

All the explanations and clarifications are most welcome!


regards,
martin


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/cajx5yvhvwdztdxeoj25wwevaymk2ux4uirottmzwhs3jj+q...@mail.gmail.com