Re: [LARTC] Multi-Link Machine

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 9 Mar 2003, paolopoletti wrote:

> It's possible (i've done it for one of my customers two days ago, using
> the Martin manual below).
>
> It is explained in very simple way here :
> http://www.linux-ip.net/html/adv-multi-internet.html#adv-multi-internet-outbound

This really helped, but it still didn't achieve what I wanted. I ended up
having all traffic route via the "table 4", instead of just the traffic I
fwmark'd.

Currently its setup backwards to how I'd like it setup, but reversing it
shouldn't be too hard once I have it working.

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use  Iface
203.166.87.135  0.0.0.0         255.255.255.255 UH    0      0        0  ppp0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0  eth1
203.45.180.0    0.0.0.0         255.255.254.0   U     0      0        0  eth0
0.0.0.0         203.45.180.1    0.0.0.0         UG    0      0        0  eth0

traceroute before I run this script

 1  10.224.40.1 (10.224.40.1)  7.413 ms  7.148 ms  5.993 ms
 2  CPE-61-9-209-7.qld.bigpond.net.au (61.9.209.7)  7.527 ms  7.579 ms  8.155 ms
 3  GigabitEthernet4-2.cha23.telstra.net (139.130.193.117)  212.405 ms  214.032 ms  196.079 ms
 4  GigabitEthernet1-2.woo-core1.Brisbane.telstra.net (203.50.50.129)  8.220 ms  8.770 ms  8.499 ms
 5  Pos5-0.ken-core4.Sydney.telstra.net (203.50.6.221)  18.455 ms  20.626 ms  19.562 ms

[what I used below]

eth0 ip = 203.45.180.34 gateway = 203.45.180.1
ppp0 ip = 203.217.13.226 gateway = 203.166.87.135

#!/bin/bash
ip route flush table 4
ip route show table main | grep -Ev ^default \
| while read ROUTE ; do
ip route add table 4 $ROUTE
done

ip route add table 4 default via 203.166.87.135
iptables -t mangle -A PREROUTING -p tcp --dport 22 -j MARK --set-mark 4
iptables -t mangle -A PREROUTING -s 192.168.0.5 -j MARK --set-mark 4

iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 203.45.180.34
iptables -t nat -A POSTROUTING -o ppp0 -j SNAT --to-source 203.217.13.226

ip rule add fwmark 4 table 4
ip route flush cache

And traceroute after I run it.

[07:25 PM][root@xxxxxx][~]$ traceroute syd1.samford.net
traceroute to syd1.samford.net (202.155.174.85), 30 hops max, 38 byte packets
 1  203.166.87.135 (203.166.87.135)  25.317 ms  27.793 ms  25.888 ms
 2  107.ATM2-0-0.GW2.BNE1.ALTER.NET (203.166.90.249)  41.877 ms  27.741 ms  25.901 ms
 3  422.AT-6-0-0.XR1.BNE1.ALTER.NET (210.80.32.53)  27.930 ms  31.898 ms  31.840 ms
 4  So-0-0-0.XR1.SYD2.ALTER.NET (210.80.33.1)  37.854 ms  43.755 ms


Anybody got any ideas.. I don't really understand fwmark too much, im just
winging it so far. :)

Thanks again.


[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux