Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =-=-=-=-=-=-=-=-=-=-=-=-=-=
- #! /bin/bash
- DEV=
- LOCAL_IP=23.111.92.132
- OFFSET=40
- if ip link sh qrtun &>/dev/null; then
- echo 'Tunnel is set up already, nothing to do.' >&2
- exit -1
- fi
- if [ -z "$DEV" ]; then
- echo '$DEV unset'
- exit -1
- fi
- if [ -z "$LOCAL_IP" ]; then
- echo '$LOCAL_IP unset'
- exit -1
- fi
- if ! modprobe ipip; then
- echo 'Failed to load ipip module'
- exit -1
- fi
- if ! grep -q qrtun_route /etc/iproute2/rt_tables; then
- if egrep -q '^[[:space:]]*'$OFFSET'[[:space:]]' /etc/iproute2/rt_tables; then
- echo Cannot append appropriate lines to /etc/iproute2/rt_tables. >&2
- echo You need to set up qrtun_route table yourself. >&2
- exit
- else
- echo ' '$OFFSET' qrtun_route' >> /etc/iproute2/rt_tables
- fi
- fi
- echo -n Setting up tunnel... >&2
- src=172.16.108.60
- dst=172.16.208.60
- ip tunnel add qrtun mode ipip remote 185.104.208.60 local $LOCAL_IP ttl 64 dev $DEV
- ip address add $src peer $dst/32 dev qrtun
- ip link set qrtun up
- ip rule add from $src table qrtun_route
- ip route add default dev qrtun table qrtun_route
- echo ' done'. >&2
- =-=-=-=-=-=-=-=-=-=-=-=-=-=
- // Qrator Labs Support
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement