> For the complete documentation index, see [llms.txt](https://linkmeup.gitbook.io/sdsm/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://linkmeup.gitbook.io/sdsm/7.-vpn/3.-gre-over-ipsec.md).

# GRE over IPSec

У начинающих тут часто случается конфуз (*он и у автора случился*): GRE over IPSec или IPSec over GRE. В чём разница, где применяются. Нельзя на этом не остановиться.\
Обычный режим, который мы рассматриваем тут и который применяется в подавляющем большинстве случаев, – это GRE over IPSec, то есть данные GRE инкапсулируются заголовками ESP или AH

![](http://img-fotki.yandex.ru/get/4136/83739833.24/0_ac120_38239cd3_XL.jpg)

А IPSec over GRE означает, наоборот, что внутри будут зашифрованные данные IPSec, а сверху заголовки GRE/IP. Они будут не зашифрованы:

![](http://img-fotki.yandex.ru/get/4134/83739833.24/0_ac122_7c031dee_XL.jpg)

Такой вариант возможен, например, если шифрование у вас происходит на отдельном устройстве перед туннелированием

![](http://img-fotki.yandex.ru/get/5641/83739833.24/0_ac121_d8dc78dd_XL.jpg)

Зачем такая пахабщина нужна, не очень понятно, поэтому обычно используется именно GRE over IPSec.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://linkmeup.gitbook.io/sdsm/7.-vpn/3.-gre-over-ipsec.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
