#!/bin/sh
echo "set ip_forward -> 1"
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "set rt_tables"
sed -i -e '/10 DX/d' /etc/iproute2/rt_tables
sed -i -e '/20 WT/d' /etc/iproute2/rt_tables
echo '10 DX' >> /etc/iproute2/rt_tables
echo '20 WT' >> /etc/iproute2/rt_tables
echo "clean GW_DX & GW_WT"
IF_WT="eth0"
IF_DX="eth1"
GW_WT=" 网通网关IP"
GW_DX="电信网关IP"
WAN_WT="本机ip"
WAN_DX="本机ip"
ip route del default via $GW_DX table DX 2>&1>/dev/null
ip route del default via $GW_WT table WT 2>&1>/dev/null
ip rule del from $WAN_DX pref 10 table DX 2>&1>/dev/null
ip rule del from $WAN_WT pref 20 table WT 2>&1>/dev/null
ip route add default via $GW_DX table DX
ip route add default via $GW_WT table WT
ip rule add from $WAN_DX pref 10 table DX
ip rule add from $WAN_WT pref 20 table WT
ip route flush cache
阅读(1307) | 评论(0) | 转发(0) |