cancel
Showing results for 
Search instead for 
Did you mean: 

How could I do this domain name routing to PC's in my home network?

AdrianPH
Grafter
Posts: 27
Registered: ‎31-05-2014

How could I do this domain name routing to PC's in my home network?

I am learning how to do things and use several small low power computers rather than one decent computer for playing with, my desk top PC is a separate machine I tend not to play with.

I have managed to run up a vehicle tracking system on an old machine and now for the sake of it I am trying to run phpb on another.

So for example I use one of the redirect services to redirect http://vehicle.adrian.net ( not real ) back to my home WAN IP. I then forward port 80 requests to a small server within my home network. That is fine it works OK.

Now I also want to have http://phpbb.adrian.net (again not real) to my home WAN IP and forward that to a different machine to serve that. I can not use port forwarding as they will both use the same port 80, or 443 if https.

It seems my home router a Technicolor TG582 can only do port forwarding (game and application sharing it calls it?) so is there a way once it has been passed to a machine on my network to decide which internet requests are meant for it and which should be forwarded to another machine?  The last restriction I have is that the machines are single network port units so I do not have ETH0 and ETH1. If there a low cost router that could solve this issue so that everything port 80/443 is passed to an internal router and then on to the correct server based on if it comes in for http://vehicle.adrian.net, or http://phpbb.adrian.net.

Am I over complicating it for myself. I know that if I had a good machine with good resources I could probably run Apache2 and have several virtual hosts, but I use low power thin clients to play with at present.

Thanks

Adrian

 

Moderator's note by Dick (Strat): Post released from Spam Filter.

9 REPLIES 9
Jon
Plusnet Staff
Plusnet Staff
Posts: 107
Thanks: 20
Fixes: 3
Registered: ‎07-04-2007

Re: How could I do this domain name routing to PC's in my home network?

Hi @AdrianPH 

It sounds like Nginx Reverse Proxy may do what you want?

 

https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/

 

Never really used it myself, but it seems this may achieve what you are aiming to do.


Thanks Smiley


If this post resolved your issue please click the 'This fixed my problem' button
 Jon Smith
 Plusnet Infrastructure Operations Professional
AdrianPH
Grafter
Posts: 27
Registered: ‎31-05-2014

Re: How could I do this domain name routing to PC's in my home network?

Hello Jon, thanks for the answer, I will have a look at the documents.  I will admit many of the terms I come across confuse me, but that is why I am playing with computers to over come this., If I can run it on one of the two PC's I will have a look.

Thanks again.

 

Adrian

7up
Community Veteran
Posts: 15,767
Thanks: 1,539
Fixes: 17
Registered: ‎01-08-2007

Re: How could I do this domain name routing to PC's in my home network?

Apache has a reverse proxy pass directive that you can use. I used this with an old UPS moons ago - it had its own embedded webserver and i wanted to access it via my main web server so did this:

 

ProxyPass /ups/ http://127.0.0.1:4679/
ProxyPassReverse /ups/ http://127.0.0.1:4679

 

Can't remember the difference between them lol but the UPS battery snuffed it and being skint and out of work i binned it. I should have kept it and made it into a 12v car adapter... silly so and so that i am..

I need a new signature... i'm bored of the old one!
AdrianPH
Grafter
Posts: 27
Registered: ‎31-05-2014

Re: How could I do this domain name routing to PC's in my home network?

Thanks for the response.

 

I will freely admit I am getting lost in the stuff, but to an extent that is why I am doing it as it is a way of learning.  I am initially on with building up another server, buy building I mean installing software in yet another low end 2nd hand pc, but at least it is dual core and 64 bit so I hope at the end I will have one pc to serve several different pages using virtual hosts.  I have to follow instructions to get it to work and then hope to read up on the why's and wherefore later, being in a position to learn by changing small items at a time. 

Like most of us I have used computers for years, been using Linux for since Red Hat 6.  But have never got down to anything more then if you do this that will happen.

What I am meaning to say is that when someone quotes a lot of phrases to me there may be some vague idea in the mind but I really do not understand it and want to learn more.

I have the gear working in a basic fashion at the moment.  And this was done with help from  an ISP.  I will step through it as it also helps me understand it better.

 

My ISP provided me with a new DNS entry :-  home.xxxxx.com this points to wards my home WAN IP.  I then have an entry forum.xxxxx.com which is URL redirected to home.xxxxx.com:8000 This because DNS entries can not have a port number.

There is also a flag set for cloaking, so that the url stays the same throughout, i.e. it does not change to home.xxxxx.com

so the URL for forum.xx.. comes to my IP on port 80000 and the router forwards to a different PC as required.

 

There is a down side in that it will only work for http:// because ssl or https:// needs to verify against a particular domain and this as it is URL forwarded (I think) ssl certification will not work.

 

So I am up and running enough for me to play at present, but not in a perfect way.

 

Thanks for your comments.

 

Adrian

7up
Community Veteran
Posts: 15,767
Thanks: 1,539
Fixes: 17
Registered: ‎01-08-2007

