#!/bin/sh source /etc/iptables/ifnames PPP_LINE=`ip addr show dev ppp0 |grep inet` PPP_PEER=`echo $PPP_LINE|sed -e 's/.*peer \(.*\)\/32 scope.*/\1/'` PPP_OURIP=`echo $PPP_LINE|sed -e 's/.*inet \(.*\) peer.*/\1/'` echo $PPP_PEER > /etc/iptables/state/ppp_peer echo $PPP_OURIP > /etc/iptables/state/ppp_ourip # mikrovlna ip route flush table 5 ip route add $MW_NET dev $WAN_IF_MW table 5 ip route add default via $MW_GW table 5 #lokalne interfejsy a druhy interfejs ip route add 192.168.1.0/24 dev $LAN_IF table 5 ip route add 127.0.0.0/8 dev lo table 5 ip route add $PPP_PEER dev $WAN_IF_DSL table 5 #dsl ip route flush table 6 ip route add $PPP_PEER dev $WAN_IF_DSL src $PPP_OURIP table 6 ip route add default via $PPP_PEER table 6 #lokalne interfejsy a druhy interfejs ip route add 192.168.1.0/24 dev $LAN_IF table 6 ip route add 127.0.0.0/8 dev lo table 6 ip route add $MW_NET dev $WAN_IF_MW table 6 ip route add $MW_MONITOR via $MW_GW src $MW_IP # checkneme ci zije mw MWST="up" if test -f /etc/iptables/state/mwstate then source /etc/iptables/state/mwstate fi ip route del default if [ $MWST = "up" ] then ip route add default scope global nexthop via $PPP_PEER dev $WAN_IF_DSL weight 5 nexthop via $MW_GW dev $WAN_IF_MW weight 1 else ip route add default via $PPP_PEER dev $WAN_IF_DSL fi ip rule del from $MW_IP table 5 > /dev/null 2>&1 ip rule add from $MW_IP table 5 ip rule del from $PPP_OURIP table 6 > /dev/null 2>&1 ip rule add from $PPP_OURIP table 6 sh /etc/iptables/iptables-script > /dev/null 2>&1