找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 15590|回复: 27

[k2p] k2pb1 等梅林、华硕固件实现直接 ipv6 外网访问

[复制链接]
本帖最后由 一个大草包 于 2020-10-23 20:46 编辑

华硕路由 httpd只监听ipv4的80口,开了ipv6的ddns也是无法访问。

解决办法就是:把ipv6转发到ipv4去,需要安装socat或者6tunnel。

6tunnel直接下载附件就可以,放到/jffs下(适用于k2pb1以及armv7路由)。

浏览器进入路由,打开”工具箱“--”用户脚本“--”外网连接成功脚本“,填入如下内容,保存。
  1. #!/bin/sh
  2. ip -6 route add 0::/0 dev ppp0
  3. ip -6 route add default dev ppp0 metric 1
  4. sleep 30
  5. /jffs/6tunnel -6 80 -4 192.168.1.1 80
  6. cru a ddns "* * * * * /jffs/ddns-start"
  7. cru a 6t "* * * * * /jffs/6t.sh"
复制代码

为了防止6tunnel挂掉,监控其进程,如果进程不在,则重新运行6tunnel。
内容如下:
  1. #!/bin/sh
  2. ps |grep '6tunnel' |grep -v grep
  3. if [ $? -ne 0 ]
  4. then
  5. echo "start....."
  6. /jffs/6tunnel -6 443 -4 192.168.1.1 8443
  7. echo "done....."
  8. else
  9. echo "runing....."
  10. fi
复制代码
如果你不用6tunnel,还有socat可以用,可以先装entware后再装socat,当然可以自己编译,但有可能k2p装不下,刷完机只有4M空间。


如果你用dynv6的ddns,可以直接套用以下。
写入/jffs下ddns-start,请自行修改红色部分。
#!/bin/sh -e
hostname=xxxxxx.dynv6.net
device=br0
file=/tmp/ipv6.txt
token=xxxxxxxxxxxxxxxxxxxx
[ -e $file ] && old=`cat $file`

if [ -z "$hostname" -o -z "$token" ]; then
  echo "Usage: token=<your-authentication-token> [netmask=64] $0 your-name.dynv6.net [device]"
  exit 1
fi

if [ -z "$netmask" ]; then
  netmask=128
fi

if [ -n "$device" ]; then
  device="dev $device"
fi
address=$(ip -6 addr list scope global $device | grep -v " fd" | sed -n 's/.*inet6 \([0-9a-f:]\+\).*/\1/p' | head -n 1)

if [ -e /usr/bin/curl ]; then
  bin="curl -fsS"
elif [ -e /usr/sbin/wget ]; then
  bin="wget -O-"
else
  echo "neither curl nor wget found"
  exit 1
fi

if [ -z "$address" ]; then
  echo "no IPv6 address found"
  exit 1
fi

# address with netmask
current=$address/$netmask

if [ "$old" = "$current" ]; then
  echo "IPv6 address unchanged"
  exit
fi

# send addresses to dynv6
$bin "http://dynv6.com/api/update?hostname=$hostname&ipv6=$current&token=$token"

# save current address
echo $current > $file

如果你有ssl证书:
把证书传到/jffs下,浏览器进入路由,打开”工具箱“--”用户脚本“--”外网连接成功脚本“,填入如下内容,保存。
  1. #!/bin/sh
  2. ip -6 route add 0::/0 dev ppp0
  3. ip -6 route add default dev ppp0 metric 1
  4. sleep 30
  5. mount -o bind /jffs/xxxxxx.key /etc/key.pem
  6. mount -o bind /jffs/fullchain.cer /etc/cert.pem
  7. service restart_httpd
  8. /jffs/6tunnel -6 443 -4 192.168.1.1 8443
  9. cru a ddns "* * * * * /jffs/ddns-start"
  10. cru a 6t "* * * * * /jffs/6t.sh"
复制代码


还有,别忘记了开放端口。浏览器进入路由,打开”工具箱“--”用户脚本“--”防火墙脚本“,填入如下内容,保存。
  1. #!/bin/sh
  2. ip6tables -I INPUT -p tcp --dport 22 -j ACCEPT
  3. ip6tables -I INPUT -p tcp --dport 80 -j ACCEPT
  4. ip6tables -I INPUT -p tcp --dport 443 -j ACCEPT
复制代码

重启。

然后就可以直接用ipv6打开k2pb1梅林界面了。

当然你家里有n1或群晖等,也可以用nginx或caddy反代,但是只能进路由看看,关键操作是不行的。
















本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
我的恩山、我的无线 The best wifi forum is right here.
前排支持。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

不错,支持支持
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

外外网访问的话是不是也需要IPV6才能访问家里的路由器呢?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报


不错,支持支持
不错,支持支持
不错,支持支持
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

感谢分享!!!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

B1华硕固件适用吗
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

jmhgjhgjghjghj
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

我的华硕固件没有工具箱!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

话咕咕挂牌
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

不错,支持支持
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报


不错,支持支持
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

为什么大家都能看懂,我看不懂啊
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

你这个截图是什么固件  发个链接呗
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-29 10:12

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表