ubuntu - Set up a website on my internal network and access it with a domain name instead of IP

07
2014-07
  • Rotunduh

    I have a small local network, with the following devices: a Belkin n150 router (older generation), a Dell laptop running Ubuntu 14.04 LTS (GNU-Linux 3.13.0-24-generic x86_64) as my server, and another HP laptop to test access.

    My IP addresses look like this:

    • router: 192.168.2.1
    • server: 192.168.2.3
    • laptop: 192.168.2.2

    I have successfully setup LAMP and have one small page (/var/www/html/index.html) with one picture.

    I can access this from my HP laptop by entering 192.168.2.3 into Firefox or Chrome.

    I attempted to setup DNS using BIND9, following this tutorial. I followed the tutorial verbatim and then spent time looking at other videos and forums as well, but after several hours of trying, it still isn't working.

    How do you redirect a domain name (ie. http://mynet.home) to access the website on a local server (192.168.2.3)?

  • Answers
  • TKEyi60

    I was curious too and found this over on stackexchange:

    http://stackoverflow.com/questions/17652373/how-to-change-the-url-from-localhost-to-something-else-on-a-local-system-usin

    Goes through Win/Mac/Linux and with a good step by step.

  • AFH

    I have a home network not unlike yours, though my HTTP and FTP servers are on Windows.

    It seems that you have got the HTTP server working, since you can access it within your intranet, so there are now three things to do:-

    • In your router settings, set port forwarding so that accesses to port 80 (http) from the internet are mapped through to your HTTP server machine (192.168.2.3) - you should make this a fixed address within your intranet, and not simply use DHCP without tying the subnet address to the machine's MAC address.
    • Either buy a fixed IP address from your ISP, or open an account with a dynamic DNS server and install their daemon on a machine in your intranet, preferably the HTTP server itself, though sometimes the router itself can do this for you - this will give your router a quasi-fixed internet address along the lines of http://youraccount.dynamicIPserver.org.
    • Through your domain registrar, set http://mynet.home to be forwarded either to your fixed IP or to http://youraccount.dynamicIPserver.org.

    Notes:-

    • You can use an internet proxy to test that your web-site is now publicly available.
    • If your router's internet address does change, it may be a couple of minutes before the dynamic IP server registers the fact, and your site will be off-air for that time.
    • There are a number of free and subscription dynamic IP servers available.

    Finally, I hope it goes without saying that your HTTP server must have up-to-date firewall and antivirus protection, because you have now opened up a huge vulnerability.


  • Related Question

    linux - Can't resolve domain names in Ubuntu with a static IP
  • Tom

    Running Ubuntu 9.04 fully patched on a custom machine. My typical setup is to assign static IP's to all my machines in the network (simplifies things with the other hardware). This morning, my machine was doing fine and I was able to get out and about just fine, Didn't make any configuration changes then. Tonight, after I got home from work, I can't resolve domain names on my box, but I can get directly to IP addresses. When I switch from using a static IP to DHCP, domain names resolve again and I can get out everywhere. Does anyone know what would have changed to stop resolving domains, and how I can fix it so I can use static again? Thanks.


  • Related Answers
  • user7963

    System > Preferences > Network Connections > Edit > IPx4 Settings > DNS Servers. Whatever is placed there, it does not work, maybe because your ISP started blocking external DNS traffic. Try to put there addresses of the OpenDNS nameservers, that is "208.67.222.222, 208.67.220.220" without the quotes.

    Does it help?

    Another option is that the avahi daemon stopped working

  • Mahmoud Hossam

    it seems to be a DNS problem,try OpenDNS

  • nik

    When you say "all my machines in the network",
    it seems you are referring to a local network at your home.
    If that is correct interpretation, using static-IP addresses in this network
    that resolve on hostname (any a common domain) require setting up the "/etc/hosts" file.

  • Dave Rook

    Try using the Google-dns server.

    IP's are 8.8.4.4 and 8.8.8.8, these work for me with arch Linux.