Can't ping/telnet localhost. Points to a wrong public IP.

I've been developing Node.js apps on my localhost on port 1337 for last two years with no problem as shown below.


$ node app

App started on port 1337


Today I wanted to test how things go with default port 80, so I did:


$ sudo node app

App started on port 80


But after that my network went crazy. Now I can't access any local address including localhost. When I ping to localhost it points to some weird public IP address (218.38.137.125) instead of 127.0.0.1.


$ ping localhost

PING localhost.local (218.38.137.125): 56 data bytes

...


218.38.137.125 is not my public IP address.


When I telnet I see the same wrong IP address:


$ telnet localhost

Trying 218.38.137.125...

telnet: connect to address 218.38.137.125: Connection refused

telnet: Unable to connect to remote host


My */etc/hosts* is the following:


127.0.0.1 localhost

255.255.255.255 broadcasthost

::1 localhost

fe80::1%lo0 localhost


**Can anybody suggest what's wrong?**


I'm completely out of guesses and can't even continue my work.

Posted on Jan 25, 2013 9:07 PM

Reply
2 replies

Jan 25, 2013 9:26 PM in response to kadishmal

try doing a "traceroute localhost" see where it jumps to that address.


That address is a Korean subnet range.


[ Network Information ]

IPv4 Address : 218.38.0.0 - 218.39.255.255 (/15)

Service Name : broadNnet

Organization Name : SK Broadband Co Ltd

Organization ID : ORG3930

Address : 267, Seoul Namdaemunno 5(o)-ga Jung-gu SK NamsanGreen Bldg.

Zip Code : 100-711

Registration Date : 20021218


More specific assignment information is as follows.


[ Network Information ]

IPv4 Address : 218.38.136.0 - 218.38.139.255 (/22)

Network Name : HANANET-INFRA

Organization Name : SK Broadband Co Ltd

Organization ID : ORG3930

Address : 267, Seoul Namdaemunno 5(o)-ga Jung-gu SK NamsanGreen Bldg.

Zip Code : 100-711

Registration Date : 20041015

Publishes : Y

Jan 25, 2013 9:34 PM in response to ashobe

Yes, I also checked on the Web. But I found the problem which happens to be the same as in https://discussions.apple.com/thread/4442142?answerId=20103434022#20103434022.


When I "file -b /etc/hosts", it outputs ASCII English text, with CR line terminators while it should output only ASCII English text.


This is because I used Sublime Text 2 to edit /etc/hosts. Copying and pasting its contents via "vi" fixed everything.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Can't ping/telnet localhost. Points to a wrong public IP.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.