0

I have two Debian Jessie servers. One is my home server that I use for personal/hobby stuff, the other is my development server for work.

For arguments sake lets say...

Personal: 1.1.1.1
Development: 1.1.1.2

I have one domain. Let's say it's example.com. Currently, Personal calls a Dynamic DNS service every few seconds to tell the DDNS service (Which is hosting my domain.) what my external IP address is.

From there, my router is set up to port-forward all requests at ports 21, 22, 80, and 3000 to Personal.

I don't want to buy an external IP from my ISP, let alone request two for each server. Also, I would like this setup to be semi-portable. I.E. no matter what router it's connected to as long as the port is open, it works.

From a little bit of research I think the answer to my question is a reverse-proxy. I've installed Pound to Personal. However, I have been unable to find a tutorial which is close enough to my situation to reverse-engineer, and have found the amount of example Pound configs and general documentation lacking.

This is what I would like to have happen...

1) Router port-forwards on ports 21, 22, 80, and 3000 to Personal on those same ports.
2) Pound on Personal sends all requests from my domain to Development unless the subdomain was "personal".

In affect this would mean...

personal.example.com -> Personal (1.1.1.1)
*.mydomain.com -> Development (1.1.1.2)

Can this be accomplished using Pound? If so, what would I put in Pound's config file?

4
  • why update DDNS every few seconds? you should only update when the external IP changes, e.g. via a script run from a dhcp client hook (e.g. in /etc/dhcp/dhclient-enter-hooks.d/) or an adsl pppoe hook (e.g. in /etc/ppp/ip-up.d/`) or similar depending on your connection type.
    – cas
    Feb 28 '16 at 4:31
  • I'm pretty new to this kind of thing. I mispoke, it's actually every minute. I'm using Dynu and DDclient, which is the recommended setup. Care to provide a link explaining what you just said?
    – Allenph
    Feb 28 '16 at 4:32
  • i don't use DDNS or either of the two programs you mention. i just know that running a script when a connection is established is a feature that has existed for many years for ppp and dhcp client software (and is used for all sorts of tasks, e.g. running a command to flush the mail queue. or update DDNS, or open a tunnel to somewhere, etc etc etc when your gateway box connects to the internet). If the software you are using does not document how to make use of this, then you should probably look for alternative software that does.
    – cas
    Feb 28 '16 at 4:42
  • MY solution at home is in my Debian router to have a VPN, and then I work as if I was at home. Feb 28 '16 at 7:55
0

Domain name dispatch is only available to protocols that include domain names, i.e. HTTP and (mostly) HTTPS. Other protocols (such as FTP, SSH) don't include any domain name, but rather the client software uses DNS to resolve a given domain name into an IP address, and then connects using it.

So, the short answer would be "no".

Rather you could set up your routing to present other, different external ports for routing the least used host. E.g, using ports 20021, 20022, 20080 and 23000

Or, you could go for a tunneling solution (VPN) to allow portable hosts to access the local network.

EDIT: I got confused by the port list you gave. If you're only interested in HTTP and HTTPS (typically ports 80 and 431), then the answer should be "yes", and my ramblings should be ignored.

7
  • I was the one that was mistaken. I want to redirect all HTTP, HTTPS, SSH, and FTP requests.
    – Allenph
    Feb 28 '16 at 4:28
  • right. if it's for your own client machines only, then VPN is good, eg openvpn; set up your home server to be a VPN server that your client machines attach to. Feb 28 '16 at 4:34
  • I'll look into that. Have any quick-start concept guides that I can dig into, or should I start looking around?
    – Allenph
    Feb 28 '16 at 4:35
  • 1
    HTTP is easy, just proxy to the correct server based on the domain in the HTTP request. HTTPS is possible but difficult and unreliable because the request is encrypted so you can't easily get at the Host: header. The others can not be done without a dedicated IP address routed on the internet - although ssh could be done if you run it on a different port on your dev machine and use port-forwarding on your router. ftp - don't even bother, use sftp instead.
    – cas
    Feb 28 '16 at 4:36
  • 1
    I think ssh offers a tunneling option, but it requires "root" user to establish it. Essentially you can use ssh from your client to your routed port 22 server, and with that set up a local-to-remote network through two tun devices (one local, one remote). Thereafter it's a matter of setting up routing through those, and of course a special /etc/hosts on the client. Feb 28 '16 at 4:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.