This guide focuses on GRE and SIT tunnels.
A basic configuration of a GRE and IP6GRE tunnel in /etc/network/interfaces
GRE over IPv4:
auto gre_tunnel_1
iface gre_tunnel_1 inet manual
pre-up ip tunnel add gre_tunnel_1 mode gre local LOCALIPv4 remote REMOTEIPv4 ttl 255
post-down ip link del gre_tunnel_1
iface gre_tunnel_1 inet6 static
address 2a0c:9a40:100f:50c::1/64
GRE over IPv6 - IP6GRE:
auto gre_tunnel_v6_1
iface gre_tunnel_v6_1 inet manual
pre-up ip tunnel add gre_tunnel_v6_1 mode ip6gre local LOCALIPv6 remote REMOTEIPv6 ttl 255
post-down ip link del gre_tunnel_v6_1
iface gre_tunnel_v6_1 inet6 static
address 2a0c:9a40:100f:50c::1/64
When using a GRE tunnel with BGP you must set a static route towards the tunnel endpoint in the Linux routing table.
For example on Debian:
ip route add REMOTEIP via GATEWAY dev DEFAULTNETWORKCARD
REMOTEIP is the far end of the GRE/SIT/IP6GRE Tunnel
GATEWAY is your VPS/Routers Gateway IP
DEFAULTNETWORKCARD is the VPS/Router main interface, eg. ens18 or eth0