I have two gateways behind one switch, one cable coming to me. I want to make Linux use both of the gateways equaly.
I'm trying to follow the steps in
http://lartc.org/howto/lartc.rpdb.multiple-links.html
The problem is sometimes RTNETLINK gives me trouble answers, like "Invalid argument" or "File exist". I have solved some of these 'invalid arguments' by adding several items into the kernel configure.
However now I got "File exist". Which file ?! Why these error messages are so cryptic...
Here is the situation:
Code:
# ifconfig eth0 192.168.0.250 netmask 255.255.255.0 up
# ifconfig eth0:0 10.10.10.2 netmask 255.255.255.0 up
(1)# route del -net 192.168.0.0/24
(1)# route del -net 10.10.10.0/24
# ip route add 192.168.0.0/24 dev eth0 table 200
(3)# ip route add default via 192.168.0.1 dev eth0 table 200
# ip route add 10.10.10.0/24 dev eth0:0 table 100
# ip route add default via 10.10.10.1 dev eth0:0 table 100
(2)RTNETLINK answers: File exists
# ip route add 192.168.0.0/24 src 192.168.0.1 dev eth0
(4)RTNETLINK answers: Invalid argument
# ip route add 10.10.10.0/24 src 10.10.10.1 dev eth0:0
(5)RTNETLINK answers: Invalid argument
(6)# ip route add 10.10.10.0/24 src 10.10.10.1 dev eth0
RTNETLINK answers: Invalid argument
(7)# ip route add default scope global nexthop via 10.10.10.1 weight 1 nexthop via 192.168.0.1 weight 1
RTNETLINK answers: Invalid argument
-------------------------------------
(8)# route del default gw 192.168.0.1
# ip route add default scope global nexthop via 10.10.10.1 weight 1 nexthop via 192.168.0.1 weight 1
Some explanations:
(1) - When I add an IP address to my NIC ifconfig automaticaly adds a network for that IP. I delete these networks to add them lately acording to the LARTC example.
(2) - What is existing? Maybe there is already a default route (gateway) selected in (3). However I'm able to add several default gateways trough `route add default gw XXX.XXX.XXX.XXX`
(4),(5) - What exactly is invalid?
(6) - Maybe it doesn't accept IP aliases in `ip` command line? I tried without the alias, only eth0 but it is still invalid.
(7) - It is my goal this to work - however another invalid argument.
(8) - When deleting the current default gw (I believe the command (3) added it) I'm able to make it load witouth error. However this is the output from `route -n`. I'm not sure if the result from this is to be marked here:
Code:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.10.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
I'm not sure if I'm doing something wrong, or my kernel is lacking something (again). Give me any idea how to proceed.