1

I have four computers connected to a single switch - unconnected to the internet.

One of the computers (the large one in the picture) is more powerful than the others and is running Ubuntu, with three live Node.js web servers with different apps on different ports. The other computers are running Windows.

I want the other three computers to access the web servers by calling a URL, for example

  • files.bugsteins --> 192.168.0.5:3000
  • chat.bugsteins --> 192.168.0.5:3001
  • devices.bugsteins --> 192.168.0.5:3002

What is the best (priority to fastest set up time) way to accomplish this ?

Thus far I have tried Bind9 on the server machine and assigning static IPs and manual hardcoded DNS on the three client machines but it is not working and as I work on it, I figure I will post this question in case someone has a better way.

Network Architecture

CodyBugstein
  • 222
  • 1
  • 3
  • 11
  • What have you tried? What technologies do you think might be in play to get this working? – EEAA Jan 20 '17 at 04:24
  • Good point. I updated my question – CodyBugstein Jan 20 '17 at 04:42
  • Hear you can find a way to do this using nginx and local DNS or host file entries. https://www.digitalocean.com/community/questions/multiple-domains-on-different-ports-of-the-same-droplet – eranga Jan 20 '17 at 06:09

3 Answers3

2

What is the best (priority to fastest set up time) way to accomplish this?

Not BIND.

Edit the c:\windows\system32\drivers\etc\hosts file on each desktop and point those names to 192.168.0.5.

192.168.0.5 files.bugsteins 
192.168.0.5 chat.bugsteins
192.168.0.5 devices.bugsteins

Add a web listener on port 80 on the server, somehow with your Node.js setup, or a basic webserver install (Lighttpd, NginX, Apache, or heaps of others) serving a static page with a JavaScript in it which looks at the URL and redirects the page to the appropriate port.

Taking from https://stackoverflow.com/questions/18022636/redirection-based-on-url-javascript something like this (untested):

<html>
<head><title>Redirect page</title></head>
<body>
<script type="text/javascript">

if (window.location.href== "http://files.bugsteins") {
   window.location.href = 'http://files.bugsteins:3000'; 
}

if (window.location.href== "http://chat.bugsteins") {
   window.location.href = 'http://chat.bugsteins:3001'; 
}

if (window.location.href== "http://devices.bugsteins") {
   window.location.href = 'http://devices.bugsteins:3002'; 
}

</script>
</body>
</html>
TessellatingHeckler
  • 5,726
  • 3
  • 26
  • 44
  • 1
    I would prefer setting up a web server at port 80 on the web server, and then having it proxy the request to the Node.js servers. – Tero Kilkanen Jan 20 '17 at 13:25
  • Take a look at Apache's mod_proxy and the directives ProxyPass & ProxyPassReverse to redirect inbound http traffic to other ports. Combined with dnsmasq you have something that should work! – uSlackr Jan 20 '17 at 22:02
  • I think both of the comments go against `best (priority to fastest set up time)` in that configuring a web server proxy will take more time and effort than 'serving a static page'. – TessellatingHeckler Jan 21 '17 at 05:48
  • @TessellatingHeckler this worked great thanks a lot! – CodyBugstein Jan 22 '17 at 04:29
1

The fastest will be installing the dnsmasq package depending on your Linux distros(Arch/CentOS/RHEL/Ubuntu). Keep all the entries in /etc/hosts on your DNS server (which is using dnsmasq). Point all your workstations/linux hosts to here.

Also, make sure to set forwarders to outside internet DNS server for non-local requests.

For small environments say <100 machines, this is good enough and minimalistic DNS server.

  • I mentioned the server machine is running Ubuntu. – CodyBugstein Jan 22 '17 at 03:26
  • Can you explain what you mean regarding updating the /etc/hosts/ on my Ubuntu machine (which is the server)? Don't I want to do that on my client machines? – CodyBugstein Jan 22 '17 at 03:27
  • Sorry for the late reply. Doesn't really matter if it's CentOS/RHEL/ubuntu as long as it's dnsmasq software. That means your Ubuntu (DNS server) - the one and only DNS server will need to have all these configs below. You don't need to configure any complex zone files like BIND service. ubuntudnsserver001 (/etc/hosts): 192.168.1.1 ubuntupc001 192.168.1.2 ubuntupc002 192.168.1.3 ubuntupc003 ... – Linux Cli Aik Jan 25 '17 at 06:57
  • Also, you don't have to configure dnsmasq on your client machines. Just the Ubuntu machine which is your DNS server. All your workstations will point to your Ubuntu DNS server as normal through /etc/resolv.conf file. – Linux Cli Aik Jan 25 '17 at 07:05
-1

Normally this would be handled with an internal DNS server. If you do not have one running, you could just add entries to the local host file on each of the 3 client computers.

NOW-Admin
  • 72
  • 3