In a ubiquitous computing environment, identifying the locations of users, sensors, and actuators is indispensable to provide proper services to the users. Location can be configured either manually or automatically. However, manual configuration is not proper for large systems because of its difficulty and error-prone nature. For large-scaled systems, smart nodes need automatic location configuration mechanism. Although there are various such methods using GPS or lateration technique, they do not effectively satisfy critical requirements. This paper proposes a fully distributed method through which smart nodes automatically identify and configure their locations by communicating with neighboring nodes arranged in a grid pattern. A short-range IR communication device is attached at each of four edges of a smart node to make communication paths in all four directions. All smart nodes in the grid could locate themselves by activating these devices. This novel approach could help to configure an autonomous sensor/actuator network in its initialization and relocation processes.