This concept has emerged to describe the way ICT can transform microgrids' operation and entails several applications like intelligent monitoring and control of distributed energy resources, automation, data networking and other tasks that can improve the efficiency of the system [12; 13; 14]. To realize these capabilities, distributed control systems have been proposed. Particularly, recent studies [15; 13; 16; 17] suggest Peer-to-Peer (P2P) overlay communication networks as a solution with great potential to provide high performance to decentralized microgrid control systems, including scalability, fault-tolerance and robustness. Peer-to-Peer (P2P) overlay networks are virtual networks where the connectivity among the nodes is carried out through a physical IP network, while the network topology is created in a virtual network, called overlay, which is built on top of the physical one. Overlays increase flexibility, extensibility and adaptive reconfiguration. This implies that each node communicates with each other to create self-organizing overlay structures on top of the subjacent physical networks [18; 19]. Distributed Hash Tables (DHTs) allow developing structured P2P systems due to their routing capabilities. DHTs support exact-match queries [20; 21; 22] i.e., given a query for a specific key, DHTs can efficiently locate the node which holds the keyword key. However, DHTs do not implement any mechanism for retrieval data application [1] and locality is not considered [21]. These facts are a serious drawback to implement communications in microgrids by means of DHTs due to, on the one hand, the fact a data retrieval mechanism is essential to obtain and/or update data in this application [23]. On the other hand, locality allows creating a group of peers for a particular task [21]. Peers with close interests can create \"shortcuts\" and use them to locate content. The underlying physical network path could be significantly different from the path on the overlay network if locality in DHTs is not considered. Therefore, the lookup latency in the overlay network could be quite higher and decrease the performance of the application layer [21; 24; 25]. The control and the management of microgrids demand high efficiency in terms of network quality requirements (high bandwidth and low latency). However, peer-to-peer networks have been mainly developed for other applications such as file sharing and processor cycle sharing, whose network performance requirements are less of a priority [26]. The main contributions of this work are, first, the proposal of a fully functional decentralized communication architecture, which includes a new clustering algorithm based in DHTs that adds locality capabilities for creating node clusters with close interests. The second contribution of the paper is the proposal of a specific application protocol, running on Transmission Control Protocol/ Internet Protocol (TCP/IP), for microgrids monitoring and control. The paper is organized as follows: Section 2 gives some background on P2P networks and their application to microgrids. In addition, a specific DHT protocol (Chord) is described. Section 3 presents the network requirements in order to deploy efficient communication architectures for smart  
Figure 1: Simplified scheme of a microgrid. microgrids. In Sections 4 and 5 the proposed solutions are described. Concretely, the lookup algorithm is presented in Section 4, while Section 5 gives details about the communication architectures and a specific protocol for microgrids. Section 6 reflects the results of the tests that have been carried out to evaluate the performance of the proposed solutions. Finally, Section 7 provides some conclusions.