External web host with GApps

Hello all!!!
i was just getting lot of queries regarding setup of GApps with external web host. So basically using GApps for email hosting and using a separate web host for Web hosting.

Now we can have this kind of setup in two ways:

  1. using DNS hosting of web host
  2. using external DNS hosts

regarding differences in both i had given here
1st way is quite easy, it just need you to put Google’s mx records at web hosting control panel
But you will need #2 in case of following things:

  • web host doesn’t allow using custom mx
  • you want to create cname records and web host is not giving option to do so
  • you can put only one mx record but still you want all emails on time with full redundancy
  • you also want to create advanced records like SPF, SRV etc

So here’s the info on #2
here i am giving some DNS related steps and tricks to do that.

Step 1 – choose DNS Host

Now here you may choose your registrar’s dns hosting (if available) or else you can go with an external free dns host (remember free DNS hosts are highly reliable)
you may go with:

Incase you need something with gurantee, you can try out Googleing for “paid external dns”

Step 2- create GApps records

Now here start creating GApps records….as

  1. mx recordshttp://www.google.com/support/a/bin/answer.py?hl=en&answer=33352
  2. cname record for verification and custom url’shttp://www.google.com/support/a/bin/answer.py?hl=en&answer=47283
  3. Optional – SRV records – These are to enable usage of GTalk for GAPps account from outside of Google network. Here’s more info. – http://anuragbhatia.com/2008/09/googles-srv-records/
  4. Optional – SRF records – These are to protect your domain from being used by spammers.
    in case you want to use ONLY GApps for sending mail on behalf of your domain, just create this “txt record” at dns hosting for root (domain.com) zone –
    v=spf1 include:aspmx.googlemail.com ~all
    and incase you plan to use servers others then (but including) Google’s then use this wizard to generate custom SPF for your domain.

Step 3 – Configuring Web Hosting

to configure web hosting, you need to point root zone (i.e domain.com) and also subzones to web hosting server’s ip using “A record
Now here exists two possibilities:

  • your web host gave you web hosting server’s ip (sweet host!) 🙂
  • your web host gave you only nameservers and not any hosting server’s ip.

in 1st case ignore next section and scroll down and further instructions.
here’s what to do in 2nd case to get ip of hosting server.
Here’s the idea is just to query nameservers given by web host for “A records” of your domain.
proceed as:

  • use any dns lookup tool, for simplicity i am using zoneedit’s nslookup tool
  • put your own domain in domain field
  • select record as “A record” for querying
  • use nameservers to query of your web host.

here’s a preview

(click on image to enlarge)
you can also use dig command if you are on Linux, use it as
dig your-domain.com@ns1.your-web-host-server.com a
Thus you will notice output as
[anurag@root ~]$ dig harisri.in@ns1.anuragbhatia.com a
; <<>> DiG 9.2.4 <<>> harisri.in@ns1.anuragbhatia.com a
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 398
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;harisri.in@ns1.anuragbhatia.com. IN A
harisri.in@ns1.anuragbhatia.com. 60 IN A
;; Query time: 253 msec
;; WHEN: Mon Sep 29 16:23:41 2008
;; MSG SIZE rcvd: 65
[anurag@root ~]$
Now after getting ip of web hosting server just create the following records:

  1. A record for domain.com pointing to that ip
  2. A record for *.domain.com pointing to that ip

This will enable web hosting on domain.com as well as all subdomains (including www.domain.com)

Step 4 – Changing nameservers of domain

Now just change the nameservers of your domain. Point your domain to nameservers of the dns host you are using.
And done!!!

12 replies on “External web host with GApps”

    1. hi
      that command is used in Linux shell…try there….and remember you must have Bind installed.
      if you are on windows, just use following commands in dos
      set type=a
      and you will get your ip from it.

  1. Could you provide an example when you say
    1. A record for domain.com pointing to that ip
    2. A record for *.domain.com pointing to that ip
    say my A record is
    Would the sub domain be 65.49.3.* ?

  2. Hello Paul
    >say my A record is
    Would the sub domain be 65.49.3.* ?
    It means that you should create two A records…one for
    domain.com pointing to
    (this will make your site to work when someone will visit http://domain.com)
    and next you create
    *.domain.com pointing to
    (this will make http://.domain.com to work)
    Hope that will help you out. Good luck!

  3. Hello Anurag,
    Thanks for the quick reply. I am a little new to this and would like to get it right the first time.
    In the network solutions control panel it does not allow you to enter a *.domain.com just an IP address, so would I enter the same IP ( on the next line or would I enter which is the IP address of (phoenix.azc.com). My website also does not have any sub domains.
    Do hosting companies change the IP address of your site on a regular basis?
    Thanks appreciate the response.

  4. Hello Anurag,
    I have hosted website on godaddy and domain from another service provider and email googleapps. email works before hosting as same domain service provider.
    Now Email’s are not working. So kindly guide me to solve this problem.

  5. hello anurag….
    small question… my hosting is a free account on awardspace… my domain is registered at go daddy… and im using googleapps for mail..
    i read ur blog last yr and did all the configs and it worked properly.. now thx to my bank delaying in giving my new credit card my domain expired so i had to purchase it newly and all my settings had gone for a six.. now ive got to set it all up… ive done the google apps set up.. but cant get the web host to work..
    that is i got the Arecord IP of my domain as hosted on ns1.awardspace.com and put it as an A record in godaddy… but my website doesnt show up… it shows an awardspace page showing a 404 error (page nt found)… the last time i did the settings i did it by reading this post of yours so im wondering what is wrong now as it doesnt work now.. any help??

  6. hello there again..
    thanks for the help but its working.. the problem wasnt with n e of the settings.. apparently there had been some kind of maintenance work being done and i didnt read the email abt it so what ever the changes i did in total DNS wasnt being updated temprorily.. it worked later on…
    thanks again..

Leave a comment

%d bloggers like this: