Securing wireless mesh networks (WMNs) is a crucial issue due to its intrinsic characteristics. Several endangered features might emerge due to the exposure of the networks to a diversity of medium access control (MAC) layers such as distributed denial of service (DDoS) attacks, false reply attacks, and other identity attacks. Against these attacks, the determination of existing techniques is insufficient to ensure the complete security solutions to protect the backbone network at multiple levels. As a result, effective, scalable, and integrated security solutions for WMNs are required. In WMNs, protecting legitimate gateway nodes and internal mesh routers against malicious attacks at the MAC layer remains a difficult problem. Our proposed trust-based security mechanism includes distributed authentication and deauthentication algorithms that validates backbone mesh routers as well as gateway nodes. Particularly, this proposed model targets DDoS attacks in the network. The proposed DDoS attack prevention mechanism (DAPM) uses distributed authentication and deauthentication algorithms to build trusted group heads for managing secure data communication in the network. Our research and practical results show that the proposed mechanism decreases the severity of malicious nodes and strengthens the security compared to existing centralized schemes such as digital signature authentication (DSA-Mesh, MENSA, Mobisec, and AHKM). The experimental solutions show the significance of the proposed work with 10% to 12% of better performance than the existing techniques.