[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 127.0.0.1 isn't the same as localhost
From: |
Werner Flamme |
Subject: |
Re: 127.0.0.1 isn't the same as localhost |
Date: |
Fri, 06 Jan 2017 06:28:07 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 |
Smith, Graham - Computing Technical Officer [05.01.2017 20:09]:
> Something simple that eluded me for a while today - I'll send this out just
> in case it helps someone else.
>
> In my control file I had:
>
> allow 127.0.0.1
>
> But I couldn't view monit status or monit summary on the command line. I kept
> getting:
[...]
> That made me go back and look at the authentication, but all looked ok. I
> swapped
> allow 127.0.0.1 for allow localhost and all was good again. I pinged localhost
> and it resolved to ::1 aha! so it's an ipv6 resolution not ipv4!
> I should have spotted this quicker. And of course ::1 works instead of
> localhost in the control file.
>
> This is 5.20.0 on Debian Jessie by the way. Probably the same happens in all
> current distros.
This has nothing to do with Monit as a software. It is a problem with
any host that has entries in /etc/hosts that look like
127.0.0.1 localhost
::1 localhost ipv6-localhost ipv6-loopback
Here, you assign the same hostname (localhost) to two different IP
addresses. If you remove the single string "localhost" after "::1" and
leave the other entries on the line untouched, you have this problem
solved as well. That's how I handle it on my hosts for years now.
Werner
--
smime.p7s
Description: S/MIME Cryptographic Signature