subdomain.xxx.xxx.xxx.xxx possible?

Hello

I'm not sure if what I'm trying to do is even possible.

Can I have a subdomain to a non-namebased ip address like this:

subdomain.74.125.224.243?

Since the apache docs don't have an example of this, I'm assuming it can not be done, but my DNS-fu is weak.

Im thinking that it is probably NOT possible, because the word sub-DOMAIN sort of infers the presence of a domain, but I've been Googling this all night and as you can imagine every search result regarding sub-domains relates to name-based virtual hosting - all 17 million of them.

Thanks

7 Replies

I think in practical terms the answer is no, though it might work in a controlled environment.

Technically something like name.#.#.#.# is valid in terms of a domain name (where each label can be letters, digits or a hyphen/dash), but there would be no way to resolve it in DNS. And unlike using an actual #.#.#.# address, it won't be recognized as an address (which is how #.#.#.# works in applications - they actually bypass DNS and just parse the string into an address).

I haven't tried it, but don't see why you couldn't configure Apache (or any web server) with a virtual host using such a name, and assuming the address lookup would work the client would just put the name in the Server: header like any other domain.

If you controlled all the clients you could add the appropriate name to the local hosts files, or you could point the client resolvers to a private DNS server to resolve the names, but it would only work in your controlled environment.

But if you're trying to support this for arbitrary users connecting to your service, I think it's probably a non-starter.

– David

This isn't for arbitrary access, but I'm trying to avoid a closed network.

Thanks

In a somewhat related question:

mydomain.com -> server1

mydomain.com:8080 -> server2 (different physical machine)

Would the above be accomplished by simply sending all requests to server1 and then using a vhost directive to forward traffic on port 8080 to server2's IP?

First of all, you would need to configure Apache to listen on both ports 80 and 8080. As for sending the traffic to server2, it could be done as a reverse proxy, redirecting clients with the alias or rewrite modules, or even setting up a firewall rule and avoiding Apache entirely.

But I have no idea which, if any, of these options you want without knowing what your goal is. What web services are you hosting on each machine? Why is it important for users to access them with certain names? For example, if you're running a blog and a forum on separate machines, probably the simplest and cleanest method is to point blog.example.com at one machine and forum.example.com at the other. But if we don't understand the objective, we can't really offer sensible solutions.

Thanks. The question was academic. I'm not looking for a solution to anything in particular.

Ah, carry on then. :) Note that the redirections will cause clients to connect directly to server2; the other methods will send all traffic to server1, which then forwards it to server2.

@linewb:

Hello

I'm not sure if what I'm trying to do is even possible.

Can I have a subdomain to a non-namebased ip address like this:

subdomain.74.125.224.243?

Thanks

Nope.

"74.125.224.243" Isn't a domain, so you can't have subdomains. It's just an IP address.

@kyhwana:

Nope.

"74.125.224.243" Isn't a domain, so you can't have subdomains. It's just an IP address.
I'd argue it depends on how an application interprets the string "74.125.224.243" (assuming you're starting with just that sequence of characters).

By domain name standards I believe it's legal as a domain name, and aside from it not existing globally, "243" could be a TLD in a private nameserver. IP addresses already show up in domain names (e.g., 243.224.125.74.in-addr.arpa for reverse lookups).

It's just tricky to get typical applications to treat it that way (since convention is first to try to parse a string as a literal address). Though as I noted in my earlier response, the moment you put an alphanumeric label as the first segment (e.g, the desired "sub-domain"), that check should fail, so applications would be passing the full string back into DNS.

– David

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct