如何在使用NAT转发的家用路由器后面使用 ISATAP 连接 IPv6

转自http://blog.lifetoy.org/2010/01/31/isatap-behide-nat/

寒假回家想用 isatap 连接 ipv6, 但是家里是用路由器上网, isatap 默认在 NAT 后面没法正常工作. 考虑到路由器后面只有我一台机器需要 ipv6 连接, 于是开始瞎折腾, 想办法把所有 isatap 的数据全部定向到我那台机器上.
我机器的系统是 win7, 路由器系统是 openwrt brcm-2.4.

首先在路由器防火墙里面加条规则, 把收到的协议号是 41 的数据包全部重定向到我的机器上面. 像 isatap, 6to4 等协议的协议号都是 41. openwrt 可以直接修改 /etc/config/firewall :


config redirect

option src                      wan

option dest                     lan

option dest_ip          192.168.11.2

option proto            41

其他类似的系统 (如 dd-wrt 之类的) 应该可以直接用 iptables 修改.

不过改了这些之后还是上不了网. 抓包之后觉得可能是因为数据包的 link-local 地址和全局的 ipv6 地址不对, 于是用 netsh 人肉指定了一下这两个地址. 我写了个简单的 bat 来搞这件事情.

@echo off

 

set
interface=isatap.lan     // 这个是我 isatap interface 的名字

set
prefix=”2001:da8:8000:d010″  // 我用的是上交的 isatap router

set
ip=”220.x.x.x”     // 这个是我路由器的外网 ip

 

for /f ” tokens=2 delims=%%%%a
in
(‘”netsh int ipv6 show addr %interface% | findstr /r ^Address.*Parameters$”‘)
do netsh int ipv6 del addr %interface%
%%a

 

netsh int ipv6 add addr %interface% fe80::5efe:%ip%

netsh int ipv6 add addr %interface%
%prefix%:0:5efe:%ip%

 

netsh int ipv6 isa s s d

netsh int ipv6 isa s s e

搞定了这些之后就可以连通 ipv6 站点了 

ps. 最后想了个歪办法来解决路由器后面有多个机器需要 ipv6 连接的情况, 就是每个机器用一个不同的 isatap router. 

Post comment

Video

Blogroll

近期文章

标签

链接表

近期评论

分类目录