Re: How could I do this domain name routing to PC's in my home network?


@AdrianPH wrote:

I am initially on with building up another server, buy building I mean installing software in yet another low end 2nd hand pc,


 

Doesn't really matter what the hardware is these days, if you're not using a monitor connected to it or programs with heavy graphic requirements the CPU will have more resources to dedicate to your other non intense tasks such as apache web server.

 

@AdrianPH wrote:

I hope at the end I will have one pc to serve several different pages using virtual hosts. 

 

That's where things become complicated. Very complicated.

You see when using virtual hosts, Apache will expect to see the domain in the request headers. For example if you type in home.mywebsite.com then your browser will send that as text in a collection of lines of text called request headers - the key line being  Host: home.mywebsite.com

Now that's all well and good from the outside world - you've got your ISP to sort out your dns for that domain and forum.mywebsite.com. That's great and as long as you have those DNS entries on a dns name server out there somewhere, it'll work dandy. The trouble is when you lose your internet connection or you want to setup other sites internally and don't have anymore dns entries for them - some hosts will allow you just 5 subdomains for example and if you want 7 odd internal websites then you're stuffed. As also mentioned, if your internet connection drops for whatever reason your DNS lookups to that EXTERNAL name server will fail - and suddenly despite being hosted on a machine right inside your own home, you can't access diddly sqwat. Trust me, i've been through all this myself.

So Apache needs a hostname in the request for any virtual host in use. To even send that request there, your browser has to lookup the hostname for an IP address to connect to and make that request sending the hostname to that webserver.

So you then need a dns name server running locally on your network. Your plusnet supplied router will have one but it only acts as a client itself - querying other name servers out there. So to work around that, you need your own name server which you can set your own records on. If on linux you can use bind and let it run as a daemon / process. If on windows it gets a little more commercial and it needs to run as a system service.

However... once you've got that done, there is another gotcha. You've then got to reconfigure all the machines on your network to use that name server if you want them to access your internal vhosts - phones, laptops, tablets... what happens if your mate comes round and you want him to have a look at your new awesome creation? - he won't see it unless he's a techy minded person and configures his DNS ip manually.

And so that's where DHCP comes into play. Yes, that also comes bundled on your plusnet supplied router however it's a very basic offering and certainly won't let you specify the name server IP you want to broadcasted to new clients (that's how windows knows how to connect to websites when on a dynamic network IP - the router in it's DHCP reply sends not only an IP address for the machine but also the IP of the DNS name servers to use too). So (yeah you're seeing a pattern here now right?) you also need to run a custom DHCP server too.

It's more complex sounding that it really is but the basics are you need a DNS server and a DHCP server that can distribute the IP for the DNS server. The most complex part is actually finding something to run on windows - cheap or free.

Once you have those two running, vhosts are not a problem. On the outside world you can have your DNS entries for stuff you want the outside world to be able to access (or you can literally use a 192.168.*.* address) and on the inside you can have your own entries too which will work even if your connection gets lost to the internet.

What i would say is that if your plusnet router goes wrong all is lost anyway - any DHCP / DNS traffic will not be routed as it should be (unless you have a software router in place like Nat32). Nat32 is a software router and from memory, it also works as a DHCP server but i'm not so sure about DNS... but if it does it might well be worth giving that a go. The only problem with it is that it needs to be installed and can't be used as a portable app on a usb drive - mind you with that said, apache and php can't anymore either as they're now dependent on other MS updates. Older versions will still run from a usb drive.

I need a new signature... i'm bored of the old one!
AdrianPH
Grafter
Posts: 27
Registered: ‎31-05-2014

Re: How could I do this domain name routing to PC's in my home network?


@@7u wrote:
Doesn't really matter what the hardware is these days, if you're not using a monitor connected to it or programs with heavy graphic requirements the CPU will have more resources to dedicate to your other non intense tasks such as apache web server.

Ah, unfortunately for me I have been using some old HP thin client 32 bit devices i586 yes, but rather underpowered.  For a vehicle/phone tracking system for home and only 5 units it does fine, but asking it to do a more can mean large jumps in system loading, probably a measure of the flash drives used in it as well.  But they are very quiet (fan less) and probably around 15 Watts of power consumption as opposed to a few hundred Watts. Small size etc.. I like to repurpose.

 

I will not post the rest of your message, but will provide a bit more information and ask the odd thing I am unsure of.

I am using Linux ubuntu LTS server versions but with the thin clients restricted to version 16 which was the last with 32 bit support.

