What do firewalls do?
At an abstract level, you can think of a firewall as a filter, or an intermediary between your device and the Internet (you could also think of it as a traffic officer). What a firewall does very generally is decide whether or not certain information from the internet should be allowed to enter your device, and then respectively grants or prohibits entrance to that information.
How does a firewall work - a basic model.
When information "knocks" on a device's firewall, the firewall "questions" it to determine if it belongs to any of the following categories:
- "traffic sent in response to a request of the computer (solicited traffic)" (1) or
- "unsolicited traffic that has been specified as allowed (excepted traffic)". (1)
References:
(1) https://technet.microsoft.com/en-us/network/bb545423.aspx
(2) https://www.microsoft.com/en-us/safety/pc-security/firewalls-whatis.aspx
(3) https://www.paloaltonetworks.com/documentation/glossary/what-is-a-firewall
Image References:
(a)https://www.microsoft.com/en-us/safety/pc-security/firewalls-whatis.aspx