How IPsec works
First, a network device receives a data packet and determines whether to transmit it through an IPsec tunnel. The LAN device then initiates negotiation with the peer network device. During this phase, the communicating parties use a key exchange protocol.
After IPsec security mapping between the parties, they can transmit data through the IPsec tunnel. An authentication header is used to securely transmit and authenticate the data. The encryption mechanism ensures the confidentiality of the data and prevents the data from being intercepted during transmission.
Next, the encryption algorithm for the IP packet is used, the sender and receiver use the same authentication algorithm and authentication key. If they are the same, the receiver decrypts the packet.
What ports are used in IPsec
In IPsec, the IKE protocol uses UDP port 500 to initiate and respond to negotiations. Also, in an IPsec NAT traversal scenario, packets on UDP port 4500 must be allowed. The AH and ESP services must be enabled to ensure a successful IPsec tunnel setup.