Subdomains for server behind NAT
I have server (ip: 192.168.1.2, openSUSE 12.2, Apache 2) behind router (ip: 192.168.1.1, TomatoUSB Toastman Build). I'm using FreeDNS (afraid.org) and I assigned subdomain (say x.afraid.org) to router, which has static external ip. After 443 port forwarding my sites work well, but I want to have several subdomains: hg.x.afraid.org, trac.x.afraid.org, owncloud.x.afraid.org, … assigned to the same server. Apache using those subdomains to host mercurial server, Trac, OwnCloud, … by the help of virtualhosts. I've added lines to router's dnsmasq config:
local-ttl=1
address=/.x.afraid.org/192.168.1.2
address=/.x.afraid.org/[server ipv6 address based on MAC]
Now subdomains work from lan. How can I make them work from Internet?
PS I'm using Hurricane Electric IPv6 Tunnel Broker and I have static external ipv6. So it would be better if subdomains work with both: ipv4 and ipv6. But ipv4 is more important because some client computers have no support ipv6.
Solution 1:
Sorry I can not add comments, so I put it here.
Does your Free DNS Server allow you to wildcard subdomains of your subdomains? Or add subdomains of subdomains?
That way you could edit it's A record
to point to your IP.
I did that some time ago, but I have CPanel on a cheap Hosting.
What I did for example was, register Mydomain.com, added to the CPanel, edited DNS Record for subdomain.mydomain.com (In CPanel) and instead of IP I put the free dns address (Don't remember which one I used).
So It was dynamic without having static IP address.
subdomain.domain.com resolved to asd.freedns.org (example) which resolved to my dynamic IP.