# CNAME on local Named to redirect FQDN to LAN IP ?

## loopx

Hi, 

I have a little problem with my new VDSL router : port-forwarding is no more working within my LAN ... it only works when coming from Internet.

So, actually, I'm no more able to use my FQDN from the inside : no port-forwarding when reaching my VDSL router, and so, no connection to my WebServer or NAS using FQDN.

To "fix" that problem, 2 solutions :

- update /etc/hosts on all client (... hum ...)

- update local Named to redirect my FQDN to an local IP

So, I must set Named to redirect my FQDN to a local IP => I can reach my NAS. And from the outside, I will use port-forwarding of the VDSL box.

My question is : how can I told Named to redirect a FQDN to a local IP ? In fact, it's simply like "/etc/hosts" file ... but, for now, Named don't care about "/etc/hosts" of my server. Can I told Named to use "hosts" from file ? If not, how can I set a kind of "CNAME" to an IP ?

I've already tried to configure a zone .. it works ... but can't access all other sub-domains, because no more DNS request is forwarded for the domaine, and so, it's not usable.

Any idea ?

The real problem is I want to access my music from NAS using only 1 URL (from LAN or Internet).

Thx

----------

## kimmie

net-dns/dnsmasq is designed for this sort of thing. Unless you particularly need to run named, you can just switch. 

You can also use dnsmasq as a dhcp server, but find it more convenient to turn off dhcp in dnsmasq and use the dhcp in my router. The router is configured to hand out the dnsmasq address, with a second DNS server address being that of my ISP. That way my laptop still functions when I take my LAN server down.

----------

## Mad Merlin

I concur that this is quite easy to do with dnsmasq, I currently do this. Basically, dnsmasq will serve hosts entries from /etc/hosts (unless you tell it not to), so you can use /etc/hosts on your DNS server to shadow the real DNS entries with LAN IPs for your LAN clients, otherwise, it will forward the request to upstream DNS servers.

The alternative is to enable NAT loopback on your router, then you can continue using the external IP from inside. Most routers have this option.

----------

