4

I am using ubuntu 13.10 and I have used ping before to check server is up/down.

Can someone help me understand, as I'm unable to find anything explaining this I did the usual ping command

ping 8.8.8.8

output without google domain

64 bytes from 8.8.8.8: icmp_seq=1 ttl=48 time=35.9 ms

Please note the trailing .(period) in IP

ping 8.8.8.8.

output with google domain

64 bytes from google-public-dns-a.google.com (8.8.8.8): icmp_seq=1 ttl=48 time=35.3 ms

Output:

developer@chnphp006:~$ ping 8.8.8.8

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=48 time=35.9 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=48 time=35.7 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=48 time=46.2 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=48 time=36.6 ms
^C
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 35.779/38.658/46.276/4.415 ms


developer@chnphp006:~$ ping 8.8.8.8.

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from google-public-dns-a.google.com (8.8.8.8): icmp_seq=1 ttl=48 time=35.3 ms
64 bytes from google-public-dns-a.google.com (8.8.8.8): icmp_seq=2 ttl=48 time=35.1 ms
64 bytes from google-public-dns-a.google.com (8.8.8.8): icmp_seq=3 ttl=48 time=36.1 ms
64 bytes from google-public-dns-a.google.com (8.8.8.8): icmp_seq=4 ttl=48 time=35.8 ms
^C
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3001ms
rtt min/avg/max/mdev = 35.128/35.631/36.145/0.441 ms

What difference does the trailing period make in ping command?

Update:

This happens only on Ubuntu systems, not in centos/Debian.

Other Ex:

developer@chnphp006:~$ ping 198.252.206.16
PING 198.252.206.16 (198.252.206.16) 56(84) bytes of data.
64 bytes from 198.252.206.16: icmp_seq=1 ttl=52 time=258 ms
64 bytes from 198.252.206.16: icmp_seq=2 ttl=52 time=258 ms
64 bytes from 198.252.206.16: icmp_seq=3 ttl=52 time=273 ms
^C
--- 198.252.206.16 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 258.144/263.339/273.598/7.278 ms

developer@chnphp006:~$ ping 198.252.206.16.
PING 198.252.206.16 (198.252.206.16) 56(84) bytes of data.
64 bytes from stackoverflow.com (198.252.206.16): icmp_seq=1 ttl=52 time=259 ms
64 bytes from stackoverflow.com (198.252.206.16): icmp_seq=2 ttl=52 time=267 ms
64 bytes from stackoverflow.com (198.252.206.16): icmp_seq=3 ttl=52 time=271 ms
^C
--- 198.252.206.16 ping statistics ---
7 packets transmitted, 6 received, 14% packet loss, time 6000ms
rtt min/avg/max/mdev = 258.292/264.777/274.093/6.447 ms
Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47
ganesh
  • 151
  • 4
  • could have explained while down vote!..either what is wrong in my question or the how this happening!.. otherwise, What is the meaning of down vote? – ganesh Oct 31 '14 at 11:09
  • This happens only in ubuntu system. – ganesh Oct 31 '14 at 11:49

2 Answers2

4

Typically a trailing dot is used to denote that the hostname used is a fully qualified domainname (under the DNS root).

Appending the dot would prevent the search-domain from being appended to (short) hostnames in DNS lookups. Why it has the result it does in your examples with an IP-address, I don't know.

It may be that normally a hostname with a dot . also gets interpreted as a FQDN except when the decimal representation of an IP-address( four numbers [0-255] separated by dots) is detected, but that matching rule fails when the trailing dot is added to the ip-address.

If your search domain is example.com and the A record for www.example.com. exists:

ping www

should resolve to :

ping www.example.com. 

and the A record of your webserver and result in some ICMP packets being sent to your webserver.

ping www.

will fail, because AFAIK there is no top-level domain www

HBruijn
  • 77,029
  • 24
  • 135
  • 201
3

The trailing period changes it from an IP address that it just uses in numeric form to a domain name that it looks up using reverse address resolution (in-addr.arpa domain).

David Schwartz
  • 31,449
  • 2
  • 55
  • 84