From 1f5dbc082a543cf8f77f7d869e833047c0f2f74c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20K=C3=BCthe?= Date: Mon, 2 Jan 2023 17:13:44 +0100 Subject: [PATCH] add gre / gretap docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marek Küthe --- docs/tunneling/gre.md | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 docs/tunneling/gre.md diff --git a/docs/tunneling/gre.md b/docs/tunneling/gre.md new file mode 100644 index 0000000..b38a778 --- /dev/null +++ b/docs/tunneling/gre.md @@ -0,0 +1,55 @@ + +# Generic Routing Encapsulation (GRE) + +*Note:* GRE tunnels are unencrypted. + +GRE tunnels on layer 3 of the ISO/OSI model. + +## Configuring with ip + +To create a tunnel, you can use the following command: +``` +ip link add type gre remote local ttl 255 +``` +Replace `` with the desired interface name, `` with the IPv4 of the peer and `` with your own IPv4. + +If you want to establish the tunnel over IPv6 instead, you can replace the `mode gre` with `mode ip6gre`. + +To delete a tunnel, you can use the following command: +``` +ip link del +``` + +To assign an IP address to the interface, you can use the following command: +``` +ip link del +``` + +To assign an IP address to the interface, you can use the following command: +``` +ip addr add dev +``` +Replace `` with your own link-local address. + +### Automatic start with ifupdown + +If you want to start the GRE tunnel automatically, you can use an ifupdown template which is placed under `/etc/network/interfaces.d`: +``` +auto +iface inet6 manual + pre-up ip link add type gre remote local ttl 255 + up ip addr add dev + post-down ip link del +``` + +The interface can then be stopped and started accordingly: +``` +ifup +``` +``` +ifdown +``` + +## GRETAP + +GRETAP tunnels operate on layer 2 of the ISO/OSI model. To use a GRETAP tunnel, you only have to change the mode: For IPv4 `gretap` and for IPv6 `ip6gretap`.