Faced with the scalability and reliability challenge, the DNS is increasingly operated by geographically dispersed data centers. Energy management across those distributed diverse data centers is critical to reduce revenue loss for DNS operators. This paper addresses the DNS server allocating problem aiming at optimizing revenue loss in terms of delay costs and energy costs. An analytical model is proposed taking network delay, query processing delay, energy costs, and server selections into consideration. The optimal solution is obtained analytically given static parameters or using an iteration method given dynamic parameters. The effectiveness of energy-aware DNS server allocating and the feasibility of the proposed iteration method are validated through simulations.