Raspberry Pi_Eng_11.3.2 Communication with Host Name


Published Book on Amazon


All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2


출판된 한글판 도서


최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상)
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하)


Original Book Contents


11.3.2  Communication with Host Name

 

First, if you run the "ping" command on the Raspberry Pi system, you can get the result as follows.

 

pi@raspberrypi ~ $ ping  raspberrypi

PING raspberrypi (127.0.1.1) 56(84) bytes of data.

64 bytes from raspberrypi (127.0.1.1): icmp_req=1 ttl=64 time=0.182 ms

64 bytes from raspberrypi (127.0.1.1): icmp_req=2 ttl=64 time=0.183 ms

64 bytes from raspberrypi (127.0.1.1): icmp_req=3 ttl=64 time=0.189 ms

64 bytes from raspberrypi (127.0.1.1): icmp_req=4 ttl=64 time=0.208 ms

64 bytes from raspberrypi (127.0.1.1): icmp_req=5 ttl=64 time=0.186 ms

64 bytes from raspberrypi (127.0.1.1): icmp_req=6 ttl=64 time=0.233 ms

 

--- raspberrypi ping statistics ---

6 packets transmitted, 6 received, 0% packet loss, time 5005ms

rtt min/avg/max/mdev = 0.182/0.196/0.233/0.025 ms

 

In local, you can see that the IP address of 127.0.1.1 corresponding to loop back is assigned.

If you try to execute the "ping" command using the host name on another computer, you can see that it works same as using IP address. The following is the result of checking on a computer using MS Windows.

 

C:\>ping raspberrypi

PING raspberrypi3 (192.168.1.202) 56(84) bytes of data.

64 bytes from raspberrypi3 (192.168.1.202): icmp_seq=1 ttl=64 time=0.120 ms

64 bytes from raspberrypi3 (192.168.1.202): icmp_seq=2 ttl=64 time=0.085 ms

64 bytes from raspberrypi3 (192.168.1.202): icmp_seq=3 ttl=64 time=0.099 ms

64 bytes from raspberrypi3 (192.168.1.202): icmp_seq=4 ttl=64 time=0.065 ms

 

--- raspberrypi3 ping statistics ---

13 packets transmitted, 13 received, 0% packet loss, time 11993ms

rtt min/avg/max/mdev = 0.053/0.080/0.120/0.021 ms

 

On the remote computer, you can see that the IP address of 192.168.1.202 corresponding to Ethernet is specified.