IP-TUNNEL di Ubuntu 18.04 x64

 


#!/bin/sh -e
ip link add dev dummy1 type dummy
ip link set dummy1 up
ip addr add dev dummy1 103.170.101.254/32

remoteip=$(cat /var/www/html/ip.txt)
serverip=$(ip route get 1.1.1.1 | awk '{print $7}')
ip tunnel add ipip0 mode ipip remote $remoteip local $serverip
ip link set ipip0 up
ip addr add 172.20.21.1/30 dev ipip0

echo 1 > /proc/sys/net/ipv4/ip_forward

exit 0

    # lalu permission dirubah dengan command: chmod +x /etc/rc.local

    /etc/sudoers, add this
    www-data ALL=NOPASSWD: /sbin/ip