[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Source address selection problems



On Thu, Mar 24, 2005 at 01:15:42PM +0000, Dominic Hargreaves wrote:
> I have a machine with multiple IPv6 addresses (all in the same prefix)
> assigned to its main network interface (eth0). This works fine, apart
> from the binding of source addresses for outgoing connections on this
> machine.

> Under IPv4, one would typically set this up with interface aliases:

> ifconfig eth0 my.main.ip
> ifconfig eth0:foo my.foo.service.ip

[trim]

> Lastly, section 5.3 of the iproute manual claims that "an IP address
> becomes secondary if another address with the same prefix bits already
> exists" (and that a secondary address is not used when selecting the
> default source address of outgoing packets.

> Howver:

> dom@urchin:~$ ip -6 addr show dev eth0 primary
> 2: eth0: <BROADCAST,MULTICAST,UP> qlen 1000
>     inet6 fe80::2e0:18ff:fe07:c2b7/64 scope link 
>     inet6 2001:1b40:0:1000:c1c9:c849:0:1/64 scope global 
>     inet6 2001:1b40:0:1000:c1c9:c849:103:e801/64 scope global 
> dom@urchin:~$ ip -6 addr show dev eth0 secondary

> Some further points:

> - If I add a third address to the interface, that gets used instead;
>   I would guess that the last address is always used
>   (rather than the first). 
> - Assigning extra addresses with labels such as eth0:foo makes no
>   difference.

Under ipv4, eth0:foo makes that IP address secondary. If you use ip addr
add <ipv4> it'll also be primary. Mind you, in IPv4 it _does_
successfully pick the lowest primary IP address.

You can add 'secondary' to the end of your ip -6 add command to make it
secondary, then it shouldn't be a candidate for source addressing except
when specified (eg. ping)

Basically, somewhere along the line, Linux gained the ability to have
multiple primary IPs on a single interface and prefix.

-- 
-----------------------------------------------------------
Paul "TBBle" Hampson, MCSE
8th year CompSci/Asian Studies student, ANU
The Boss, Bubblesworth Pty Ltd (ABN: 51 095 284 361)
Paul.Hampson@Anu.edu.au

"No survivors? Then where do the stories come from I wonder?"
-- Capt. Jack Sparrow, "Pirates of the Caribbean"

This email is licensed to the recipient for non-commercial
use, duplication and distribution.
-----------------------------------------------------------

Attachment: pgppU22m2MI1y.pgp
Description: PGP signature


Reply to: