127.0.1.1 in /etc/hosts

Stuart McGraw smcg4191 at mtneva.com
Tue Nov 28 07:07:54 UTC 2017


On 11/27/2017 05:08 PM, Karl Auer wrote:
> On Mon, 2017-11-27 at 15:47 -0700, Stuart McGraw wrote:
>> What is the meaning of the line:
>>
>>   127.0.1.1  mymachine.xxx  mymachine
> 
> It tells local resolvers that the names "mymachine" and "mymachine.xxx"
> have the IP address 127.0.1.1, so if you e.g. "ping mymachine" you will
> be pinging 127.0.1.1. There is nothing magical about it.
> 
>> package install.)  I am installing some backup software (bacula) 
>> which for reasons I haven't delved into, dislikes (as in breaks) 
>> when it resolves "mymachine"s address and ends up with 127.0.0.1 
>> which is what happens when the above line is present in /etc/hosts.  
> 
> bacula getting 127.0.0.1 for "mymachine" has nothing to do with the
> above line in your /etc/hosts file. 127.0.0.1 is not the same as
> 127.0.1.1. If that is not a typo on your part, then something else is
> disturbing bacula.

Except that netstat shows bacula listening on 127.0.0.1 (and
broken) when the 127.0.1.1 line is in the hosts file and on 
0.0.0.0 (and working) when it is not.

>> Will I break something else if I remove or replace the line 
>> with the machine's "real" ip address which keeps bacula happy, 
>> eg:
>>
>>   10.10.200.85  mymachine.xxx  mymachine
> 
> The machine's "real IP address *is* 127.0.1.1 :-)

I know, that why I put it in quotes :-)
 
> The address 10.10.200.85 is the address of one interface on the
> machine.
> 
> What is bacula trying to resolve? If it is trying to resolve
> "mymachine" or "mymachine.xxx" 

yes.

> then it will be getting 127.0.1.1. You
> can fix that by configuring bacula to use a different name e.g.
> "boris", then appending that name and the appropriate address to
> /etc/hosts:
> 
>    10.10.200.85 boris
> 
> That is IMHO a nicer option that changing the mymachine line.

I hadn't thought of that, but I have done that in the past in other
situations and never liked it much, but you may be right.  I'll need
to ponder it a little more.  I could also just hardwire the ip address 
into the bacula's config files but using a name seems a little less
fragile.

Thanks.





More information about the ubuntu-users mailing list