The demand to reduce energy consumption in wireless networks has become popular recently. In this paper, aimed at the problem that how to reduce energy consumption through on-off control in wireless networks without losing system performance significantly, we present our solution both in a single base station and the multi-base station scenario. Under the assumption that the network arrival and departure process are Markov, we first model and solve the problem of optimal on-off control in single base station scenario using dynamic integer programming (DIP) method, then we extend the optimal solution to multi-base station scenario and raise an effective heuristic method in two layer networks, the trade-off between QoS level and energy consumption has been given according to our analysis and simulation. Numerical results are provided to demonstrate that the proposed method offer significant gain in terms of the energy efficiency.