Explain stateful inspection.
Stateful Inspection, often known as dynamic packet filtering, is a firewall mechanism that monitors the status of active network connections. It records all activities from the time a connection is established until it is terminated. It uses information about active connections to allow or restrict traffic based on state, port, and protocol.