The way the centos 7 and centos 6 behaves when the name servers are not available is different.
[root@ip-172-31-67-0 centos]# cat /etc/redhat-release CentOS release 6.9 (Final) [root@ip-172-31-67-0 centos]# cat /etc/resolv.conf ; generated by /sbin/dhclient-script #search ec2.internal #nameserver 172.31.0.2 [root@ip-172-31-67-0 centos]# hostname ip-172-31-67-0 [root@ip-172-31-67-0 centos]# ping ip-172-31-67-0 ping: unknown host ip-172-31-67-0 [root@ip-172-31-67-0 centos]# |
[root@ip-172-31-70-19 centos]# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) [root@ip-172-31-70-19 centos]# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) [root@ip-172-31-70-19 centos]# cat /etc/resolv.conf ; generated by /usr/sbin/dhclient-script #search ec2.internal #nameserver 172.31.0.2 [root@ip-172-31-70-19 centos]# hostname ip-172-31-70-19 [root@ip-172-31-70-19 centos]# ping ip-172-31-70-19 PING ip-172-31-70-19 (172.31.70.19) 56(84) bytes of data. 64 bytes from ip-172-31-70-19 (172.31.70.19): icmp_seq=1 ttl=64 time=0.007 ms 64 bytes from ip-172-31-70-19 (172.31.70.19): icmp_seq=2 ttl=64 time=0.027 ms 64 bytes from ip-172-31-70-19 (172.31.70.19): icmp_seq=3 ttl=64 time=0.027 ms ^C — ip-172-31-70-19 ping statistics — 3 packets transmitted, 3 received, 0% packet loss, time 1999ms rtt min/avg/max/mdev = 0.007/0.020/0.027/0.010 ms [root@ip-172-31-70-19 centos]# |
As you can see above, in case of Centos 7, even when the name servers are commented out, the ping to the hostname works. Whereas in case of Centos 6, the ping doesn’t work making the hostname not known. The /etc/hosts doesn’t have any entry for the hostname in both the cases. So essentially the ping to the hostname, if is successful, will make the SysLog part work. |