All Pages > howto > IPsec > GRE + IPsec on Debian
GRE + IPsec on Debian based distros
- Install racoon from ipsec-tools.
- Define an IPsec security policy in /etc/ipsec-tools.conf
- Load the IPsec security policy into the IPsec security policy database.
- Configure the racoon daemon.
- Configure a GRE tunnel.
Used resources in this example:
- tunnel endpoints: 1.2.3.4 and 5.6.7.8
- internal IPv4 addresses: 10.0.0.1 and 10.0.0.2
Define an IPsec security policy
Example policy on 1.2.3.4:
#!/usr/sbin/setkey -f
;
;
Change the direction on 5.6.7.8.
Load the IPsec security policy into the IPsec security policy database
Load the policy with the setkey command.
Afterward check the policy database with:
Configure the racoon daemon
An example /etc/racoon/racoon.conf.
"/etc/racoon/psk.txt";
certificate "/etc/racoon/certs";
info;
listen {
[500];
[4500];
}
[500] {
main;
strict;
asn1dn;
asn1dn;
time 1 hour;
x509 "local.crt" "local.key";
x509 "remote.crt";
x509 "ca.crt";
on;
off;
off;
proposal {
aes 256;
sha256;
rsasig;
modp4096;
}
}
address 47 address 47 {
modp4096;
time 1 hour;
aes 256;
hmac_sha1;
deflate;
}
pre_shared_key
Configure a GRE tunnel
Add this to /etc/network/interfaces:
auto gre1
iface gre1 inet tunnel
mode gre
netmask 255.255.255.255
address 10.0.0.1
dstaddr 10.0.0.2
endpoint 5.6.7.8
local 1.2.3.4
ttl 255