understand the source address selection in case when reply is sent out via another interface

Martin T <[email protected]>
Newsgroups org.kernel.vger.lartc
Message-ID <CAJx5YvEqdU2edhxJFQ1KPfcRUMbtsjjSy0+Cyvmygz3boRTQQA@mail.gmail.com>
Hi,

I have a server with two networks interfaces: eth0(IPv4 address
10.10.10.73) and eth1(IPv4 address 192.168.1.16). In addition, there
is a following static route in this server "main" table:

# ip route show 172.16.0.0/24
172.16.0.0/24 via 192.168.1.252 dev eth1   src 192.168.1.16
#

Now when I send an ICMP "echo request" message from 172.16.0.0/24
network to IP address 10.10.10.73, then it is sent out via eth1
interface because of this static route. According to "ip route get
172.16.0.0" the source IP should be 192.168.1.16. However, when I
tcpdump ICMP traffic on eth1 interface, then I can see that source IP
is actually 10.10.10.73. Why is that so? When I read the
http://linux-ip.net/html/routing-saddr-selection.html, then it says
that "kernel will use the src hint from the chosen route path" which
in this case is 192.168.1.16. Or is the first rule that if it is a
reply package, then source IP is always the one which initial package
was addressed to?


thanks,
Martin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.