On the road again

This article describes how to setup GRE PTP tunnel on RHEL and Ubuntu linux distributives.

General

GRE visualization:

gre_protocol.png

GRE tunnels are IP-over-IP tunnels which can encapsulate IPv4/IPv6 and unicast/multicast traffic. To create a GRE tunnel on Linux, you need ip_gre kernel module, which is GRE over IPv4 tunneling driverю

For GRE configuration 2 pairs of addresses are needed - external address of each peer and internal address used inside tunnel on each peer.

First check kernel modules:

lsmod | grep gre
modprobe ip_gre
modinfo ip_gre

Interface configuration on RHEL:

DEVICE=tun0

BOOTPROTO=none

ONBOOT=no
TYPE=GRE
 
# External address of local peer
MY_OUTER_IPADDR=95.167.35.26
# Internal local peer address inside the tunnel
MY_INNER_IPADDR=172.17.254.1
 
# external address of remote peer
PEER_OUTER_IPADDR=178.45.248.69
# internal peer address of remote peer inside the tunnel
PEER_INNER_IPADDR=172.17.254.2
 
###On the remote node interface should be configured similarly (addresses of local and remote peer should be mirrored).
 
Interface configuration on Ubuntu:

 auto tun0
iface tun0 inet static
    address 172.17.254.1
    netmask 255.255.255.0
    broadcast 172.17.254.255
    up ifconfig tun0 multicast
    pre-up iptunnel add tun0 mode gre local 95.167.35.26 remote 178.45.248.69 dev ens3 ttl 255
    pointopoint 172.17.254.2
    post-down iptunnel del tun0

###On the remote node interface should be configured similarly (addresses of local and remote peer should be mirrored).
 

 

Add comment