Hi,
I tried to set up loadbalancing with equal cost multipath. However
packets seem to use only one path (the one that is also in the route
cache table). On one host i configured:
router-a:~# ip a l
1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet 1.1.1.1/24 scope global lo
inet6 ::1/128 scope host
38: ppp0: <POINTOPOINT,MULTICAST,NOARP,PROMISC,UP> mtu 1500 qdisc
pfifo_fast qlen 3
link/ppp
inet 10.0.0.51 peer 10.0.0.1/32 scope global ppp0
40: ppp1: <POINTOPOINT,MULTICAST,NOARP,PROMISC,UP> mtu 1500 qdisc
pfifo_fast qlen 3
link/ppp
inet 10.10.0.51 peer 10.10.0.1/32 scope global ppp1
I added a route like this:
router-a:~# ip r l
10.0.0.1 dev ppp0 proto kernel scope link src 10.0.0.51
10.10.0.1 dev ppp1 proto kernel scope link src 10.10.0.51
2.2.2.2 equalize
nexthop via 10.10.0.1 dev ppp1 weight 1
nexthop via 10.0.0.1 dev ppp0 weight 1
I also made sure my ip to test with is always 1.1.1.1, so i did:
router-a:~# iptables -t nat -A POSTROUTING -o ppp0 -j SNAT --to 1.1.1.1
router-a:~# iptables -t nat -A POSTROUTING -o ppp1 -j SNAT --to 1.1.1.1
I know there are different methods to do this. On the other host it
looks pretty much the same only the other way arround. So addresses:
router-b:~# ip a l
1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet 2.2.2.2/24 scope global lo
inet6 ::1/128 scope host
42: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP> mtu 1500 qdisc pfifo_fast
qlen 3
link/ppp
inet 10.0.0.1 peer 10.0.0.51/32 scope global ppp0
44: ppp1: <POINTOPOINT,MULTICAST,NOARP,UP> mtu 1500 qdisc pfifo_fast
qlen 3
link/ppp
inet 10.10.0.1 peer 10.10.0.51/32 scope global ppp1
The routes:
router-b:~# ip r l
10.0.0.51 dev ppp0 proto kernel scope link src 10.0.0.1
10.10.0.51 dev ppp1 proto kernel scope link src 10.10.0.1
1.1.1.1 equalize
nexthop via 10.10.0.51 dev ppp1 weight 1
nexthop via 10.0.0.51 dev ppp0 weight 1
And always connect to 1.1.1.1 as 2.2.2.2:
router-b:~# iptables -t nat -A POSTROUTING -o ppp0 -j SNAT --to 2.2.2.2
router-b:~# iptables -t nat -A POSTROUTING -o ppp1 -j SNAT --to 2.2.2.2
As i mentioned this doesn't work. All traffic initiated from the first
router seems to use ppp1 and all traffic initiated from the second uses
ppp0.
If i look in the cache of the routers, i notice that the "equalize"
option as mentioned in the "IP Command Reference" is not there.
rouer-a:~# ip -s r l 2.2.2.2 t cache
2.2.2.2 via 10.10.0.1 dev ppp1 src 10.10.0.51
cache users 1 used 20 age 194sec mtu 1500 advmss 1460
2.2.2.2 from 1.1.1.1 via 10.0.0.1 dev ppp0
cache users 1 used 30 age 203sec ipid 0x847c mtu 1500 advmss 1460
rouer-b:~# ip -s r l 1.1.1.1 t cache
1.1.1.1 via 10.0.0.51 dev ppp0 src 10.0.0.1
cache users 1 used 40 age 247sec mtu 1500 advmss 1460
1.1.1.1 from 2.2.2.2 via 10.10.0.51 dev ppp1
cache users 1 used 20 age 239sec ipid 0xe484 mtu 1500 advmss 1460
The cache entries do explain why this strange behaviour is occuring. Do
i need to install the kernel patch that "IP Command Reference" metions?
(page 26 in the explanation of the equalize option in ip route add) I'm
running debian kernel 2.4.18-686. Is so, where do i get it? Is there a
way to prevent routes being cached?
Thanks,
Willem