Last active
April 9, 2020 13:02
-
-
Save kerus1024/cee954c0ecf04773fe5754a4fd800f64 to your computer and use it in GitHub Desktop.
GRE Tunnel on Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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