Skip to content

Instantly share code, notes, and snippets.

@kerus1024
Last active April 9, 2020 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kerus1024/cee954c0ecf04773fe5754a4fd800f64 to your computer and use it in GitHub Desktop.
Save kerus1024/cee954c0ecf04773fe5754a4fd800f64 to your computer and use it in GitHub Desktop.
GRE Tunnel on Linux
#!/bin/sh
INTERFACE="gre_yy_zz"
LOCAL_ADDR="72.30.35.9"
REMOTE_ADDR="172.217.161.78"
GRE_CIDR="10.33.0.1/30"
ip link set $INTERFACE down
ip tunnel del $INTERFACE
ip tunnel add $INTERFACE mode gre remote $REMOTE_ADDR local $LOCAL_ADDR ttl 255
ip link set $INTERFACE up
ip addr add $GRE_CIDR dev $INTERFACE
iptables -A INPUT -p gre -s $REMOTE_ADDR -j ACCEPT
iptables -A INPUT -i $INTERFACE -j ACCEPT
iptables -A FORWARD -p gre -j ACCEPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment