Backwater valves

A backwater valve is a device installed in a drain line, intended to resist flow returning toward the building from the system downstream.

They are frequently discussed after a backup. Whether one is appropriate, permitted, and correctly positioned for a given property is a site-specific and local question — and the single most important thing to understand is that a valve protects only what is upstream of where it sits.