Skip to contentSkip to conversation

Multiple Default Gateways

LARTC [email protected] 2 participants 2 messages May 28, 2003

lore
Share & tools
lore
#0 lore raw

Is there an easy way to get certain types of traffic (e.g. sport 25) to be routed over a certain ADSL connection?

I'm currently able to get all Proxy browsing to go via the ADSL connection by replacing the tcp_outgoing_address and udp_outgoing_address in squid.conf with the ADSL's current IP and restarting the proxy server...

I would really like to be able to make certain types of traffic to go via different links...

Current Setup:

196.38.143.32/28 165.165.?.?
eth1 (ISP Diginet Link) eth2 PPPoE ADSL (Dynamic IP)

         |                           |
         |196.38.143.34            $4|
      +---------------------------------+
      |           Linux 7.2 Router      |
      +---------------------------------+
         |192.168.0.1
         |

eth0 (Local Network)
192.168.0.0/24

Default Gateway is 196.38.143.34 (Diginet Router)

ip-up.local Script:

case $6 in
out)
# ADSL Internet Access
/sbin/iptables -F special
/sbin/iptables -A special -i $1 -d $4/32 -p tcp --dport 22
--syn -j ACCEPT

		/sbin/iptables -A special -i $1 -d $4/32 -p tcp --dport 23 

--syn -j ACCEPT

ip rule add from $4/32 table ADSL
# Is there a way to flush all rules referring to the ADSL
table?
ip route del default table ADSL
ip route add default via $5 dev $1 table ADSL ip route flush cache

cd /etc/squid
cp -f squid.conf.syrex squid.conf
TEMP=$4
export TEMP
find . -name squid.conf -type f -print | xargs perl -i -pe
's/ADSL-IP/$ENV{'TEMP'}/g';
/etc/rc.d/init.d/squid restart

tc qdisc del dev $1 root 2> /dev/null > /dev/null tc qdisc del dev $1 ingress 2> /dev/null > /dev/null tc qdisc add dev $1 root handle 1: cbq bandwidth 100mbit avpkt
1000 cell 8
tc class add dev $1 parent 1: classid 1:1 cbq rate 260kbit
weight 26kbit allot 1514 cell 8 prio 5 avpkt 1000 bounded isolated
tc class add dev $1 parent 1:1 classid 1:10 cbq rate 260kbit
weight 26kbit allot 1514 cell 8 prio 1 avpkt 1000
tc class add dev $1 parent 1:1 classid 1:20 cbq rate 234kbit
weight 23.4kbit allot 1514 cell 8 prio 2 avpkt 1000
tc qdisc add dev $1 parent 1:10 handle 10: sfq perturb 10 tc qdisc add dev $1 parent 1:20 handle 20: sfq perturb 10 tc filter add dev $1 parent 1:0 protocol ip prio 10 u32 match
ip tos 0x10 0xff flowid 1:10
tc filter add dev $1 parent 1:0 protocol ip prio 11 u32 match
ip protocol 1 0xff flowid 1:10

		tc filter add dev $1 parent 1: protocol ip prio 12 u32 \
			match ip protocol 6 0xff \
			match u8 0x05 0x0f at 0 \
			match u16 0x0000 0xffc0 at 2 \
			match u8 0x10 0xff at 33 \
			flowid 1:10
		tc filter add dev $1 parent 1: protocol ip prio 13 u32 match 
ip dst 0.0.0.0/0 flowid 1:20
	;;

esac

Regards
David Herselman (Executive Proprietor) -=*> Syrex Intranets <*=-

=- 12 Coronation Road      http://www.syrex.co.za
   Sandhurst               +27-(0)11-883-2246 Voice
   2196                    +27-(0)11-884-7945 Fax

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw

Hello David,

: Is there an easy way to get certain types of traffic (e.g. sport 25) to : be routed over a certain ADSL connection?

Yes.

: I'm currently able to get all Proxy browsing to go via the ADSL : connection by replacing the tcp_outgoing_address and
: udp_outgoing_address in squid.conf with the ADSL's current IP and : restarting the proxy server...
:
: I would really like to be able to make certain types of traffic to go : via different links...

Try something like this:

iptables -t mangle -A PREROUTING -p tcp --dport 25 -j MARK --set-mark 4 ip rule add fwmark 4 table ADSL

You may need something like this as well in your ip-up script:

iptables -t mangle -A POSTROUTING -p tcp --dport 25 -j SNAT --to-source $4

(Note $4 is the current dynamic IP handed to us by pppd.)

This may not be everything you need, so please also consult my linux-ip.net documentation.

http://linux-ip.net/html/adv-multi-internet.html
http://linux-ip.net/html/adv-multi-internet.html#adv-multi-internet-outbound

Best of luck,

-Martin

Signature · 5 lines
Martin A. Brown --- SecurePipe, Inc. --- [email protected]

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/