LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-07-2016, 02:44 AM   #1
luofeiyu
Member
 
Registered: Aug 2015
Posts: 237

Rep: Reputation: Disabled
Why ping hwy.local is not parsed into 127.0.0.1 ?


My os is debian8,here is the config file in my /etc/hosts
Code:
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 hwy.local/wp
127.0.0.1 hwy.local/test
My local ip is 192.168.1.101 in local lan.
Code:
ping hwy.local/wp
PING hwy.local/wp (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.029 ms
^C
--- hwy.local/wp ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.029/0.034/0.037/0.002 ms
root@hwy:/home/debian8# ping hwy.local/test
PING hwy.local/test (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.114 ms
^C
--- hwy.local/test ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5000ms
rtt min/avg/max/mdev = 0.031/0.050/0.114/0.028 ms
root@hwy:/home/debian8# ping hwy.local
PING hwy.local (192.168.1.101) 56(84) bytes of data.
64 bytes from 192.168.1.101: icmp_seq=1 ttl=64 time=0.026 ms
Why ping hwy.local is not parsed into 127.0.0.1 ?
Why ping hwy.local is parsed into 192.168.1.101?

Last edited by luofeiyu; 04-07-2016 at 04:32 AM.
 
Old 04-07-2016, 05:16 AM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,339

Rep: Reputation: Disabled
You're asking why a host name doesn't resolve to 127.0.0.1, even though there's no entry in the hosts file for the name in question?

Only /etc/hosts can be used to point names to a loopback address. (Well, I guess there's nothing preventing one from creating a A record in a DNS zone pointing to 127.0.0.1, but it wouldn't make much sense.)

Furthermore:
  1. It's not a good idea to have host names other than "localhost" resolve to the loopback address. It may result in some processes inadvertently binding to 127.0.0.1, and thus becoming isolated from the network.
  2. "hwy.local/wp" and "hwy.local/test" are not valid host names, as they contain a slash. If they're supposed to be URLs then they doesn't belong in /etc/hosts, since one cannot assign IP addresses to URLs, only to hosts.
 
1 members found this post helpful.
Old 04-08-2016, 10:52 AM   #3
dt64
Member
 
Registered: Sep 2012
Distribution: RHEL5/6, CentOS5/6
Posts: 218

Rep: Reputation: 38
What is the FQDN of your machine? Could it be you set it to hwy.local?
This would explain why the resolves its own name to its LAN address 192.168.1.101.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] I can not ping 127.0.0.1 on Slackware Xerxeslins Linux - Networking 2 07-25-2010 01:29 AM
Can not ping 127.0.0.1 dan0r Linux - Networking 12 06-15-2006 04:08 PM
FC4 won't ping 127.0.0.1 or the internet, but will ping local computers jalsk Linux - Networking 4 11-22-2005 05:59 PM
No ping replies on 127.0.0.1 zzero Linux - Networking 14 03-15-2004 10:17 AM
No ping 127.0.0.1 Spi Linux - Networking 11 07-18-2003 11:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration