netdev
[Top] [All Lists]

Re: Q: 2.2.15 default behavior for IPv4 source address selection ICMP/UD

To: netdev@xxxxxxxxxxx
Subject: Re: Q: 2.2.15 default behavior for IPv4 source address selection ICMP/UDP on multi-alias host
From: "Richard Jørgensen" <ric@xxxxxxx>
Date: 08 May 2000 13:28:15 +0200
In-reply-to: Peter Bieringer's message of "Fri, 05 May 2000 22:45:41 +0200"
References: <3.0.6.32.20000505224541.008d3940@mail.bieringer.de>
Reply-to: ric@xxxxxxx
Sender: owner-netdev@xxxxxxxxxxx
User-agent: Gnus/5.070098 (Pterodactyl Gnus v0.98) Emacs/20.3
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. 

<Prev in Thread] Current Thread [Next in Thread>