Can't access server from LAN

Discussion in 'General' started by sirmee2001, Sep 7, 2006.

  1. sirmee2001

    sirmee2001 New Member

    I don't know if this is the right place for my question but here goes. I have a D-Link DSL-504 router and some ports forwarded to my server in the LAN (connected to the router, same subnet). Everything works from outside my network. That is, I can access my sites through the Internet, send and receive emails, etc. My problem is that I can not access my server from computers in my LAN. I have the same set up in a different place using a different router and everything works fine. So I think the router in this case is the problem. Does anyone have a solution to this problem or does it mean I have to get myself a new router? Any help, links, etc. will be greatly appreciated.
     
  2. edge

    edge Active Member Moderator

    Last edited: Sep 7, 2006
  3. shec0002

    shec0002 New Member

    It is all about name lookup

    It all comes down to name resolution. For the sake of the discussion let’s say you have a desktop computer called mydesktop with the ip address 192.168.1.3, and a server called myserver with the ipaddress 192.168.1.2. The ip address of your router is probably 192.168.1.1, lets just assume that for now.

    When you start up your "mydesktop" computer it gets the ip address 192.168.1.3 from the router, it also gets information about netmask, and name lookup. The router will most likely tell mydesktop to ask it, 192.168.1.1 for names. So whey you type in http://www.howtoforge.com into your web browser your operating system looks up in its configurations that name lookups are done by 192.168.1.1, so it makes a name lookup request to 192.168.1.1, at which point the router which is 192.168.1.1 takes the request and sends a new request on to the name server it got when it connected to the network. The router sends back the ip address 85.10.207.148 which it gets from your isp's name server.

    The problem comes in when the lookup goes to your isp. Your isp's name server doesn't know what hosts are running inside your network, and you probably don't want them to, and they don't want to know. When you try http://myserver in your web browser your os sends a name lookup request to your router, the router in turn sends the request on to your isp's name server and it says that it has never heard of the guy. When your router gets the message back, it just to make it easy on your network, it replaces the "no host by that name" message with its own ip address, so your web browser makes a connection to your router.

    The easiest, and least graceful way to fix this problem is to use ip addresses and avoid name lookups. If you put in http://192.168.1.2 into your web browser you will connect to the web server on the host myserver.

    If you only have one webserver running, and you don’t mind it being seen by the outside world you could configure your router to expose 192.168.1.2, and turn allow internal forwarding through the routher. This can cause problems if you want to administer your router, and you don’t do it right. Look at the documentation of your router to find out more.

    Another would be to put myserver in your hosts file like edge mentioned.

    A last and possible most beautiful option would be to configure your own DNS server inside your network. This would do the work your router is doing of forwarding your requests, but with the added bonus of being able to add your own hosts to the list.
     
  4. sirmee2001

    sirmee2001 New Member

    Thanks for your replies. Is it possible for me to use Bind 9 which is installed on my server running ISPConfig to make use of the local DNS server solution that shec0002 suggested? If possible could you give me some information on how to do that or a link to a location where I can educate myself a little more on this issue.
     
  5. shec0002

    shec0002 New Member

    Start in the manual

    I would start in the manual.
    On my fedora box it is in /usr/share/doc/bind-9.3.1/arm/Bv9ARM.html
     
  6. falko

    falko Super Moderator ISPConfig Developer

    Just create DNS records (with your local IP addresses) for your domains in ISPConfig's DNS Manager, and make your client PCs use that system as the primary nameserver.
     
  7. shec0002

    shec0002 New Member

    change resolve order

    add the ip address of the host running bind at the top of /etc/resolv.conf. On the windows machines make it the first name server in the name server settings in the network settings.
     
  8. sirmee2001

    sirmee2001 New Member

    Thanks once again for your replies. I will try to implement your solutions and see how things work out.
     

Share This Page