How to Check IP Address of Subdomain - ip

I'm sending XML from a client's site to an external server. This external server admin needs to verify the IP from the sender. We have the script working fine when sending from the main site (domain.com), but I am not sure when we are sending from a subdomain of the main site (sub.domain.com, getting an error currently). Is there a way to check the IP of a subdomain so I can give the admin the right IP address?
Thanks.
UPDATE: I've used the firefox extension 'IP Addresses and Domain Information' and am comparing the info from both domain.com and sub.domain.com and both look pretty much identical.

You should be able to just use nslookup from a terminal
nslookup google.com
nslookup mail.google.com
From here it's trivial to write a script for this. Here is a simple ruby example:
nslookup.rb
#!/usr/bin/env ruby
domain = ARGV[0]
lookup = `nslookup #{domain}`.split("\n")
lines = lookup.select{ |line| line[/Address/] }[1..-1]
ips = lines.map{ |l| l.split('Address: ').last }
verb = ips.count > 1 ? 'are' : 'is'
puts "the IP addresses for #{domain} #{verb}:\n#{ips.join("\n")}"
Run from command line
ruby nslookup.rb api.stackoverflow.com
# or just
./nslookup.rb api.stackoverflow.com
should output something like
the IP addresses for stackoverflow.com are:
151.101.193.69
151.101.65.69
151.101.1.69
151.101.129.69

I was also search on this topic then i have found a web site that helps me to find my subdomains IP address http://www.hcidata.info/host2ip.htm

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).

How to access website using hostname instead of ip address?

I am working on a wordpress website and I'm unable to access my website using the host-name. [However, I'm able to access my website through the ip address. For example, when I enter 10.20.0.18, I'm directed to 10.20.0.18/wp-admin/plugins.php]
I am new to hosting and I was just able to update my hosts file and properly link the ip address to hostname by reading through some articles.
I also checked these links are correct using ping command.
For example, my hosts file looks something like this,
#Host file starts here
127.0.0.1 localhost
10.20.0.18 www.webserver.abc.com
66.155.40.202 api.wordpress.org
#End of host file
Now, when I try to access the website using hostname through my web browser, I get this error.
This site can’t be reached www.webserver.abc’s server IP address could not be found.
I am not sure where I am going wrong, or do I need to make some more changes in other files?

IIS 10 Site Bindings wildcard development machine

I have successfully setup IIS on my local development machine (dev branch - setup as localdev.me) but when I went to setup another branch (hotfix - setup as localhotfix.me) I am running into issues. The issues are due to the way the site is setup. The subdomain of the url is used to determine which Database to connect to. So going to host.localdev.me will connect to the host database. So in IIS I have the following settings for the bindings of the site.
Type Host Name Port IP Address
http localdev.me 80 *
http *.localdev.me 80 *
I can ping localdev.me with any subdomain and I get the loopback address as expected. When I then setup the hotfix branch (exactly the same as the dev but with the following bindings) I get name not resolved errors.
Type Host Name Port IP Address
http localhotfix.me 80 *
http *.localhotfix.me 80 *
Is there a reason the first setup would work and not the second? What is perhaps even stranger if I tell IIS to stop I can still ping subdomains on localdev.me and get the loopback address.
I could always get it working by manually specifying the host name in my windows hosts file but I would rather not do that as I would need to go in and edit the file every time we add a new subdomain.
EDIT: These are the specific errors I am getting.
ping localhotfix.me
Ping request could not find host localhotfix.me. Please check the name and try again.
EDIT2: I have a solution that works fairly well. It requires Acrylic DNS and installation of the Microsoft Loopback Adapter. I set the loopback adapter to a valid IP Address and set the DNS server to 127.0.0.1 then edit the AcrylicHosts file to contain entries for each domain with a wildcard. Once I did all of this I was able to ping localhotfix.me along with *.localhotfix.me. I believe the reason localdev.me worked is because it is a valid domain. The name would resolve at which point I believe IIS was able to take over. But thats really just an educated guess. But kindof makes sense as to why it worked for one and not the other.
The reason *.localdev.me works without a hosts file is because the public DNS for that domain resolves to 127.0.0.1 as long as it is not localdev.me or www.localdev.me. You can check this using nslookup *.localdev.me (replace the asterisk with anything except www) while your hosts file is empty. On the other hand, *.localhotfix.me is not registered in public DNS at all, which is why you'd need a hosts file entry for those.

Command to retrieve all informations from a website

is there a unix command to retrieve all informations possible from a website?
I mean info like: IP, IP geo location, (sub-)domains, alternative domain names, name server, and all other informations I'm thinking about.
I know about whois, but is there anything else?
Something that gives more informations?
Thanks
I don't know any command that can do all of that at once but a simple pipeline should work too.
ping www.website.com for IP
curl ipinfo.io/ip-adress for geo-location
nslookup -query=soa www.website.com for original DNS
Alternatively you can use the command dig to find the subdomains via the DNS:
dig domain.com the output in the authority section are the DNS servers which are used
dig #dns.server domain.com AFXR to retrieve the subdomains of domain.com

How to access site through IP address when website is on a shared host?

I want to edit my host file to forward a website to another IP, but that IP is on a shared host, so the IP doesn't take me to the domain I want. Is there a way around this?
i.e.
Website: http://somerandomservice.com/
Ping the site and go to: 67.225.235.59
But they're different sites.
Thanks!
Update: Tried nmap, but unable to find the correct port.
According with the HTTP/1.1 standard, the shared IP hosted site can be accessed by a GET request with the IP as URL and a header of the host.
Here there are two examples(wget and curl):
$ wget --header 'Host:somerandomservice.com' http://67.225.235.59
$ curl --header 'Host:somerandomservice.com' http://67.225.235.59
Resources:
https://en.wikipedia.org/wiki/Shared_web_hosting_service
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23
Include the port number with the IP address.
For example:
http://19.18.20.101:5566
where 5566 is the port number.
You can access you website using your IP address and your cPanel username with ~ symbols.
For Example:
http://serverip/~cpusername like as https://xxx.xxx.xx.xx/~mohidul
serverIPaddress/~cpanelusername will only work for cPanel. It will not work for Parallel's Panel.
As long as you have the website created on the shared, VPS or Dedicated, you should be able to always use the following in your host file, which is what your browser will use.
67.225.235.59 somerandomservice.com www.somerandomservice.com

Resources