#!/bin/bash
read -p "Enter local ip(172.16.0.2): " l_ip
read -p "Enter remote ip(172.16.0.2): " r_ip
read -p "Enter tun ip(192.168.9.1/30)" t_ip
read -p "Enter name tunnel: " name

ip link delete gre1 2>/dev/null

ip tunnel add $name mode gre local $l_ip remote $r_ip ttl 64 dev enp0s3
ip addr add $t_ip dev $name
ip link set $name up

echo "Enter nmcli connection modify gre1 ip-tunnel.ttl 64"
systemctl restart NetworkManager
