Добавим две таблицы в /etc/iproute2/rt_tables:
10 RS
20 UTEL
Организация ответов сервера через тот же канал, откуда пришел пакет:
# First ISP
IF1='ppp0'
IP1=`/sbin/ifconfig $IF1 | grep “inet addr:” | cut d ” ” f 12 | cut d “:” f 2`
P1=`/sbin/ifconfig $IF1 | grep “inet addr:” | cut d ” ” f 14 | cut d “:” f 2`
P1_NET=$IP1′/32′
# Second ISP
IF2='ppp1'
IP2=`/sbin/ifconfig $IF2 | grep “inet addr:” | cut d ” ” f 12 | cut d “:” f 2`
P2=`/sbin/ifconfig $IF2 | grep “inet addr:” | cut d ” ” f 14 | cut d “:” f 2`
P2_NET=$IP2′/32′
# Add routes to gateways and default routes
/sbin/ip route add $P1_NET dev $IF1 src $IP1 table RS
/sbin/ip route add default via $P1 table RS
/sbin/ip route add $P2_NET dev $IF2 src $IP2 table UTEL
/sbin/ip route add default via $P2 table UTEL
# Add source routing
/sbin/ip route add $P1_NET dev $IF1 src $IP1
/sbin/ip route add $P2_NET dev $IF2 src $IP2
# Add default route
/sbin/ip route add default via $P1
# Add source routing using rt_tables
/sbin/ip rule add from $IP1 table RS
/sbin/ip rule add from $IP2 table UTEL
syntax off
к себе в ~/.vimrc