OpenVZ Forum


Home » Mailing lists » Users » /etc/hosts
/etc/hosts [message #8925] Mon, 11 December 2006 11:53 Go to next message
Farkas Levente is currently offline  Farkas Levente
Messages: 2
Registered: December 2006
Junior Member
hi,
why put openvz into each VE's /etc/hosts the hostname itself too? ie:
127.0.0.1 host.example.com host localhost localhost.localdomain
and why do this on all reboot, why not accept
127.0.0.1 localhost localhost.localdomain
it has some reasons?
thanks.
yours.

--
Levente "Si vis pacem para bellum!"
Re: /etc/hosts [message #8926 is a reply to message #8925] Mon, 11 December 2006 13:34 Go to previous messageGo to next message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

Farkas Levente wrote:
> hi,
> why put openvz into each VE's /etc/hosts the hostname itself too? ie:
> 127.0.0.1 host.example.com host localhost localhost.localdomain
> and why do this on all reboot, why not accept
> 127.0.0.1 localhost localhost.localdomain
> it has some reasons?
> thanks.
> yours.
>

If HOSTNAME set in VE config it is updated on every VE start.
hostname is bound to 127.0.0.1 for simplicity of updates on ip change i.e
it doesn't depend on ip in such a scheme.

Kirill
Re: /etc/hosts [message #8930 is a reply to message #8926] Mon, 11 December 2006 14:43 Go to previous messageGo to next message
Farkas Levente is currently offline  Farkas Levente
Messages: 2
Registered: December 2006
Junior Member
Kirill Korotaev wrote:
> Farkas Levente wrote:
>> hi,
>> why put openvz into each VE's /etc/hosts the hostname itself too? ie:
>> 127.0.0.1 host.example.com host localhost localhost.localdomain
>> and why do this on all reboot, why not accept
>> 127.0.0.1 localhost localhost.localdomain
>> it has some reasons?
>> thanks.
>> yours.
>>
>
> If HOSTNAME set in VE config it is updated on every VE start.
> hostname is bound to 127.0.0.1 for simplicity of updates on ip change i.e
> it doesn't depend on ip in such a scheme.

ok, but in this case all tool like netstat, iptables etc.. assumes
127.0.0.1 as hostname and it's really annoying netstat -lt:
------------------------------
# netstat -lt
tcp 0 0 host.example.com:smtp *:* LISTEN
tcp 0 0 host.example.com:smtp *:* LISTEN
# netstat -ltn
tcp 0 0 127.0.0.1:smtp *:* LISTEN
tcp 0 0 1.2.3.4:smtp *:* LISTEN
------------------------------

--
Levente "Si vis pacem para bellum!"
Re: /etc/hosts [message #8992 is a reply to message #8930] Tue, 12 December 2006 14:51 Go to previous message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

> Kirill Korotaev wrote:
>
>>Farkas Levente wrote:
>>
>>>hi,
>>>why put openvz into each VE's /etc/hosts the hostname itself too? ie:
>>>127.0.0.1 host.example.com host localhost localhost.localdomain
>>>and why do this on all reboot, why not accept
>>>127.0.0.1 localhost localhost.localdomain
>>>it has some reasons?
>>>thanks.
>>>yours.
>>>
>>
>>If HOSTNAME set in VE config it is updated on every VE start.
>>hostname is bound to 127.0.0.1 for simplicity of updates on ip change i.e
>>it doesn't depend on ip in such a scheme.
>
>
> ok, but in this case all tool like netstat, iptables etc.. assumes
> 127.0.0.1 as hostname and it's really annoying netstat -lt:
> ------------------------------
> # netstat -lt
> tcp 0 0 host.example.com:smtp *:* LISTEN
> tcp 0 0 host.example.com:smtp *:* LISTEN
> # netstat -ltn
> tcp 0 0 127.0.0.1:smtp *:* LISTEN
> tcp 0 0 1.2.3.4:smtp *:* LISTEN
> ------------------------------
Ah, I see...
There are 2 easy choices here:
- change your VE /etc/hosts and add a "real-IP hostname" line to it.
vzctl will notice it and will stop changing it.
actually one manage hostnames itself from VE this way.
- fix vzctl to add such lines, however, it is harder,
since will require /etc/hosts modification on each ipadd/ipdel/hostname-change
etc. and it is not clear how to leave the ability to manage /etc/hosts from inside VE.

Thanks,
Kirill
Previous Topic: sysctl parameter question
Next Topic: Vzsplit question
Goto Forum:
  


Current Time: Thu May 09 13:39:51 GMT 2024

Total time taken to generate the page: 0.01721 seconds