DNS, SubDomains & 1 IP

Okay, so I might be barking up the wrong tree or this might have been mentioned somewhere but not quite clear enough. So I have Server 2012 running SBS 2011 in Hyper-V and a Plex server and a Torrent server and a… you get the point. So the great thing about SBS is that you have exchange and the web portal for file sharing and remote access and OWA and so on and so forth.

The problem here is that I have only one IP or one external IP. Should DNS or something be able to handle subdomains?

Let me explain, I have remote.xxxxx.co.uk that points to my web portal its great and works fine. I would like plex.xxxx.co.uk to point to my plex server on a different IP address. Now I can do port forwarding and use plex.xxxxx.co.uk:32400/gui or whatever it is but that’s not the way to have a cake and eat it.

You can use IIS (or Apache if this is more your thing) as a reverse proxy.
This way you have one server instance running on port 80 and/or 443 running multiple virtual hosts with each their own domain/subdomain.
This way you can setup a host with domain remote.xxxxx.co.uk pointing to your web portal, a host with domain plex.xxxx.co.uk pointing to x.x.x.x:32400/gui, plexpy.xxxxx.co.uk pointing to localhost:8181 and so on.

This is what I use to access all my web services over https on their own subdomain.

I’ve tried the IIS revers proxy but with no luck, could you possible go into more detail?

To make sure the terminology isn’t causing confusion a DNS domain is the part after the first dot. The record name is the part before the first dot. The fully qualified domain name (FQDN) is the whole lot (strictly speaking it also needs a dot at the end). A sub-domain is a child domain of a parent e.g. ‘yahoo.co.uk’ is a subdomain of ‘co.uk’ and ‘co.uk’ is a subdomain of the top level domain ‘co’:
Domain: microsoft.com
Record name: www
FQDN: www.microsoft.com.

I don’t understand your thought around subdomains but it’s not the technology you’re looking for (a little Star Wars thrown in there as DNS isn’t a thrilling subject).

So you’ve got multiple internal hosts (all running in VMs):
plex.dom.co.uk – 192.168.0.10
torrent.dom.co.uk – 192.168.0.11
web.dom.co.uk – 192.168.0.12
exchange.dom.co.uk – 192.168.0.13
(I’ve made up hostnames and IP addresses of course).

For traffic from the Internet to make it to any of these VMs then the traffic needs to get to the external IP of your broadband router (sorry if this is all obvious stuff – you don’t give many clues on how familiar you are with it but I’ve got a hunch you may know all this already). For traffic to get to your broadband router there are three options:

  1. Have an Internet IP address for each. That would require you having four or more external IP addresses. This used to be common but isn’t a standard for home users. This would require use of NAT.
  2. Have one external IP address and use port forwarding to decide where the incoming traffic is sent. This would require use of PAT or port forwarding as its better known.
  3. Have one external IP address and use a reverse proxy. I don’t think IIS can do this other than extremely simplistic web site reverse proxying – I’m not great with IIS so I could be wrong. Microsoft’s software for this type of thing was IAS then TMG but both are discontinued. This is the most complicated of the three options.

I’m going to hope and assume that you’re ‘option 2’ (because it’s the most common and the easiest). When traffic arrives at your external IP address it will be addressed to a specific TCP port (e.g. unencrypted web traffic is addressed to port 80). Provided everything you want to access is on different TCP ports then you should be able to use port forwarding to send traffic to the internal IP address but configuring your broadband router (I don’t know for sure that your router will have this facility but it’s pretty standard even on ISP freebies):
• Traffic for TCP 32400 should be forwarded to 192.168.0.10 on port 32400 OR leave it using UPnP or NAT-PMP (see below).
• Traffic for TCP 80 should be forwarded to 192.168.0.12 on port 80 (for HTTP)
• Traffic for TCP 443 should be forwarded to 192.168.0.12 on port 443 (for HTTP)
• Traffic for torrents will need to be on a non-random port and forwarded in the same way. You’ll need to set your torrent client not to use a random port OR leave it using UPnP or NAT-PMP (see below).

(all addresses above a made up and correspond to the made up addresses at the beginning of this post)

