Consider the case of blogspot.com the domain is the one blogspot.com only but suppose i register in it with xxx then i will have xxx.blogspot.com like wise here it won't be the subdomain (i can smell) , but its some thing different ... how to achieve this ?? in j2ee web application..
A:
- you need a DNS server that will resolve any subdomain as the adress of your server,
- you j2ee application can optain the hostname from the request header
UPDATE: here is a example of a BIND zone file:
$ttl 38400
mauriceperry.ch. IN SOA ks31441.kimsufi.com. maurice.mauriceperry.org. (
1237374933
10800
3600
604800
38400 )
mauriceperry.ch. IN NS ks31441.kimsufi.com.
mauriceperry.ch. IN NS ns.kimsufi.com.
* IN A 213.186.61.21
Here xxx.mauriceperry.ch will resolve to 213.186.61.21 whatever xxx is.
Maurice Perry
2010-04-15 09:42:36
i don't think that blogspot creates subdomain for each regustration..what say ?there should be some another tweak...
org.life.java
2010-04-15 09:44:08
well, if you are using BIND, you can use a wildcard * in an A record
Maurice Perry
2010-04-15 09:56:31
can you please explain it lite more ..
org.life.java
2010-04-15 09:57:25
alright, I have updated my post with an example.
Maurice Perry
2010-04-15 10:02:27
lemme configure this in my machine and will keep posting status here..
org.life.java
2010-04-15 10:13:13
btw what are these values...1237374933 10800 3600 604800 38400 ?will it remain same for my case?
org.life.java
2010-04-15 11:50:49
No, they should be adapted. I don't remember what they all are, but the first is a sort of version number that needs to be updated each time the zone file is updated, so that the other DNS servers know when a refresh is needed.
Maurice Perry
2010-04-15 11:56:56
ok..lemme move ahead...
org.life.java
2010-04-15 12:24:41
Refering this link:http://ulyssesonline.com/2007/11/07/how-to-setup-a-dns-server-in-ubuntu//etc/bind/named.conf.local# Our domain zonezone "mydomain.com" { type master; file "/etc/bind/zones/mydomain.com.db";};# For reverse DNSzone "200.1.192.in-addr.arpa" { type master; file "/etc/bind/zones/rev.200.1.192.in-addr.arpa";};
org.life.java
2010-04-15 14:38:14
/etc/bind/named.conf.optionsoptions { directory "/var/cache/bind"; // If there is a firewall between you and nameservers you want // to talk to, you may need to fix the firewall to allow multiple // ports to talk. See http://www.kb.cert.org/vuls/id/800113 // If your ISP provided one or more IP addresses for stable // nameservers, you probably want to use them as forwarders. // Uncomment the following block, and insert the addresses replacing // the all-0's placeholder. forwarders { 192.1.200.1 }; auth-nxdomain no; # conform to RFC1035 listen-on-v6 { any; };};
org.life.java
2010-04-15 14:39:39
/etc/bind/zones/mydomain.com.db$TTL 3D@ IN SOA ns.mydomain.com. admin.mydomain.com. ( 2007062001 28800 3600 604800 38400);mydomain.com. IN NS ns.mydomain.com.jigar IN A 192.168.0.29www IN CNAME jigargw IN A 192.168.0.29 TXT "Network Gateway"* IN A 192.1.200.29
org.life.java
2010-04-15 14:40:35
rev.0.168.192.in-addr.arpa$TTL 3D@ IN SOA ns.mydomain.com. admin.mydomain.com. ( 2007062001 28800 604800 604800 86400) IN NS ns.mydomain.com.29 IN PTR gw.mydomain.com.29 IN PTR jigar.mydomain.com.
org.life.java
2010-04-15 14:43:06
this is my configuration..sorry to flood it like this, but got stuck here..error i am getting.. Stopping domain name service... bind9 rndc: connect failed: 127.0.0.1#953: connection refused
org.life.java
2010-04-15 14:43:51
You should have more information about the error in /var/log/messages
Maurice Perry
2010-04-16 05:19:01
finally done..! :) thanks
org.life.java
2010-04-16 06:31:33
A:
Buy a domain name at you're favorite ISP.
Configure for this domain a domain wildcard for the A record in the DNS zonefile (usualy using some nice tool from you're ISP):
* IN A 74.125.77.191
Code a Java Servlet (or whatever you are using) as front controller. The front controller will dispatch you to what ever the subdomain needs to show.
String domain = request.getLocalName(); String subdomain = domain.substring(0, domain.indexOf('.')); goto(subdomain); // or what ever you need for the subdomain
Kdeveloper
2010-04-15 12:40:35
Thankx...can you help me what to do if i want to set up it in my local machine ?its linux..i have installed bind9i don't know the configuration ..
org.life.java
2010-04-15 13:22:22
Bind is not exactly an easy package to configure correctly. I would rather advice using dnsmasq. But why go through all the trouble if you can buy for $2 a domain name at godaddy.com that includes a free DNS server? If you just want to do a proof of concept, you can just edit the /etc/hosts file and add the needed (sub)domains. Although no wildcards are allowed in the hosts file, you can add as many domains as you like.
Kdeveloper
2010-04-15 17:28:47
One more question i have is suppose i buy a domain over internet, then how i can i achieve this configuration ?i have temporarily locally configured this DNS but what if i want each node in internet to resolve this pattern , how can this reflect all DNS ?
org.life.java
2010-04-20 04:34:20
The easies way is to use the DNS server of you’re ISP and configure the A record via their web interface.
Kdeveloper
2010-04-24 20:19:03