Advanced communication/networking technologies should be integrated in next-generation power systems (a.k.a. smart grids) to improve their resilience, efficiency, adaptability, and sustainability. Many believe that the smart grid communication infrastructure will emerge from the interconnection of a large number of small-scale networks organized into a hierarchical architecture covering larger geographic areas. In this article, first we carry out a thorough analysis of the key components of the smart grid communication architecture, discussing the different network topologies and communication technologies that could be employed. Special emphasis is given to the advanced metering infrastructure, which will be used to interconnect the smart meters deployed at customers' premises with data aggregators and control centers. The design of scalable, reliable, and efficient networking solutions for AMI systems is an important research problem because these networks are composed of thousands of resource-constrained embedded devices usually interconnected with communication technologies that can provide only low-bandwidth and unreliable links. The IPv6 Routing Protocol for Low Power and Lossy Networks was recently standardized by the IETF to specifically meet the requirements of typical AMI applications. In this article we present a thorough overview of the protocol, and we critically analyze its advantages and potential limits in AMI applications. We also conduct a performance evaluation of RPL using a Contiki-based prototype of the RPL standard and a network emulator. Our results indicate that although average performance may appear reasonable for AMI networks, a few RPL nodes may suffer from severe unreliability issues and experience high packet loss rates due to the selection of suboptimal paths with highly unreliable links.