Depending on what you’re doing with Exchange you may need to forward a variety of ports and get additional entries in public DNS for mailbox discovery. You may also need to change default ports to prevent conflicts with your web server.

UPnP and NAT-PMP allow a router, with this protocol enabled, for automatic NAT/PAT configuration by applications. Torrent clients and Plex can both use this to allow connectivity from the Internet, direct to a computer running a torrent client or Plex. I don’t like it as it’s reportedly insecure (but millions of other people use it so I’m not knocking how well it works).

You only need one DNS entry (other than autodiscover records for Exchange) which needs to point to your external IP address. You can then access everything by using specific ports e.g.
mychosenname.dom.co.uk:80
mychosenname.dom.co.uk:32400/web

That sounds like a lot but it really all boils down to setting up port forwarding on your router for each application you’d like to access direct from the Internet (or using UPnP or NAT-PMP to do this for the friendlier apps like Plex). Direct traffic for each port to the IP address of the VM running the corresponding app.

Hope this is useful (and that you kept reading this far)

Rob

Hi Rob, thanks for the interesting read.

That’s the thing, I’ve forwarded the ports on the router but at best i can put plex.domain.co.uk:32400/web how do i explain that to the wife and the kids and everyone else. I need(or want) plex.domain.co.uk to go direct to plex.domain.co.uk:32400/web not only that but i need it to go through standard port 80 via sbs to plexserver

so this is what I have in short

192.168.0.1 (ROUTER)
192.168.0.2 (HYPER-V) external ports 33890 (as my sbs is the RD gateway I’ve added a registry key to allow rdp to port 33890 instead of the usual 3389)
192.168.0.3 (SBS-2011) external ports 25, 80, 443, 1723, 3389
192.168.0.4 (PLEXSERVER) external ports 32400
192.168.0.5 (TORRENTSERVER(Not really relevant here))

I need plex.domain.co.uk to go to domain.co.uk that’s pointing at 192.168.0.3 then go to 192.168.0.4:32400\web somehow

I’m a consultant so know a fair amount but clearly not enough on this particular subject.

I’d suggest using the Plex app instead of a web browser. Its great on iOS, Android and Windows.

If you have a reason to use a web browser you can login to plex.tv and click launch and it will take care of all the redirection for you and will let HTTPS work correctly which isn’t likely if you browse direct to your VM.

I don’t know if that’s what you’re after as I can’t make head of tail of this (maybe it’s written in consultant :-):
“I need plex.domain.co.uk to go to domain.co.uk that’s pointing at 192.168.0.3 then go to 192.168.0.4:32400\web somehow”

If you meant that after hitting your external IP address you’d like something to redirect to a specific internal URL then IIS can do basic URL redirection (I doubt it would work for steaming content which is what you ultimately want) but plex.tv will do the same thing but better (IMHO).

Rob

yeah i know its best to use the aps but some places like my work block almost every port going so i need to bypass it internally so you can get it externally so plex.domain.co.uk points to my public ip on port 443 or 80 in a nutshell and then gets redirected internally to ip 192.168.0.4 i had this working before and it frustrates me that I cant get it to work again (virtualize they said, it will be fun they said)

@marlo086 said:
Okay, so I might be barking up the wrong tree or this might have been mentioned somewhere but not quite clear enough. So I have Server 2012 running SBS 2011 in Hyper-V and a Plex server and a Torrent server and a… you get the point. So the great thing about SBS is that you have exchange and the web portal for file sharing and remote access and OWA and so on and so forth.

The problem here is that I have only one IP or one external IP. Should DNS or something be able to handle subdomains?

Let me explain, I have remote.xxxxx.co.uk that points to my web portal its great and works fine. I would like plex.xxxx.co.uk to point to my plex server on a different IP address. Now I can do port forwarding and use plex.xxxxx.co.uk:32400/gui or whatever it is but that’s not the way to have a cake and eat it.

I do exactly this but via apache reverse proxy.

please, share !!

@marlo086 said:
please, share !!

I wrote an article on my website for it.

http://www.michons.us/2015/12/08/plex-web-interface-redirection/