#!/bin/bash # # This script manually removes routes. # if [ "$IFACE" = lo ]; then exit 0 fi if [ "$IFACE" = eth0 ]; then ip route del 10.192.64.0/28 dev eth0 src 10.192.64.1 table MyTable fi if [ "$IFACE" = eth1 ]; then # Remove address from the LAN interface ip addr del 10.27.1.5/24 brd 10.27.1.255 dev eth1 # Unset traffic arriving on new IP to go to secondary routing table ip rule del prio 200 from 10.27.1.0/24 lookup MyTable ip rule del prio 301 from 10.192.64.3 lookup MyTable # Unset routes for the MyTable table # - setting src here tells which ip to send packets from ip route del 10.27.1.0/24 dev eth1 src 10.27.1.5 table MyTable ip route del 127.0.0.0/8 dev lo table MyTable ip route del default via 10.192.64.3 src 10.192.64.1 table MyTable # Remove the routes bridging computers and phones ip route del 172.27.1.0/24 dev eth1 src 172.27.1.5 table MyTable ip route del 10.27.1.0/24 dev eth1 src 10.27.1.5 table main fi # Flush the route rules to update the kernel ip route flush cache exit 0