Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello,
I have a question about lifetime to be leased to an interface of IPv6 address.
I set the valid lifetime to 0xffffffff and the preferred
lifetime to 10.
(Even I set the valid lifetime to 0xffffffff)
I expected the address become deprecated after 10 seconds.
but After 10 seconds it never become deprecated.
-----------------------------------------------------------------------------------------------
# ip addr add 2002:100:10:1::100/64 dev lan2 valid_lft 0xffffffff preferred_lft 10
★ wait 10 seconds
# ip addr show lan2
52: lan2: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
link/ether 02:02:02:02:02:17 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.1/24 brd 192.168.1.255 scope global lan2
inet6 2002:100:10:1::100/64 scope global <----I expected address become deprecated. but not changed.
valid_lft forever preferred_lft forever
inet6 fe80::2:2ff:fe02:217/64 scope link
valid_lft forever preferred_lft forever
-----------------------------------------------------------------------------------------------
Then, I read RFC2461,3315,3633,4861 etc.
There is described a value of 0xffffffff represent infinity.
-------------------------------------------------------------
<RFC 2461>
Valid Lifetime
32-bit unsigned integer. The length of time in
seconds (relative to the time the packet is sent)
that the prefix is valid for the purpose of on-link
determination. A value of all one bits
(0xffffffff) represents infinity. The Valid
Lifetime is also used by [ADDRCONF].
-------------------------------------------------------------
However I couldn't find state-changing behavior by setting "infinity" and relation to preferred lifetime.
I read the net/ipv6/addrconf.c of 3.11 kernel code.
When I set the valid lifetime to 0xffffffff,inet_addr_modify() set the ifa_flags to IFA_F_PERMANENT.(*1)
Thus, in the addrconf_verify(), the depracete remain unchanged.(*2,*3)
Is this problems with kernel? or Do I have misunderstood about "infinity"?
Thank you for your time and assistance regarding this matter.
When an address is assigned to an interface it gets the status "preferred", which it holds during its preferred-lifetime. After that lifetime expires the status becomes "deprecated" and no new connections should be made using this address. The address becomes "invalid" after its valid-lifetime also expires; the address is removed from the interface and may be assigned somewhere else on the network.
For your case, no new connection is allowed after preferred-lifetime expires but IP address is never changed because it is 0xffffffff.
Thank you so much for your kind words.
Please let me confirm.
Is this the reason why when an address is assigned with valid_lft "0xffffffff", the kernel(actually ip-command) will set preferred_lft to "forever" instead of 20sec?
# # ip addr add 2002:100:10:1::100/64 dev eth1 valid_lft 0xffffffff preferred_lft 20
# # ip addr show eth1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:04:9f:02:00:5e brd ff:ff:ff:ff:ff:ff
inet 192.168.0.101/24 brd 192.168.0.255 scope global eth1
inet6 2002:100:10:1::100/64 scope global
valid_lft forever preferred_lft forever <--------------------------- not "20sec" but "forever"
inet6 fe80::204:9fff:fe02:5e/64 scope link
valid_lft forever preferred_lft forever
It is dependent on distribution. I use Fedora 18. After IPv6 address is added using your command, the display is different from yours. Check following.
ip addr add 2002:100:10:1::100/64 dev p4p1 valid_lft 0xfffffff preferred_lft 20
ip addr show p4p1
2: p4p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:25:64:c1:90:94 brd ff:ff:ff:ff:ff:ff
inet xx.xx.xx.xx/xx brd xx.xx.xx.xx scope global p4p1
valid_lft forever preferred_lft forever
inet6 2002:100:10:1::100/64 scope global dynamic
valid_lft 2147481sec preferred_lft 18sec
inet6 fe80::225:64ff:fec1:9094/64 scope link
valid_lft forever preferred_lft forever
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.