Skip to content

Instantly share code, notes, and snippets.

@azharimad
Last active September 11, 2023 10:28
Show Gist options
  • Save azharimad/e14e919790d790958c88e531aea2baa8 to your computer and use it in GitHub Desktop.
Save azharimad/e14e919790d790958c88e531aea2baa8 to your computer and use it in GitHub Desktop.
gre back
#!/bin/bash
#
# Install iptables iproute2
# Variables
#
#
GRE_FRONT_IP=""
GRE_BACK_IP=""
#
# DO NOT CHANGE ANYTHING PAST THIS POINT
#
# bring up our GRE to our Backend server
ip tunnel add gre1 mode gre local $GRE_BACK_IP remote $GRE_FRONT_IP ttl 255
ip link set gre1 up
# add local IP addresses
ip addr add 192.168.168.2/30 dev gre1
# Setup Routing Table
echo '100 GRE' >> /etc/iproute2/rt_tables
ip rule add from 192.168.168.0/30 table GRE
ip route add default via 192.168.168.1 table GRE
##!/bin/sh
##B-Server-Backend
#apt install iptables iproute2
#echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
#sysctl -p
#lsmod | grep gre
#modprobe ip_gre
#lsmod | grep gre
#ip tunnel add gre1 mode gre local backend-ip remote front-ip ttl 255
#ip addr add 10.0.0.2/30 dev gre1
#ip link set gre1 up
#echo '100 GRE' >> /etc/iproute2/rt_tables
#ip rule add from 10.0.0.0/30 table GRE
#ip route add default via 10.0.0.1 table GRE
##final IP check
#curl http://www.cpanel.net/showip.cgi --interface 10.0.0.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment