| 
		
			| /etc/hosts [message #8925] | Mon, 11 December 2006 11:53  |  
			| 
				
				
					|  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 #8992 is a reply to message #8930] | Tue, 12 December 2006 14:51  |  
			| 
				
				
					|  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
 |  
	|  |  |