How to access the subdomain of an IP address in the browser?

FirefoxBrowserWebIpIp Address

Firefox Problem Overview


To get to the IP address of an example website, you just visit

subdomain.example.com

However, if I try to visit

subdomain.2.1.33.111 (example ip)

Firefox returns an error.
Why?

Firefox Solutions


Solution 1 - Firefox

All browsers will return an error for this. The reason is that subdomains are part of the DNS (Domain Name Service) system, where IP addresses are related to the underlying IP protocol.

The best way to think of this relationship is that domains (including subdomains) are human-readable labels which DNS then allows you to point to IP addresses. It would not be very catchy to have an IP address as your website on a TV ad, for example.

There is much more detail on DNS and IP addresses if you want to delve into more detail than this.

Solution 2 - Firefox

If the aim is to serve several application on server without an assigned domain. Best way is to use ports

2.1.33.111:8080

Solution 3 - Firefox

This isn't possible via firefox. However a work around is to edit your OS hosts file see: wikipedia.

Create or edit and add a line like:

192.168.1.100 subdomain.example.com

Remember to remove the line when you're done!

Solution 4 - Firefox

You can't mix a subdomain (DNS name) with an IP (no DNS name)

Try to use /etc/hosts file. For instance:

# IP  Hotsname    
2.1.33.111     subdomain.example.com

For Firefox It's ok but Chrome resolves names in a fancy way.

Solution 5 - Firefox

A hostname is a domain (or subdomain) name that has at least one associated IP address.

The associated IP address to a domain name might differ for subdomains.

You can get the associated IP address of a domain (or subdomain) with nslookup.

Try nslookup example.com vs. nslookup subdomain.example.com to see the difference.

If firefox (or other browsers) you can either enter the hostname (e.g. example.com or subdomain.example.com) or the IP address (e.g. 11.22.33.44).

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser3236661View Question on Stackoverflow
Solution 1 - FirefoxChris AlexanderView Answer on Stackoverflow
Solution 2 - FirefoxMKKView Answer on Stackoverflow
Solution 3 - Firefoxjms301View Answer on Stackoverflow
Solution 4 - Firefoxuser721730View Answer on Stackoverflow
Solution 5 - FirefoxwolfrevoView Answer on Stackoverflow