IP address from nslookup sometimes doesn't work, e.g. with wikipedia - networking

As I understand it, nslookup [domain_name] will give you the IP address of a domain name. When I run nslookup wikipedia.org, I get
Server: 138.23.146.213
Address: 138.23.146.213#53
Non-authoritative answer:
Name: wikipedia.org
Address: 198.35.26.96
So if I enter 198.35.26.96 in my web browser, I should reach wikipedia.org. This works for some websites, like google.com and facebook.com, and mozilla.org. But it gets an error for other websites, like wikipedia.org, craiglist.org, and wordpress.org.
Does anybody know why?

An IP address identifies a server, not a website. There might be more than one websites hosted on the same server.
When you enter a domain name (eg. wikipedia.org) in your browser's address bar, your browser first resolves the domain name to get an IP address (that is 198.35.26.96). Then it constructs an HTTP request having a parameter named Host with a value wikipedia.org and sends it to the address 198.35.26.96.
The server receives the response, reads the Host parameter and knows which website the user is looking for. So the browser essentially needs both IP address of the server and domain name of the website to open it.
In some web servers a "default website" might be defined, that is if the Host parameter is absent or its value is an IP address then the server will serve the default website to the user. This was the case with google.com and facebook.com. If a default website has not been set (eg. in wikipedia.org), the server will simply reply with an error saying the domain was not found.

Related

Can't access some websites using their IP address

I have windows 10.
To get the IP address of some website I type ping somewebsite.com in cmd.
For example if I say ping google.com, cmd shows Pinging google.com [216.58.206.206] with 32 bytes of data: and some lines after that. If I type that IP provided (216.58.206.206), that gets me to Google.
But some websites aren't like this. For example for website codeforces.com I get 213.248.110.126, but this doesn't get me to the website, instead shows some error 404 Not Found .
Why it doesn't work and what is the best method to get IP addresses of websites in Windows 10?
Thanks.
Some websites cannot be accessed by IP only.
Think for example, a public (free or paid) web hosting, with shared IP. If you doesn't provide a domain name (FQDN), then the server doesn't know what page needs to be served.
Think also on some "public" services, like Azure DevOps. They provide you a FQDN over a microsoft domain, but probably each DevOps repository doesn't have their own IP. If you only provides the IP, then the service doesn't know what page are you requesting.
Also, if you enter to an HTTPS page, the certificate are securing the domain name, not IP address. If you try to enter with IP only, your navigator tells you the page are not secure (Try it with Google for example).

IIS Website IP Change

So my IIS7 server was hosting an ASP.Net web site with domain xxx-xxx.com with IP yyy.yyy.yyy.yyy.
Few days ago, I changed my ISP, which in result, changed my IP address to zzz.zzz.zzz.zzz.
Obviously the web site is down at the moment.
ping xxx-xxx.com
Results into:
Pinging xxx-xxx.com [yyy.yyy.yyy.yyy] with 32 bytes of data:
Request timed out.
Reply from yyy.yyy.yyy.yyy: Destination host unreachable.
Request timed out.
Reply from yyy.yyy.yyy.yyy: Destination host unreachable.
Ping statistics for yyy.yyy.yyy.yyy:
Packets: Sent = 4, Received = 2, Lost = 2 (50% loss)
As seen above, domain name xxx-xxx.com is still assigned to my old IP address yyy.yyy.yyy.yyy xxx-xxx.com.
According to my friend, and excuse me my ignorance and lacking experience, there's a really simple step I must take in IIS7 in order to get the web site back online, however, I'm not entirely sure how. I tried editing bindings and setting IP address, however that does not work, neither did netsh iplisten add work.
Furthermore, correct me if I'm wrong, but do I need to go to the place domain name was bought from and change assigned IP address?
Here's the command
netsh http add iplisten ipaddress=xxx.xxx.xxx.xxx
It is necessary to restart IIS7 for the change to take affect.

Error due to difference between localhost and local IP address

I have visited to this link and got to know about the differences between localhost and localIP address.
I have got problem saying Access is denied while accessing my own asp.net api hosted
in my local IIS server with the following url
http://172.18.12.166/FinalApi/api/movie.
It works finely if I use following url to access the api
http://localhost/FinalApi/api/movie
In the console of browser the request can be visualized as
This means the request is completed with no error. But this returns no data if I use localIP address in case of localhost.
But this works finely while requesting from other computers on the same network.
Look for host file at the following location on your system:
C:\WINDOWS\system32\drivers\etc
in that change the mapping of localhost (by default it would be 127.0.0.1). Change it to map to your IP. Then set up the you website in IIS server as per IP address.
Hope this helps.

HTTP request fails

I am trying to make an HTTP request from a micro-controller , the request is successful when I make it to google.com usign its IP (173.194.33.104) , while it fails when I use my server ip
when I put the ip address in the browser it show me a message like this
"Great Success ! Apache is working on your cPanel® and WHM™ Server" and some more info about apache server , I get my ip from the terminal (ping www.xxxxxx.com)
also if I put my ip with the user name in the browser I see my pages in my server (xx.xx.xx.xx/~aymanj/)
I want to make the HTTP request direct to my pages in the server
how can I do that ?
Lets assume you are using a browser (like IE, FireFox or Chrome) and that we aren't talking about using network functions from the Arduino. When you put an URL or some IP address in the browser's address control, and then hit enter - the browser parses that string to determine an address. Then based on your network settings, attempts to make a network connection to that address (typically over port 80). One it connects, the next step in the HTTP protococl is to request a single page from that connection. That page is everything after the address. If there is no page after the address specified, then its just the default "/" or default page. Each web server (Apache, IIS, etc) has options to set up different defaults. Typically that's something like index.html or default.aspx located in the root directory of whereever the web server lives. Extending that, a web server can map other directories to other paths. In your case, someone mapped a directory "/~aymanj" to your username. In that directory, there is probably a file something like "index.html". And when you go to that address without a directory or path, you are requesting the webserver root. Appparently no one has set a default page for it. Hope this helps you get started.

IIS Subdomain Host Headers Not Working

Using IIS 7, I have an existing website, example.com, and I have added another website to which I'd like the URL, sub.example.com to point. I've set up the host headers for this, but it does not work. Trying to ping the subdomain URL give the message "Ping request could not find host sub.example.com. Please check the name and try again."
Should a DNS setting perhaps be set?
The subdomain must be set in the DNS or it will not resolve to an IP address. Just having it defined in IIS is not enough. The client computer must be able to translate the name into a meaningful server address.

Resources