Web-server – How to get the local network machines to call local web server by URL

Architecturebinddns-hostinglocal-area-networkweb-server

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

Best Answer

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>
Related Topic