QUESTION :
When I go to 192.168.2.2 in firefox on a linux computer on my LAN it resolves to the URL of the webserver that is running on that IP address. Lets call it https://example.com. But when my internet is down for the whole LAN (ie if I unplug my modem) and I go to 192.168.2.2 then it still resolves https://example.com, it tries to access https://example.com and fails because the internet is down. How can I access the IP address directly without having firefox resolve to the URL?
I thought maybe there was an entry in /etc/hosts
, but there isn’t for that IP – it just shows the local name of the machine that is not the URL and is not even vaguely close to the URL (eg bob
).
I also checked the hostname on 192.168.2.2 but its name is also the local name of the machine that is not the URL and is not even vaguely close to the URL (eg bob
).
Also I tried a traceroute to 192.168.2.2 but it just goes straight to the IP in 1 hop on the lan.
So how can I find what is causing 192.168.2.2 to resolve to https://example.com and kill it?
Update
Firefox is set to clear the cache when closed so this cannot be it.
nscd
is not installed on this machine:
$ nscd
The program 'nscd' is currently not installed. To run 'nscd' please ask your administrator to install the package 'nscd'
But dnsmasq
is installed, but killing it has no effect on the issue I am having.
ANSWER :
IPs typically don’t resolve to hostnames, it usually goes the opposite direction.
I would bet that the web application you are accessing at http://192.168.2.2
is actually redirecting you to https://example.com
.
Try running this command from your command line:
curl -I http://192.168.2.2
I expect you will get an HTTP 301
redirect to https://example.com
, something like this:
HTTP/1.1 301 Moved Permanently
Location: https://example.com/