0%

在Ubuntu中使用IPv6

我的电脑上装了Ubuntu 14.04 LTS 系统,学校的校园网需要拨号才能使用,并且在拨号之后获得IPv6地址。
但是实际上,我在Windows上可以正常使用IPv6地址,但是在Ubuntu上无法使用,问了度娘之后,总结解决办法如下:
更改文件/etc/sysctl.d/10-ipv6-privacy.conf

1
2
3
4
5
6
7
8
9
10
11
12
# IPv6 Privacy Extensions (RFC 4941)
# ---
# IPv6 typically uses a device's MAC address when choosing an IPv6 address
# to use in autoconfiguration. Privacy extensions allow using a randomly
# generated IPv6 address, which increases privacy.
#
# Acceptable values:
# 0 - don’t use privacy extensions.
# 1 - generate privacy addresses
# 2 - prefer privacy addresses and use them over the normal addresses.
net.ipv6.conf.all.use_tempaddr = 2
net.ipv6.conf.default.use_tempaddr = 2

1
2
3
4
5
6
7
8
9
10
11
12
# IPv6 Privacy Extensions (RFC 4941)
# ---
# IPv6 typically uses a device's MAC address when choosing an IPv6 address
# to use in autoconfiguration. Privacy extensions allow using a randomly
# generated IPv6 address, which increases privacy.
#
# Acceptable values:
# 0 - don’t use privacy extensions.
# 1 - generate privacy addresses
# 2 - prefer privacy addresses and use them over the normal addresses.
net.ipv6.conf.all.use_tempaddr = 2
net.ipv6.conf.default.use_tempaddr = 0

然后重新拨号之后,就可以正常使用IPv6了。
对于校园网不支持IPv6或者获取方式不一样的小伙伴,此方法不一定适用。
使用命令ifconfig可查看网络连接信息:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
eth0      Link encap:Ethernet  HWaddr 50:7b:9d:03:61:aa  
inet6 addr: fe80::527b:9dff:fe03:61aa/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:506 errors:0 dropped:1 overruns:0 frame:0
TX packets:103 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:48325 (48.3 KB) TX bytes:14006 (14.0 KB)
Interrupt:20 Memory:f1200000-f1220000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:226 errors:0 dropped:0 overruns:0 frame:0
TX packets:226 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:20694 (20.6 KB) TX bytes:20694 (20.6 KB)

ppp0 Link encap:Point-to-Point Protocol
inet addr:10.170.15.47 P-t-P:10.170.72.254 Mask:255.255.255.255
inet6 addr: fe80::2a:e1b3:3273:b894/10 Scope:Link
inet6 addr: 2001:250:1006:dff0:2a:e1b3:3273:b894/64 Scope:Global
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:42 errors:0 dropped:0 overruns:0 frame:0
TX packets:47 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:3793 (3.7 KB) TX bytes:3373 (3.3 KB)

wlan0 Link encap:Ethernet HWaddr 94:65:9c:4e:02:dc
inet addr:192.168.0.108 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::9665:9cff:fe4e:2dc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:24275 errors:0 dropped:0 overruns:0 frame:0
TX packets:8251 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:35338441 (35.3 MB) TX bytes:845841 (845.8 KB)

上一张成品图

参考文章:http://www.cnblogs.com/makefile/p/5040615.html

生命重在折腾