My setup is two ISPs on a single interface and single network. I can either set my default gateway to 192.168.0.1
or 192.168.1.250
and either work.
Edit: Netmask (as noticed in the comment) is 255.255.254.0
- as I said, they are on the same subnet.
My desire is to utilize both of them with some load balancing. I have tried to follow the advice given in here https://serverfault.com/a/96586
#!/bin/sh
ip route show table main | grep -Ev '^default' \
| while read ROUTE ; do
ip route add table ISP1 $ROUTE
done
ip route add default via 192.168.1.250 table ISP1
ip route add default via 192.168.0.1 table ISP2
iptables -t mangle -A PREROUTING -j CONNMARK --restore-mark
iptables -t mangle -A PREROUTING -m mark ! --mark 0 -j ACCEPT
iptables -t mangle -A PREROUTING -j MARK --set-mark 10
iptables -t mangle -A PREROUTING -m statistic --mode random --probability 0.5 -j MARK --set-mark 20
iptables -t mangle -A PREROUTING -j CONNMARK --save-mark
Now then I do "traceroute somehost" repeatedly I can only get route through my default route which is 192.168.1.250. Shouldn't the packets change routes in a random manner? How to debug it?