Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

IP addresses don't support subdomains. If your goal is to serve several application on server without an assigned domain, the best way is to use ports:

2.1.33.111:8080

Some ports may already be in use or blocked for security reasons. If you need a list of some recommended ports, you could try using the same ones that Cloudflare supports.

HTTP:

  • 80
  • 8080
  • 8880
  • 2052
  • 2082
  • 2086
  • 2095

HTTPS:

  • 443
  • 2053
  • 2083
  • 2087
  • 2096
  • 8443

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!

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.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top