All Pages > howto > Routing daemons and dn42 > EdgeOS > EdgeOS with GRE/IPsec
EdgeOS GRE/IPsec config example
This is an example configuration derived from the config used on a peering router in AS64746. It was created using EdgeOS version 1.5.0alpha1 on an EdgeRouter Lite.
Features
- Zone-based firewall
- BGP prefix filtering and route summarization
- GRE/IPsec tunnel in transport mode with "plainrsa" public key authentication
- TCP MSS clamping to avoid fragmentation
Setup
This configuration assumes that both peers have static public IPs.
You'll need to generate a public/private keypair for your router if you intend to use "plainrsa" authentication for your IPsec connections. The local public key listed in the output is what you'll send to your peer.
0sAQPNdF370ZEbN+kZUJQ10qnBlZujrg39ujfk20ILTjELksOIdJw/4jiU1MfpqFDKuB/XxERwJQp2POsFyV/n76jAgxIYBfFYfuaBcIH1rdNQtDhCnkmWzlueRXGEsz0Af79n8TKyQ9otzNhJ2cPE1CWCJbKqbIUN3piviLgGlItWNeya+Tl3Oj3ZfEVwr1QOvUAw32+m4L8T9jf1vqSlOTHpRpxxPWBrLEzstk0FOcZISji2JBpDOCU8Kpyyf74JM+LxsOIHwmS15b6iFZR3U9KZLqbbd0dSy/cM8P4XjrwM5UMyRDjrLqvuA/K/33BgtnxdQR3e9DJoYH3Qr8eRgSkR+jHyq06LvgHkHbMvrEjUnc3n8bg+YfR4oyJpIWsKjfIXmN1Q51KzxAPIAww+YSYUYtamSsQsspVAtMIQqR4e0r1In1qyoSn8VCPlksNMWpqYHbSjDo5HJYoSwxf2epzMtCvhenn0OuiH0xlgzziA+wBi6txksTMvJYcPJYnBVR2NIBjkWftOfmkY+rKMozViGjyd6kB7C8lqd8W7Ha5Ds2WxIY22DM3HcYH/zTp9z2xbuMOsbIgib/Y12Kh0wHyCz0lzFvs+d6CZwinyIXNKB/Vo4iiwT5luL5mGqf3pZx4zB+30GYSs/6MaELRF9BxD7tfqYCkOLXUtxyZ4Pdl2sw==
)
If your peer sends you a key in PEM format (starts with -----BEGIN PUBLIC KEY-----
), you'll need to convert it to the format used by EdgeOS (begins with 0s
) in order to insert it into the configuration. See this forum post for a script to convert between the two key formats.
Configuration
firewall {
enable
disable
disable
disable
disable
enable
DN42-to-Local {
reject
10 {
accept
Established/Related
state {
enable
enable
}
}
20 {
accept
ICMP
icmp
}
30 {
accept
BGP
destination {
bgp
}
tcp
state {
enable
}
tcp {
SYN,!ACK,!FIN,!RST
}
}
}
DN42-to-LAN {
reject
10 {
accept
Established/Related
state {
enable
enable
}
}
20 {
accept
ICMP
icmp
}
}
WAN-to-Local {
drop
10 {
accept
Established/Related
state {
enable
enable
}
}
20 {
accept
ICMP
icmp
}
30 {
accept
"SSH Management"
destination {
22
}
tcp
state {
enable
}
tcp {
SYN,!ACK,!FIN,!RST
}
}
40 {
accept
IKE
destination {
500,4500
}
udp
}
50 {
accept
IPSEC/ESP
esp
}
60 {
accept
"GRE over IPsec"
ipsec {
}
gre
}
}
established-only {
drop
10 {
accept
Established/Related
state {
enable
enable
}
}
}
allow-all-v4 {
accept
}
options {
{
tun
1300
}
}
disable
enable
disable
enable
}
interfaces {
eth0 {
WAN
auto
auto
}
eth1 {
LAN
auto
auto
}
eth2 {
disable
auto
auto
}
lo {
}
tun0 {
"CREST-DN42 AS64828"
gre
1400
disable
255
}
}
policy {
AS64746-IPv4 {
1 {
permit
32
}
}
DN42-IPv4 {
1 {
permit
"DN42 native"
23
28
}
2 {
permit
"DN42 anycast"
32
}
3 {
permit
Freifunk
16
}
4 {
permit
ChaosVPN
23
}
}
AS64746 {
1 {
permit
match {
ip {
address {
AS64746-IPv4
}
}
}
}
}
DN42 {
1 {
permit
match {
ip {
address {
DN42-IPv4
}
}
}
}
}
}
protocols {
64746 {
{
}
{
CREST-DN42
DN42
64828
}
{
}
parameters {
}
DN42 {
{
DN42
DN42
}
{
inbound
}
}
redistribute {
connected {
AS64746
}
}
}
static {
{
{
}
}
{
blackhole {
255
}
}
}
}
service {
nat {
6000 {
eth0
masquerade
}
}
ssh {
22
v2
}
{
disable
}
}
system {
{
10
}
ryan.dn42
edge1
login {
banner {
""
}
ryan {
authentication {
)
ryan {
AAAAB3NzaC1yc2EAAAADAQABAAACAQCymzCbuc777hZ8acvK+68tB7WlZl9V8rQjeQCHny2f9Fy2uSnDHXymUzQJSBY8dr4QM07owCFyYciYqhJRBeBRiaP1dj6avzZzlrOC2xuXSWw4aCYVkEaBPWkntCvBjmPhtvA+x5w8qm0X+B41DG1D44qzrQSmL5geheQCHWSf48Za6RUvPxPuQ+xfBMlIaWscRn95NST2102sYwfl3GDJEqV8FqZ5gQeuG3LDRBQmVEZOSMFIN0pOrp6+UYDe6LSw8eD3uBNrkfbbwwEqjHKFNuYaIw/XNdY0nqhHec0KjsuPLHTQMc44h8CPL5ytAtjF1WnPAE4e3aDQFnB05V/3GThJI010bNkLw5zbGkq0QUa7SmFfAsyOg50grByqZWY/J997HXjWdsgK+7d3K4VQXlI1Uak6G2i0Vb5KX0Xv6dmFmsqwuomeGozBJOl3YebvHI/39Y1VcZls2Zkjg4dBWJQGhsZv8wAX8bf7owtLPE+PcWvX5dRmk44r93mk1M1PTz7XAJGXfeii/OV+QRZZkbzhi3h7VItF5Yv5nptMQUx+irUrIX3gaTHOu8cMTxtP52kIOGOEN/LmYbmrdc++QJNGGadopuZBDpCiR2xQhwQL5yKaXH6Rdenn9d0mdNTzdqw5QOUfjY+SqTMDqLk+ETY+YZ6fvJYDIm4yfgi//Q==
ssh-rsa
}
}
admin
}
}
ntp {
0.ubnt.pool.ntp.org {
}
1.ubnt.pool.ntp.org {
}
2.ubnt.pool.ntp.org {
}
3.ubnt.pool.ntp.org {
}
}
offload {
enable
ipv4 {
enable
}
ipv6 {
enable
}
}
options {
true
}
package {
squeeze {
"main contrib non-free"
squeeze
""
""
}
squeeze-security {
main
squeeze/updates
""
""
}
squeeze-updates {
"main contrib non-free"
squeeze-updates
""
""
}
}
syslog {
global {
all {
notice
}
protocols {
debug
}
}
}
}
vpn {
ipsec {
disable
ESP-AES128-SHA1-DH5-TRANSPORT {
disable
3600
transport
dh-group5
1 {
aes128
sha1
}
}
IKE-AES128-SHA1-DH5 {
28800
1 {
5
aes128
sha1
}
}
{
eth0
}
{
{
authentication {
rsa
crest-dn42
}
initiate
ESP-AES128-SHA1-DH5-TRANSPORT
IKE-AES128-SHA1-DH5
0 {
disable
disable
ESP-AES128-SHA1-DH5-TRANSPORT
gre
}
}
}
}
{
crest-dn42 {
0sAwEAAbsbRoUcgdm4A4Nm+PLxWcW+zFis7pkaJ0MkGVzM7VC8nmngkM+W2zqZyQ4NUTBKKfGOUc4Ogi6gyhlzUnHdag9tDERIX+BwlDO6G4arod9z9KqmJuX4AOYVjH5QlAPz7NDMAezVekGoVLPGdOAMPD6NN54ihLRH6V3if8AGoJRpiajhcgQipjeQnhH4QhsYK4XSjayGT1onQwA8nhy5kt4ofyqSale4Fl4166S9tCn4RKwtlJDjR6VIrg6op6Ip8+ke2vjEHPJHj6qVsxfRgOk2d8pY8oPVt8ayc5F1z+lqJ7R0fADfN+AQSaBqOMmg5dHDFYWwgYkU5egdVKS7Oko6uNuUWsZ0VEnRoPZ4syJEUbiF5wGfaVBaaVLZYUlRLQCffB4JKzp+JesVToCX6JYRfb4JYQWFCDeQfrqRZHM4r13h8MOWPn9cqXcP47RKJjzNp6595biUotmCbMHyy/uveMWxK6vDzPQRkywqMMJE2qOyACmbMnSce9KlYhvma82Vd+z/9/U9NEy0s5MaYNDn+q+KYT5My3NSv52F6sLVGrKxTk79tzUejZcoukJv+gf51Epam4kVHzPIal/khsfjZn6YCU2j5+qcdRmzF+SG5c2WicvEU2Gc4ratfYNEPxU5oArzHIhIz6x2nAF+szcx/x8GEyXPNHnxEboJB7ox
}
}
}
{
DN42 {
reject
DN42
Local {
firewall {
allow-all-v4
}
}
LAN {
firewall {
allow-all-v4
}
}
tun0
}
LAN {
reject
DN42 {
firewall {
DN42-to-LAN
}
}
Local {
firewall {
allow-all-v4
}
}
WAN {
firewall {
established-only
}
}
eth1
}
Local {
reject
DN42 {
firewall {
DN42-to-Local
}
}
LAN {
firewall {
allow-all-v4
}
}
WAN {
firewall {
WAN-to-Local
}
}
}
WAN {
reject
LAN {
firewall {
allow-all-v4
}
}
Local {
firewall {
allow-all-v4
}
}
eth0
}
}