DDoS attacks can be prevented by using a combination of defensive strategies, such as monitoring traffic patterns, employing load balancers, and using DDoS mitigation services.