How do I make a GRE tunnel
Hello, I have been trying to make a GRE tunnel for the past few weeks with no luck.
I have tried following the following guides to no success:
I would like to make a GRE tunnel coming from an AWS EC2 instance to my Linode instance.
Any help would be highly appreciated!
Make sure you have
ip_gre loaded on both instances.
$ sudo modprobe ip_gre $ lsmod | grep gre ip_gre 22432 0 gre 12989 1 ip_gre
Then on your AWS instance, run the following commands:
$ sudo ip tunnel add gre0 mode gre remote $LINODEIP local $AWSIP ttl 255 $ sudo ip link set gre0 up $ sudo ip addr add 10.10.10.1/24 dev gre0
We're creating a tunnel device called gre0 here, and tunneling packets will originate from your $AWSIP and flow to $LINODEIP - make sure to change those in the first command.
Confirm it's set up properly:
$ ip route show default via $AWSIP dev eth0 proto static 10.10.10.0/24 dev gre0 proto kernel scope link src 10.10.10.1
Do basically the same thing on your Linode now:
$ sudo ip tunnel add gre0 mode gre remote $AWSIP local $LINODEIP ttl 255 $ sudo ip link set gre0 up $ sudo ip addr add 10.10.10.2/24 dev gre0
Once that's done, hop back over to your AWS instance and see if you can ping your Linode:
$ ping 10.10.10.2 PING 10.10.10.2 (10.10.10.2) 56(84) bytes of data. 64 bytes from 10.10.10.2: icmp_req=1 ttl=64 time=0.619 ms 64 bytes from 10.10.10.2: icmp_req=2 ttl=64 time=0.496 ms 64 bytes from 10.10.10.2: icmp_req=3 ttl=64 time=0.587 ms