Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DEV=gre2
- LOCAL_ADDR=MYIP
- FILTER_ADDR=198.148.83.92
- INTERNAL_ADDR=10.17.16.14
- NETWORK=10.17.16.12
- GATEWAY=10.17.16.13
- TYPE=gre
- TABLE=T1
- TABLE_ID=100
- DEV1=gre3
- LOCAL_ADDR1=MYIP
- FILTER_ADDR1=209.141.38.206
- INTERNAL_ADDR1=10.17.24.2
- NETWORK1=10.17.24.0
- GATEWAY1=10.17.24.1
- TYPE1=gre
- TABLE1=T2
- TABLE_ID1=101
- DEV2=gre4
- LOCAL_ADDR2=MYIP
- FILTER_ADDR2=64.32.5.139
- INTERNAL_ADDR2=10.17.13.6
- NETWORK2=10.17.13.4
- GATEWAY2=10.17.13.5
- TYPE2=gre
- TABLE2=T3
- TABLE_ID2=102
- MTU=1436
- ## DO NOT EDIT BELOW THIS LINE ##
- if [[ -f /proc/user_beancounters ]]; then
- if [[ ! $(ip addr show gre0 | grep gre0) ]]; then
- echo "Kernel ip_gre module not loaded or accessible. Contact your hosting company."
- exit 2
- fi
- fi
- iptunnel add ${DEV} mode ${TYPE} local ${LOCAL_ADDR} remote ${FILTER_ADDR} ttl 255
- ip addr add ${INTERNAL_ADDR}/30 dev ${DEV}
- ip link set ${DEV} up
- if grep -q "${TABLE_ID} ${TABLE}" "/etc/iproute2/rt_tables" ; then
- echo "Routing table already exists, skipping"
- else
- echo "${TABLE_ID} ${TABLE}" >> /etc/iproute2/rt_tables
- fi
- ip rule add from ${NETWORK}/30 table ${TABLE}
- ip route add default via ${GATEWAY} table ${TABLE}
- ifconfig ${DEV} mtu ${MTU}
- iptunnel add ${DEV1} mode ${TYPE1} local ${LOCAL_ADDR1} remote ${FILTER_ADDR1} ttl 255
- ip addr add ${INTERNAL_ADDR1}/30 dev ${DEV}
- ip link set ${DEV1} up
- if grep -q "${TABLE_ID1} ${TABLE1}" "/etc/iproute2/rt_tables" ; then
- echo "Routing table already exists, skipping"
- else
- echo "${TABLE_ID1} ${TABLE1}" >> /etc/iproute2/rt_tables
- fi
- ip rule add from ${NETWORK1}/30 table ${TABLE1}
- ip route add default via ${GATEWAY1} table ${TABLE1}
- ifconfig ${DEV1} mtu ${MTU}
- iptunnel add ${DEV2} mode ${TYPE2} local ${LOCAL_ADDR2} remote ${FILTER_ADDR2} ttl 255
- ip addr add ${INTERNAL_ADDR2}/30 dev ${DEV}
- ip link set ${DEV2} up
- if grep -q "${TABLE_ID2} ${TABLE2}" "/etc/iproute2/rt_tables" ; then
- echo "Routing table already exists, skipping"
- else
- echo "${TABLE_ID2} ${TABLE2}" >> /etc/iproute2/rt_tables
- fi
- ip rule add from ${NETWORK2}/30 table ${TABLE2}
- ip route add default via ${GATEWAY2} table ${TABLE2}
- ifconfig ${DEV2} mtu ${MTU}
- echo "Done"
Advertisement
Add Comment
Please, Sign In to add comment