I have a registered domain name (thisexample.net), which I forward to a dynamic URL at DynDns (bounce.dnsalias.net) as my internet access comes over cable and doesn't provide a static IP address. My router (openwrt) forwards port 80 to an apache server on the LAN.

This works for machines seeking the URL thisexample.net from outside the LAN, and for machines inside the LAN going to the server's LAN address (eg, 192.168.1.xxx). However, LAN machines going to the URL thisexample.net (or www.thisexample.net) bring up the router's admin page, as if they had been addressed

I want to experiment with the subdomains, such as beta.thisexample.net. As I understand it, one way to set them up is to use apache's VirtualHost directive with the address name -- but the LAN boxes won't be able to reach such subdomain pages as addressing the domain doesn't get them to the server in the first place.

Why aren't LAN boxes able to use the URL address?
How can I configure things so they can? Is this a poor approach to experimenting with subdomains in the first place?

  • In what way are you experimenting with sub-domains? – Daniel Lucas Jun 22 '09 at 21:42
  • I want to get enough control to create sites like beta.myexample.net, gamma.myexample.net, etc. and have each address serve a different site. – chernevik Jun 23 '09 at 1:22

Both external clients and your internal boxes are reaching the same, proper IP address that dyndns is giving them. The real problem is that your router is only performing "port forwarding" for 80 on the external-facing interface. Any connections through internal-facing interface just see openwrt's own page on non-forwarded port 80.

This is purely issue of iptables on openwrt (DNAT should be specified twice: with -i ethX and then with -i ethY).

If you want to work around the problem via DNS, use bind's feature called "view". But this is a clumsy solution.

  • Thank you. I don't know how to specify DNAT, but I can go to school on iptables, and probably should in any case. – chernevik Jun 23 '09 at 1:21

Create a manual record on your internally facing DNS server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.