I have server (ip:, openSUSE 12.2, Apache 2) behind router (ip:, 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:

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.


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.

| improve this answer | |
  • Yes, afraid.org allows add subdomains of subdomains. But they only give 5 A records (subdomains or subdomains of subdomains or ...) for free. They also offer wildcards for some money. But I thought that I could make subdomains by myself in several lines like I did in dnsmasq config and I only don't know how. – rominf Feb 3 '13 at 17:25
  • No you cannot do that. If you use a wildcard, all subdomains of your afraid.org subdomain will be resolved to your IP. Even inexistent one. Example, pinging to asdkj.x.afraid.org will resolv to your IP. That's a wildcard. Otherway you need subdomains. And these subdomains must exist in the public DNS to be accessed from internet (not your local dnsmasq). If you don't use a wildcard, as you said you only have 5 subdomains that you can point to an IP. – JorgeeFG Feb 3 '13 at 17:47
  • Other thing, that I never done, would be to have your own public DNS. So you register a .com domain and you add your DNS's IP (Normally you need 2), so you would need to have at least 2 public IP's. That case you would control your subdomains in internet, because when you try to go to www.yourdomain.com, it will go to your DNS ip to resolve it. And that DNS will point the user to the right direction, that would be that IP or another IP, depending on how you configure your servers. – JorgeeFG Feb 3 '13 at 17:53
  • Even inexistent one. It's okay. I can manage subdomains with Apache and redirect to site index if subdomain doesn't exist. So as I understand I can't simply make what I want in five minutes. But they provide NS records. If I set up DNS server (I have to RTFM, of course) can I make subdomains on the same server with the same ip? – rominf Feb 3 '13 at 18:20
  • I'm new to DNS too but I had some past experiencing. Not sure if I understood you, but you if you have a DNS you can have as many subdomains as you want. You specify the subdomains like you do in dnsmasq for local server. Your web server must have a public IP too. That way, this is more or less the events that will happen when someone requests asd.yourdomain.com: Request to registrar DNS IP for domain yourdomain.com - Ask DNS where to look for asd.yourdomain.com (Should be an IP) - DNS gives an IP, and the browser goes there - Your apache is listening for it and serves the page. – JorgeeFG Feb 3 '13 at 18:32

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.