soydepr
Posts: 155
Joined: Mon Mar 24, 2014 10:51 am

Ip resolves to local host

Sat Aug 18, 2018 3:07 pm

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

User avatar
DougieLawson
Posts: 36322
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Ip resolves to local host

Sat Aug 18, 2018 3:14 pm

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.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

soydepr
Posts: 155
Joined: Mon Mar 24, 2014 10:51 am

Re: Ip resolves to local host

Sat Aug 18, 2018 5:23 pm

Please explain. Not sure i understand thanks

User avatar
DougieLawson
Posts: 36322
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Ip resolves to local host

Sat Aug 18, 2018 5:48 pm

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.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

soydepr
Posts: 155
Joined: Mon Mar 24, 2014 10:51 am

Re: Ip resolves to local host

Sat Aug 18, 2018 5:51 pm

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

fbe
Posts: 529
Joined: Thu Aug 17, 2017 9:08 pm

Re: Ip resolves to local host

Sat Aug 18, 2018 8:37 pm

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.

soydepr
Posts: 155
Joined: Mon Mar 24, 2014 10:51 am

Re: Ip resolves to local host

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

Ernst
Posts: 1246
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Ip resolves to local host

Sun Aug 19, 2018 11:48 am

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.
The road to insanity is paved with static ip addresses

soydepr
Posts: 155
Joined: Mon Mar 24, 2014 10:51 am

Re: Ip resolves to local host

Sun Aug 19, 2018 1:38 pm

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.
Attachments
Screen Shot 2018-08-19 at 9.35.11 AM.png
Screen Shot 2018-08-19 at 9.35.11 AM.png (48.68 KiB) Viewed 638 times

User avatar
DougieLawson
Posts: 36322
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Ip resolves to local host

Sun Aug 19, 2018 1:43 pm

I've a feeling https://codex.wordpress.org/Changing_The_Site_URL is the answer the OP is trying to find.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

soydepr
Posts: 155
Joined: Mon Mar 24, 2014 10:51 am

Re: Ip resolves to local host

Sun Aug 19, 2018 2:03 pm

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

soydepr
Posts: 155
Joined: Mon Mar 24, 2014 10:51 am

Re: Ip resolves to local host

Sun Aug 19, 2018 2:36 pm

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
Attachments
Screen Shot 2018-08-19 at 10.23.05 AM.png
Screen Shot 2018-08-19 at 10.23.05 AM.png (25.2 KiB) Viewed 608 times

Return to “Troubleshooting”