I am pulling a HP Elite ultra small desktop into use with a small ish (by today's standards ) SSD SATA drive, dual core  3GHz processor etc. This will be running ubuntu 18.04 LTS.  So will be a big step up from the thin clients.

Now the tracking system DNS entry points directly to my home IP which is a fixed IP.  I can get the phpbb DNS entry to point directly to my home IP as well, and as I have now just point both port 80 and 443 to one internal IP.

 

So doing that, can I ask what could be a basic question, I am assuming that any browser request for either site would be pointed to my IP which will be resolved by the router to one internal computer and the headers would resolve which web site apache is to return.  Is that correct?  The internal server is on the routers DHCP but set to retain a static IP so I know it is.


At present I can enter in my browser, (home network), the domain name for the tracking system it goes to the router/gateway looks for the DNS entry on the internet, and is pointed back to my IP and back into the internal network, I do not have to specify from my pc the internal server address.  Again can I ask if my thinking is correct?

 

Adrian

7up
Community Veteran
Posts: 15,767
Thanks: 1,539
Fixes: 17
Registered: ‎01-08-2007

Re: How could I do this domain name routing to PC's in my home network?


@AdrianPH wrote:

@@7u wrote:
Doesn't really matter what the hardware is these days, if you're not using a monitor connected to it or programs with heavy graphic requirements the CPU will have more resources to dedicate to your other non intense tasks such as apache web server.

Ah, unfortunately for me I have been using some old HP thin client 32 bit devices i586 yes, but rather underpowered.  For a vehicle/phone tracking system for home and only 5 units it does fine, but asking it to do a more can mean large jumps in system loading, probably a measure of the flash drives used in it as well.  But they are very quiet (fan less) and probably around 15 Watts of power consumption as opposed to a few hundred Watts. Small size etc.. I like to repurpose.


Nothing wrong with that. I've got two mini itx boards, probably about the same power wise which i'm intending to build into a mini windows ICS (Internet Connection Sharing) host / router / web server and another as a fanless desktop. Both are actually more powerful than the single core machine i'm using now lol. It's only the lack of cash that is stopping me completing them at present. Both are dual cores with hyperthreading so effectively 4 cpu cores - the machine i use most days has just one lol. I do have another more powerful HP workstation with two quad core 3GHz proccys (8 cores in total) and 16GB DDR2 ram but i don't really like the noise of it so rarely use it. Ultimately for cost and lack of noise the raspberry pi wins hands down but i only have one of the original single core versions and i'm not a huge fan of *nix.

Truth be told, most mini-itx / thin clients are used in call centres to allow staff to access "the system" via a web browser. As long as the boards can handle that then they're good in most companies eyes. I did run one of my mini itx boards a while back for several hours (before hte PSU gave up lol) and it was a proper work horse compared to my single core machine.

 

@AdrianPH wrote:

So doing that, can I ask what could be a basic question, I am assuming that any browser request for either site would be pointed to my IP which will be resolved by the router to one internal computer and the headers would resolve which web site apache is to return.  Is that correct?  The internal server is on the routers DHCP but set to retain a static IP so I know it is.

Yeah basically that's right. Your router can't handle more than one IP so port forwarding is the real deal in your scenario. The router has it's port forwarded to the appropriate machine on your network and it will send traffic on that port to that machine. If you have a webserver like apache running then it will listen for incoming TCP packets and then read the host line from the headers and then server the content for that virtual host.

@AdrianPH wrote:

At present I can enter in my browser, (home network), the domain name for the tracking system it goes to the router/gateway looks for the DNS entry on the internet, and is pointed back to my IP and back into the internal network, I do not have to specify from my pc the internal server address.  Again can I ask if my thinking is correct?

That's correct - ish. I suspect that once your DNS lookup is complete and your PC browser sends out the http request to the returned IP address (yours in this case) your router probably intercepts that and forwards it to the machine on your local network. I could be wrong, plusnets network might actually get the request and then forward it back to you instead.

I need a new signature... i'm bored of the old one!
VileReynard
Hero
Posts: 12,613
Thanks: 630
Fixes: 20
Registered: ‎01-09-2007

Re: How could I do this domain name routing to PC's in my home network?

All this DNS stuff is beyond me - but

I configure my router to always setup the same IP address to given MAC addresses.

Then each machine has the same copy of /etc/hosts to map all hostnames to the correct IP addresses (which don't change).

Have you considered running a DNS caching application (dnsmasq) - its very small and fast.

"In The Beginning Was The Word, And The Word Was Aardvark."

AdrianPH
Grafter
Posts: 27
Registered: ‎31-05-2014

Re: How could I do this domain name routing to PC's in my home network?

I had a late night last night, or should I say early morning getting my system done.  I now have running the HP Elite 8000 series USDT computer up and running, the model was released in 2009 so it is doing well.

Running, Apache, PHP, MySQL and Python software with things like fail2ban  intrusion detection, a firewall and as many network restrictions as I can understand.

There are now two subdomains pointing at my home IP and the relevant ports 80, 443 and a couple more, are being port forwarded to the HP, serving two sites via use of virtual hosting. each site has it's own SSL certificate and as such the small project!  is now complete and running.  It has been an interesting challenge to say the least.  There are lots of things I do not understand, but for now I need to learn more about using the installed software as a BBS system with no one else using it but me.

Thanks all for the comments and assistance.

top - 19:39:11 up 5 days,  5:27,  1 user,  load average: 0.17, 0.05, 0.01

Adrian