Page 1 of 1

Ip resolves to local host

Posted: Sat Aug 18, 2018 3:07 pm
by soydepr
So i was able to install wordpress on pi2. Put the settings in http://freedns.afraid.org and also in my routers

But when I connect t locally with ip i get local host not found same from the outside

My etc/resolves has 192.168.1.1

In /etc/hosts i have entry

192.168.1.9. [email protected]
192.168.1.9 foo

Re: Ip resolves to local host

Posted: Sat Aug 18, 2018 3:14 pm
by DougieLawson
You can't use 10.xxx.xxx.xxx/8 or 172.[16-31].xxx.xxx/16, 192.168.xxx.xxx/24 or 169.254.xxx.xxx/16 addresses on the WAN side of your network. Those four blocks are local only and not routed.

Re: Ip resolves to local host

Posted: Sat Aug 18, 2018 5:23 pm
by soydepr
Please explain. Not sure i understand thanks

Re: Ip resolves to local host

Posted: Sat Aug 18, 2018 5:48 pm
by DougieLawson
https://en.wikipedia.org/wiki/Private_network
https://en.wikipedia.org/wiki/Link-local_address

Your public address won't be in those address ranges. If your Wordpress site doesn't use a public internet address it won't work when a remote visitor tries to access it.

Re: Ip resolves to local host

Posted: Sat Aug 18, 2018 5:51 pm
by soydepr
Thanks i must read this not sure why it works on my other pi

Is this a wordpress thing

May i ask which entry is causing it to resolve to local host in all my machines

Re: Ip resolves to local host

Posted: Sat Aug 18, 2018 8:37 pm
by fbe
You should type

Code: Select all

man hosts
and read that too.

Code: Select all

192.168.1.9. [email protected]
seems to be an invalid line for /etc/hosts

Code: Select all

192.168.1.9 foo.com foo
might be better.
The lines in /etc/hosts are used for domain name resolution on the machine, where the /etc/hosts is stored.

Re: Ip resolves to local host

Posted: Sun Aug 19, 2018 10:52 am
by soydepr
I still dont understand why one of my machines when trying to access via ip it resolves to localhost

Re: Ip resolves to local host

Posted: Sun Aug 19, 2018 11:48 am
by Ernst
soydepr wrote:
Sun Aug 19, 2018 10:52 am
I still dont understand why one of my machines when trying to access via ip it resolves to localhost
I am going to ask a number of questions, the purpose of these questions is to give a reason to think about the problem and to give you a chance to provide more information that can be used to answer your question.

I still dont understand why
  • one of my machines: what machine, what OS, OS version, how connected to the network ?
  • when trying to access: using what ? and how ? what protocol and what programs ?
  • via ip: over what ? ethernet ? wifi ? internet ?
  • it resolves to localhost: what was the input ?, where did it happen ?, why does it resolve and what did resolve it ?
The answer to the last point is most likely what you are looking for.

Re: Ip resolves to local host

Posted: Sun Aug 19, 2018 1:38 pm
by soydepr
one of my machines: what machine, what OS, OS version, how connected to the network ?

I have 2 pis. both running raspbian stretch



when trying to access: using what ? and how ? what protocol and what programs ?

from my iPad or Mac I can connect to 192.168.1.13/admin fine. (pi 1). pi-hole
but when I try 192.168.1.9. (pi 2 ) Wordpress it fails

on pi 2 I installed a wordpress servet which I can access from pi 2 using localhost and/or ip - but not from my iPad

via ip: over what ? ethernet ? wifi ? internet ?

all my machines are on wifi

my understanding of both /etc/hosts and /etc/resolv.conf is the following

/etc/resolv.conf should tell my browser where to look for 192.168.1.9 and /etc/hosts should tell it its pi2 (plain English )




it resolves to localhost: what was the input ?, where did it happen ?, why does it resolve and what did resolve it ?
the input was IP address so when I enter 192.168.1.9 it fails

The answer to the last point is most likely what you are looking for.

Re: Ip resolves to local host

Posted: Sun Aug 19, 2018 1:43 pm
by DougieLawson
I've a feeling https://codex.wordpress.org/Changing_The_Site_URL is the answer the OP is trying to find.

Re: Ip resolves to local host

Posted: Sun Aug 19, 2018 2:03 pm
by soydepr
Interesting but didn't change the outcome .

still when I put ip internally it resolves to localhost not found

so here is core dumb question from me but I think is root of problem
when I type ip I expect my router to find the address inside the network .
who's telling who to look for localhost ?

is it my router or is it Wordpress
since it works for pi 1 I suspect is either Wordpress or someone in my /etc/resolv.conf on pi2

Re: Ip resolves to local host

Posted: Sun Aug 19, 2018 2:36 pm
by soydepr
IS WORKING.

so seems I had a typo in wp.config.php after Doug post.

I would like Doug and fbe to confirm my understanding

when I type 192 ip in browser .
browser ask my gw to find the ip or does it ask my dns entry on my wifi

in 192.168.1.13 I have entry pointing to .9 ip such as

192.168.1.9. vorman in /etc/hosts

thanks both for your help I've learned a lot