Hi,
Some notes on routing philosophy with linux.
Suposse you have an IP on eth0, say A.B.C.D, and a default gateway A.B.C.E
using:
ip ad ad A.B.C.D/24 dev eth0
ip rou ad default via A.B.C.E
All is OK and working.
Suposse now you define a routing table Test and do:
ip rou ad default via A.B.C.E table Test
ip rule add from A.B.C.D table Test
ip rou flu cac
All is still OK, then you put an INVALID default gateway A.B.C.Y (this IP is not
a gateway, in fact it is no associated
to any computer):
ip rou del default
ip rou ad default via A.B.C.Y
Then, you telnet some_IP, IT WORKS as pakets are routed USING table Test. If you
do:
ip rou get some_IP
it says:
some_IP via A.B.C.Y dev eth0 src A.B.C.D
Is this a correct response????
If you issue:
ip rou get some_IP from A.B.C.D
it says the coreect answer:
some_IP from A.B.C.D via A.B.C.E dev eth0
In fact if you do:
ip rou del default
then
telnet some_IP
it says:
Trying some_IP...
telnet: connect to address some_IP: Network is unreachable
but this is not true ... as default gw of main table is never used.
So it seems you have to stat some (even invalid) default gateway to achieve
routing.
Any comment??