On 02/25/2015 11:55 PM, Laine Stump wrote:
On 02/25/2015 04:50 AM, lhuang wrote:
> And i also thought about another issue after your
reminding: An
> interface can have more than one IPv6 address. But i still couldn't
> find a good way until now to chose which IPv6 address if we find more
> than one IPv6 address in one interface (maybe users should use "listen
> type=address" instead of "listen type=network" in this case ;)).
> There are some special addresses anddefault address
selection for IPv6
> address, i don't know if it is a good idea to guess which address is
> the caller really desired if we get some IPv6 address in one interface.
If they are using listen type='network', then either they will have
taken care to have the network only have a single IP, or they won't
care. Otherwise, as you say, they should use listen type='address'.
BTW, some history for listen type='network' - this feature was added to
allow a way to remove the explicit listen address from the domain
config, thus allowing the domain to be migrated from one host to
another, as long as there is a network with the same name on both hosts.
Often the network used for this is created only for this purpose. If the
physical interface named in the network has multiple IP addresses, there
really isn't a good way for libvirt to indicate preference for any one
of the addresses over another (you can't specify it with an index,
because the index of the desired IP address may be different between the
hosts. Because it's impossible to do it right, I say we shouldn't even
try; it would be worse for it to work halfway.
After i read some doc and self check , i agree with your opinion: output
error instead of chose one of them.
i found it is not a good idea for libvirt to chose use which IP address
if the hosts interface have multiple IP address (both ipv6 and ipv4),
because if the caller won't want this spice open to public, he will want
to use fe80 address in this scene. However if the caller want to use a
address for public, he will want to use 2XXX
address.
Thanks a lot for your help.
Luyao