1#!/bin/sh 2# 3# Bring down vpn routing. 4 5# calculate the network address 6remote_network=`ipcalc -n "$remote"/"$remote_netmask_bits"` 7remote_network="${remote_network#*=}" 8 9# clear routing via VPN 10ip route del "$remote_network"/"$remote_netmask_bits" via "$5" table vpn.out 11ip route del table vpnonly.out via "$5" 12iptables -D OUTPUT -t mangle -p "$proto" \ 13 -d "$remote_network"/"$remote_netmask_bits" \ 14 --dport "$remote_port" -j ACCEPT 15iptables -D OUTPUT -t mangle -d "$remote" -j MARK --set-mark 2 16 17# undo the ICMP ping tunneling 18iptables -D OUTPUT -t mangle --protocol icmp --icmp-type echo-request \ 19 -j MARK --set-mark 3 20 21# flush route cache 22ip route flush cache 23