> For the complete documentation index, see [llms.txt](https://www.devops.buzz/public/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.devops.buzz/public/ipsec/cheat-sheet.md).

# Cheat sheet

## Get connections status logs

```bash
ipsec statusall
```

## Restart connection

```bash
mkdir -p /var/run/xl2tpd
touch /var/run/xl2tpd/l2tp-control
service strongswan restart
sleep 2
service xl2tpd restart
sleep 2
ipsec up YOUR-CONNECTION
```

## Config

### Documentation

{% embed url="<https://wiki.strongswan.org/projects/strongswan/wiki/ConnSection>" %}

### Example

{% code title="/etc/ipsec.conf" %}

```
version 2.0

config setup
	charonstart=yes
	interfaces="%none"
	nat_traversal=yes
	plutodebug="all"

conn clear
	auto=ignore

conn clear-or-private
	auto=ignore

conn private-or-clear
	auto=ignore

conn private
	auto=ignore

conn block
	auto=ignore

conn packetdefault
	auto=ignore

conn %default
	keyexchange=ikev1


conn my-conn
	left=10.128.5.1
	leftid="78.69.145.86"
	right=220.40.60.210
	leftsubnet=10.1.1.0/24
	rightsubnet=10.136.6.240/28
	leftsourceip=10.123.1.117
	ike=3des-sha1-modp1024,3des-sha256-modp1024,3des-sha384-modp1024!
	keyexchange=ikev1
	ikelifetime=86400s
	esp=3des-sha384,3des-sha256,3des-sha1!
	keylife=3600s
	rekeymargin=540s
	type=tunnel
	pfs=no
	compress=no
	authby=secret
	auto=start
	keyingtries=%forever
#conn my-conn
```

{% endcode %}


---

# 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:

```
GET https://www.devops.buzz/public/ipsec/cheat-sheet.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
