Underwater acoustic sensor networks (UASNs) are important technical means to explore the ocean realm. Clustering is a crucial strategy which determines the performance and the lifetime of UASNs significantly. As a technological innovation, software defined networking (SDN) separates the data plane from the control plane to build a programmable network infrastructure. This paper presents a clustering mechanism based on SDN. Firstly, we introduce the architecture of software-defined UASN named SD-UASN. Secondly, we investigate hardware models of the underwater node and the surface controller. Thirdly, we define the communication procedure of SD-UASN, and implement the clustering mechanism. Finally, we perform simulations to verify the effectiveness of the proposed mechanism. The results reveal that a tradeoff of multiple constraints is achieved, and the performance of the clustering mechanism can be enhanced greatly. This work provides essential theoretical and technical support for software-defined UASNs.INDEX TERMS Underwater acoustic sensor networks (UASNs), clustering algorithm, software defined networking (SDN), software-defined UASN (SD-UASN), OpenFlow.