Hi All

I found a interesting  issue with /etc/hosts setting in different Linux system.

My stunnel.conf setting  like below

[HOST]
cert = client.crt
key = client.key
CAfile = server.crt
client = yes
accept = 10.160.160.88:57853
connect = 10.136.160.21:3520

I would like to connect server 10.136.160.21:3520  via stunnel  10.160.160.88:57853

Part A
If my hostname and  /etc/hosts setting in different System as followings all will works well

1. CentOS 7 32bit 

$hostname
localhost.localdomain
$ cat /etc/hosts  
127.0.0.1 localhost localhost4 localhost4.localdomain4
10.136.160.88 localhost.localadmin

2. Redhat 7 64bit

$hostname
localhost.localdomain
$ cat /etc/hosts  
127.0.0.1 localhost  localhost4 localhost4.localdomain4
10.136.160.88 localhost.localadmin

3. Ubuntu15.10 64bit
$hostname
virtual-machine
$ cat /etc/hosts  
127.0.0.1 localhost 
10.136.160.88 virtual-machine
Part B.
If the "127.0.0.1"  include the hostname in /etc/hosts, both CentOS and Fedora will fail,  but Ubuntu still work

1. CentOS 7 32bit 

$hostname
localhost.localdomain
$ cat /etc/hosts  
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
10.136.160.253 localhost.localdomain

2. Redhat 7 64bit

$hostname
localhost.localdomain
$ cat /etc/hosts  
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
10.136.160.88 localhost.localadmin

3. Ubuntu15.10 64bit
$hostname
virtual-machine
$ cat /etc/hosts  
127.0.0.1 localhost  virtual-machine
10.136.160.88 virtual-machine
I think it maybe not a stunnel issue, but I'd like to know why it has different behavior 

Thanks
Jay