Reach self hosted server from LAN

Hello, I had this problem for a while and finally I found how to fix it, so I will upload the solution here (Lo iba a poner en serverfault.com, así que lo hice en inglés, siempre se podría traducir…🙂.

I have a self hosted server with Apache2 pointed with the domain example.com. I have also some virtual servers http://www.example.com, cloud.examle.com, etc.

This server is in my LAN, and when I try to access to my server within the LAN throw http://www.examle.com y get my router’s configuration page. From outside the LAN http://www.example.com and cloud.examle.com works properly. From inside the LAN 192.168.1.33 (server internal IP) shows the default webpage (www.examle.com), but I can not get cloud.examle.com
I also have a LAN name server in 192.168.1.33 with bind9.

How to solve the problem and get my web server from inside of my LAN

This are my config files, I have 2 DNS zones, one with my LAN (home.lan) and another with my domain (example.com):

/etc/bind/named.conf.local

zone "home.lan" IN {
    type master;
    file "/etc/bind/zones/home.lan.db";
};
zone "example.com" IN {
    type master;
    file "/etc/bind/zones/examle.com.db";
};

/etc/bind/zones/home.lan.db

$ORIGIN .
$TTL 86400      ; 1 day
home.lan. IN SOA server.home.lan. hostmaster.home.lan. (
    2008080901 ; serial
    8H ; refresh
    4H ; retry
    4W ; expire
    1D ; minimum
)
home.lan. IN NS server.home.lan.

$ORIGIN home.lan.

localhost    IN A 127.0.0.1

router       IN A 192.168.1.1
server          IN A 192.168.1.33
mypc     IN A 192.168.1.132

/etc/bind/zones/examle.com.db

$ORIGIN .
$TTL 86400      ; 1 day
example.com. IN SOA www.example.com hostmaster.home.lan. (
    2008080902 ; serial
    8H ; refresh
    4H ; retry
    4W ; expire
    1D ; minimum
)

example.com. IN NS 192.168.1.33

$ORIGIN examle.com.

localhost    IN A 127.0.0.1

www         IN A 192.168.1.33
cloud       IN A 192.168.1.33

/etc/bind/named.conf.options

And, of course, all the names that we don’t know we have to ask them to openDNS

options {
        directory "/var/cache/bind";

         forwarders {
                208.67.222.222;
                208.67.220.220;
        };

        dnssec-validation auto;

        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { any; };
};

Etiquetas: , ,

One response to “Reach self hosted server from LAN”

  1. http://google.com says :

    I really consider this amazing blog , “Reach self hosted server
    from LAN FreeFri”, highly engaging and also it was indeed a fantastic read.
    Thanks a lot-Francisco

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

A %d blogueros les gusta esto: