Distributed firewalls function by deploying security policies across multiple layers of the network. These policies are centrally managed but enforced at the local level. This is often achieved through a combination of software agents installed on endpoints and network appliances. By operating at the network, application, and endpoint levels, distributed firewalls can offer comprehensive protection against a range of threats, from unauthorized access to malware.