Peter Bieringer <pb@xxxxxxxxxxxx> writes:
> perhaps someone could update me, how a Linux kernel select the source IPv4
> address on ICMP/UDP.
I haven't read the kernel source, but I might be able to help anyway.
> One PC with one Ethernet interface
>
> Basic IP is:
> eth0: x.y.z.62
> Also I defined some aliases:
> eth0:0 x.y.z.61
[...]
> ping [...] should have source IP address of "eth0" (*.62).
My experience with using aliases is that the source address is based
on the routing table:
"route add -host x.y.x.t" will cause "ping x.y.z.t" to have source
address x.y.z.62 whereas
"route add -host x.y.x.t dev eth0:0" will cause "ping x.y.z.t" to have
source address x.y.z.61
The aliases you create will automatically be added to the routing, so
if you use several ip-adresses belonging to the same net, pinging a
host on that net will use the last alias you defined as source address.
Note: The routing table will show Iface = eth0 regardless of whether
it is eth0, eth0:0, eth0:1, ...
Hope this helps.
--
Richard Jørgensen System Developer, M. Sc.
|