Linux 3.2.x 内核中禁用/降级临时IPV6地址

重装了Ubuntu 12.04,内核升级后,支持了临时IPV6地址,但是,默认被设置成了:优先走临时地址,再走public地址。

具体参见:

http://www.ipsidixit.net/2012/08/09/ipv6-temporary-addresses-and-privacy-extensions/

$ ls /proc/sys/net/ipv6/conf/eth0
accept_dad                  disable_ipv6       regen_max_retry
accept_ra                   force_mld_version  router_probe_interval
accept_ra_defrtr            force_tllao        router_solicitation_delay
accept_ra_pinfo             forwarding         router_solicitation_interval
accept_ra_rt_info_max_plen  hop_limit          router_solicitations
accept_ra_rtr_pref          max_addresses      temp_prefered_lft
accept_redirects            max_desync_factor  temp_valid_lft
accept_source_route         mc_forwarding      use_tempaddr
autoconf                    mtu
dad_transmits               proxy_ndp

关键就是这个use_tempaddr啦,定义如下:

use_tempaddr 	System dependent (seems to be 2 on Ubuntu these days…) 	We might expect that this is a simple on/off value to enable use of temporary addresses. Yet when we cat it on this system it has the value ’2′.

    <=0 Disable Privacy Extensions (i.e. do not use changing temporary addresses at all)
    ==1 Use the Privacy Extensions, but prefer public (i.e. non-temporary) adresses over temporary ones.
    >1 (e.g. 2 as here) Use the Privacy Extensions and prefer them.

该怎么做不用我说了吧,root直接写值即可。

su
echo 1 > /proc/sys/net/ipv6/conf/eth0/use_tempaddr

 备注:此内核设置即时生效,无需重启networking服务。

Leave a Reply

Your email address will not be published. Required fields are marked *