* [LARTC] Multiple Default Gateways
@ 2003-05-28 11:06 dh
2003-05-28 13:36 ` Martin A. Brown
0 siblings, 1 reply; 2+ messages in thread
From: dh @ 2003-05-28 11:06 UTC (permalink / raw)
To: lartc
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 / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [LARTC] Multiple Default Gateways
2003-05-28 11:06 [LARTC] Multiple Default Gateways dh
@ 2003-05-28 13:36 ` Martin A. Brown
0 siblings, 0 replies; 2+ messages in thread
From: Martin A. Brown @ 2003-05-28 13:36 UTC (permalink / raw)
To: lartc
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
--
Martin A. Brown --- SecurePipe, Inc. --- mabrown@securepipe.com
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-05-28 13:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-28 11:06 [LARTC] Multiple Default Gateways dh
2003-05-28 13:36 ` Martin A. Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.