Hello, in /etc/sysconfig/network-scripts/ifcfg-eth0 I have this <ifcfg-eth0> ... IPV6INIT=yes IPV6ADDR=prefix::5 IPV6ADDR_SECONDARIES="prefix::2 prefix::3 prefix::4" IPV6_AUTOCONF=no IPV6_DEFAULTGW=prefix::1 IPV6_DEFAULTDEV=eth0 </ifcfg-eth0> when I enter ifconfig the IPv6 addresses are in a different order <ifconfig> 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 </ifconfig> 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
> On May 30, 2017, at 3:26 AM, Walter H. <walter.h at mathemainzel.info> wrote: > > is there a way to influence the order?Not sure what your use of multiple IPs is. . . but I'd probably use an interface alias instead of secondary. https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s2-networkscripts-interfaces-alias.html
On Wed, May 31, 2017 03:55, Steven Tardy wrote:> >> On May 30, 2017, at 3:26 AM, Walter H. <walter.h at mathemainzel.info> >> wrote: >> >> is there a way to influence the order? > > Not sure what your use of multiple IPs is. . . but I'd probably use an > interface alias instead of secondary. > > https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s2-networkscripts-interfaces-alias.htmlInterface Alias and IPv6only? (the referenced guide only explains IPv4, I'm talking about IPv6 only)
On 30 May 2017 at 08:26, Walter H. <walter.h at mathemainzel.info> wrote:> Hello, > in /etc/sysconfig/network-scripts/ifcfg-eth0 I have this > <ifcfg-eth0> > ... > IPV6INIT=yes > IPV6ADDR=prefix::5 > IPV6ADDR_SECONDARIES="prefix::2 prefix::3 prefix::4" > IPV6_AUTOCONF=no > IPV6_DEFAULTGW=prefix::1 > IPV6_DEFAULTDEV=eth0 > </ifcfg-eth0> > when I enter ifconfig the IPv6 addresses are in a different order > <ifconfig> > 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 > </ifconfig> > 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) >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