5

I want to have a domain name accessible within LAN only. for example, I have hosted an online quiz on machine with ip 192.168.1.140 and want to access it with myquiz.com within LAN.

How can I do it?

NOTE: I use windows 7 for server and smart phones will be clients.

1
  • Which Operating System are you using? Commented Aug 22, 2014 at 7:18

2 Answers 2

4

If you don't have too many machines you can edit hosts file on each one to point myquiz.com to 192.168.1.140, and skip setting up a DNS server which might be a painful experience and open you up to nasty hacker attacks.

If your DNS gets hacked to point, say facebook.com to a hacker IP address you are going to run into serious problems. Imagine what happens if your online banking DNS record gets tampered with....

Computers will first look in the hosts file, then primary and secondary DNS.

Copy C:\Windows\System32\drivers\etc\hosts to your desktop, then open it with notepad. Add the following to the end of it:

192.168.1.140 myquiz.com 192.168.1.140 www.myquiz.com 

Copy it back to C:\Windows\System32\drivers\etc\hosts and replace the old one.

If you use a real domain name in your hosts file, you will not be able to access it on the Internet becouse your computer will resolve it to local IP address.

Here is some troubleshooting if you run into problems.

----EDIT-----

In that case you have a few options.

  1. If your devices are rooted/jailbroken you can still edit hosts file on them, here are the locations
  2. You can setup a DNS server, which can be a very bad thing if you don't know what you are doing
  3. Access it via IP address
  4. Make an app that will access it by IP address and make it transparent to end user (not as scary as it sounds)

If you want to whip up a quick app go sign up for Adobe Phone Gap. You get one private project for free.

Using notepad copy the following code to a file named index.html

<!DOCTYPE html> <html> <head> <meta http-equiv="refresh" content="0; url=http://192.168.1.140/" /> </head> <body> Redirecting to quizz... </body> </html> 

Then just upload your index.html to Phonegap buld service and it makes the installers for Android, iOS, Blackberry, WindowsPhone so you get a native experience.

If you want to do more than just a basic app, say you want splash screen, custom icon... check Phonegap Docs

iOS might be a bit more complicated because I think it requires you to sign the app, but I never developed an iOS app so I can't help much. I think you can add it to home screen as an app from Safari, chek here.

I might be getting in too deep, but those are your options, and I think making a Phonegap app is several magnitudes less complicated than setting up a DNS server and making it secure.

3
  • Actually, mobile devices (android, ios etc.) will be accessing the server. Commented Aug 22, 2014 at 9:29
  • I understood your solutions, but I am little confused about setting up DNS server. Do I need to setup DNS server on server machine? If yes then how router will came to know that address? If no then do I need to setup DNS server on router? Commented Aug 22, 2014 at 10:11
  • You can set it up on any computer, and you need to set it's address in your DHCP server so other machines can use it. Still setting up a DNS server for a single host is a bit of an overkill and not easy to setup, it's not a matter of click next 6 times and you are done. You have to set it up, secure it and make it resolve trough another public DNS so you don't lose your internet connection. It may be cheaper to register a domain name for 10$, as your DNS must run 24/7. If you are still not convinced go check out Ubuntu docs for setting up DNS servers. Commented Aug 22, 2014 at 11:01
1

Try to install dnsmasq DNS server. It's easier to work with as compared to other DNS services.

1
  • Any chance of some information on how to do this and what needs to be done to make all the computers recognise this DNS server? Commented Aug 22, 2014 at 8:38

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.