IPv6 Addresses Order (CentOS6)

Home » CentOS » IPv6 Addresses Order (CentOS6)
CentOS 3 Comments

Hello, in /etc/sysconfig/network-scripts/ifcfg-eth0 I have this

… IPV6INIT=yes IPV6ADDR=prefix::5
IPV6ADDR_SECONDARIES=”prefix::2 prefix::3 prefix::4″
IPV6_AUTOCONF=no IPV6_DEFAULTGW=prefix::1
IPV6_DEFAULTDEV=eth0

when I enter ifconfig the IPv6 addresses are in a different order

eth0 Link encap:Ethernet HWaddr … inet addr:… Bcast:… Mask:… inet6 addr: fe80::…/64 Scope:Link inet6 addr: prefix::4/64 Scope:Global inet6 addr: prefix::3/64 Scope:Global inet6 addr: prefix::5/64 Scope:Global inet6 addr: prefix::2/64 Scope:Global

is there a way to influence the order?
or how can I tell e.g. SSH to use a specific IPv6 address?
(as it seems SSH uses the first one listed in ifconfig and not the one defined with IPV6ADDR)

Thanks, Walter

3 thoughts on - IPv6 Addresses Order (CentOS6)

  • Interface Alias and IPv6only?
    (the referenced guide only explains IPv4, I’m talking about IPv6 only)

  • Okay so the other comments appear to be directing you towards unhelpful territory.

    It would be of help if you provided more detail about what you are after.

    Is this EL6 or EL7?

    Either way stop using ifconfig and start with ip – especially in ipv6 territory.

    There is no “order” as you seem to think, outside of the slight differentiation between primary and secondary.

    The primary address on an interface is the one that will be used as the source address for an application, with the secondary addresses being there to accept traffic.

    When you mention SSH to you mean SSH the client application or SSH the daemon server? If the latter then you can set ListenAddress to the IP
    to listen to.

    If the client then you need to use ‘-b’ to define the address to connect from, if wanting something other than what `ip route get
    8.8.8.8` (or whatever destination address it is) lists as the src address.

    In principle you could use `ip rule` to set up rules directing to a secondary routing table with a different src, but that’s more complex.

    If you want this address persistent for one or more hosts without always having to add ‘-b ::’ to define the source address then you can use BindAddress in your /etc/ssh/ssh_config at a system level or
    ~/.ssh/config at a user level to always use that set source address.

    man SSH and man ssh_config will help you here … assuming this is just about ssh

LEAVE A COMMENT