If dealing with DOS/DDoS attacks on a web server, use Cloudflare's free mitigation service.
If you're wondering how to protect yourself against DOS/DDoS attacks on a home network, get a router that blocks IP addresses from known botnets or IP addresses that have incoming heavy traffic.