While communication technologies are evolving rapidly, there is still the nontrivial matter of a communication systems being green. Although some energy-aware solutions have been proposed for the telecommunications sector, they are not designed with the ultimate goal of being environment-friendly. In this paper, we investigate the problem of achieving energy efficiency in IP networks by taking into account not only the energy consumption of the network but also the impact of various energy sources, e.g., renewable energies. We propose a new green networking approach in which we classify network nodes into clusters and select one header node in each cluster according to the generation cost and the carbon emission per unit of energy. We develop a routing scheme using IP routing only on header nodes and conducting packet forwarding using a carefully designed identifier on other nodes to achieve a greener communication system. We validate our solution with a variety of simulations using real-world renewable energy statistics, and the results show that our approach is superior to other existing solutions, particularly in terms of energy and cost efficiency.