-1
$\begingroup$

When Encapsulating Security Payload (ESP) is used in the tunnel mode, a new IP header is computed and added. Why is this necessary? Thank you.

$\endgroup$

closed as off-topic by Maarten Bodewes, otus, e-sushi May 1 '17 at 13:01

  • This question does not appear to be about cryptography within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    $\begingroup$ Because you want to encrypt the actual IP header and it thus can't be used to get the packet to its destination? $\endgroup$ – SEJPM Apr 30 '17 at 9:34
  • 2
    $\begingroup$ I'm voting to close this question as off-topic because this isn't about cryptography. We've got a professional networking site for that. $\endgroup$ – Maarten Bodewes Apr 30 '17 at 14:18
1
$\begingroup$

Why is this necessary?

Actually, it's not necessary; if you don't want to add a new IP header, there's another perfectly good mode you can use ("transport mode").

If your question is "why would anyone use tunnel mode", the largest reason is security gateways.

Suppose that you are in an office that has a small network, and a VPN link to the corporate headquarters. Your PC in the office has been assigned address 10.1.2.3 (which is fine; your office network is isolated from the internet), and you want to talk to a server at headquarters, address 10.4.5.6. Your PC creates an IP packet with a header that lists it as from 10.1.2.3 and to 10.4.5.6. Your gateway has the responsibility of encrypting this packet, and sending the encrypted packet over the internet to the headquarter's gateway (which might have address 137.89.126.56). The destination IP address for this packet must be 137.89.126.56 (otherwise, the headquarter's gateway will never receive it), however it is also important that the decrypting gateway could deduce that the original packet was destined to 10.4.5.6. Just one IP header doesn't really work (because we have two different destination addresses, and for similar reasons, two different source addresses); the way that the IPsec designers decided to address this is to encrypt the original ("inner") IP header along with the rest of the packet, and add another ("outer") IP header (whose job is to get the encrypted packet to the one guy who is willing to decrypt it).

Also, you state that a new IP header is "computed"; in the IPsec implementations I've seen (and written), the outer IP header is mostly preformatted; a few things need to be tweaked (TL, TOS, IPv4 DF, ID fields), but it's cheaper than formatting it from scratch each time.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.