IPSec provides a framework for securing communications over IP networks by authenticating and encrypting IP packets. It includes protocols for authentication (Authentication Header or AH) and encryption (Encapsulating Security Payload or ESP). Key management protocols like Oakley and ISAKMP are used to establish security associations (SA) to protect communications between two endpoints. IPSec can operate in either transport mode to secure communications between applications, or tunnel mode to secure entire IP packets between network devices like VPN gateways.