环境:ubuntu 12.04 & ubuntukylin(ubuntu 13.04), 互联网。
方法:使用isatapd。
步骤:
1. ifconfig 查看当前网络状态,eth0可能有多个inet6地址(Scope:Site,Scope:Link, Scope:Global),Link(fe80开头)一般都有,site和global地址一般没有。我们只给主机配置global地址,全球唯一ipv6地址。我的主机:
eth0 Link encap:以太网 硬件地址 <忽略>
inet 地址:<忽略> 广播:<忽略> 掩码:<忽略>
inet6 地址: <忽略>/64 Scope:Site
inet6 地址: 2002:<忽略>/64 Scope:Global
inet6 地址: fe80::<忽略>/64 Scope:Link
inet6 地址: fec0::c:<忽略>/64 Scope:Site
inet6 地址: 2002:<忽略>/64 Scope:Global
2. inet6地址太多,需要清理一下。sudo vim /etc/NetworkManager/NetworkManager.conf 将managed的值赋为ture;即managed=true。
3. 重启eth0。由于在ubuntukylin使用sudo /etc/init.d/networking restart死机(尚未解决),所以,本人都用sudo ifconfig eth0 down 然后sudo ifconfig eth0 up重启eth0。
4. 再次ifconfig查看一下,只有eth0与lo,其中eth0只有一个inet6 link地址。
5. 接下来使用isatapd。sudo isatapd –d isatap.hust.edu.cn (后台运行isatapd),若没有,则sudo apt-get install isatapd.
6. 再次ifconfig查看,会多了一个is0接口,其中有inet6 link和global地址。
7. 测试:ping6 ipv6.google.com没问题则可以,则没问题,可以ping6外网。可以多测试几个地址:科技网DNS服务器:2001:cc0:2fff:2::6 ,CNNIC DNS服务器:2001:dc7:1000::1,上海交大DNS服务器:2001:da8:8000:1:202:120:2:101,北京邮电大学DNS服务器:2001:da8:202:10::36或2001:da8:202:10::37。
8. 如果系统重启,又要重新输入 sudo isatapd –d isatap.hust.edu.cn。
开机启动isatapd,运行脚本:
1.编写脚本,命名为start_isatapd.sh
#/bin/sh
isatapd -d isatap.hust.edu.cn
添加文件运行属性:chmod +x start_isatapd.sh
2.开机加载shell脚本,在/etc/init.d中的rc.local文件最后行添加脚本路径(已经拷到/etc/init.d下):
/etc/init.d/start_isatapd.sh