Reach self hosted server from LAN
- by Freefri
I have a self hosted server with Apache2 pointed with the domain example.com. I have also some virtual servers www.example.com, cloud.examle.com, etc.
This server is in my LAN, and when I try to acces to my server within the lan throw www.examle.com y get my router's configuration page. From outside the LAN 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.
I set up my gateway 192.168.1.1 with my LAN-NS as primary NS
I solve this problem creating a new dns zone in the NS.
This are my config files:
;ZONE-1
$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.
; Set the address for localhost.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
;ZONE-2
$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
My DNS and my names are working properly now
My question are:
What do you think about my solution?
Can I change the A zone with CNAME to server.home.lan (this is the domain in the LAN to the server)?
How can I set a default IP for all my whatever.example.com?