全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 443|回复: 22

有没有多IPV6出口一键脚本啊

[复制链接]
发表于 2025-8-19 12:17:11 | 显示全部楼层 |阅读模式
用来解决封IP或者限制流量(mega网盘)
发表于 2025-8-19 12:22:18 来自手机 | 显示全部楼层
多ipv6 一键切换主ip?
 楼主| 发表于 2025-8-19 12:50:52 | 显示全部楼层
xszz 发表于 2025-8-19 12:22
多ipv6 一键切换主ip?

最好是随机切换IP或者xray节点切换
发表于 2025-8-19 14:02:08 | 显示全部楼层
就是选择特定的v6进行出口?
 楼主| 发表于 2025-8-19 14:34:45 | 显示全部楼层
WZ-Software 发表于 2025-8-19 14:02
就是选择特定的v6进行出口?

就是利用IPV6/64子网手动或者随机切换出口IP
发表于 2025-8-19 14:56:33 | 显示全部楼层
本帖最后由 haowan 于 2025-8-19 15:02 编辑

自己研究

1. 添加本地 IPv6 路由
首先为指定的 IPv6 子网添加本地路由,并允许非本地地址绑定:

ip route add local 2001:470:1f06:556::/64 dev fy
sysctl net.ipv6.ip_nonlocal_bind=1
ip route add local:为指定的 IPv6 子网添加本地路由。此命令让网络接口 fy 处理发往 2001:470:1f06:556::/64 的 IPv6 数据包。
sysctl net.ipv6.ip_nonlocal_bind=1:启用对非本地地址的绑定,允许绑定未分配给本地设备的 IPv6 地址。
2. 安装并配置 ndppd
ndppd 是一个代理,用于响应非本地地址的邻居发现协议 (NDP) 请求,确保指定的 IPv6 地址可以在局域网中响应。

安装 ndppd:

apt install ndppd
编辑配置文件:

vim /etc/ndppd.conf
配置示例:

route-ttl 30000

proxy enp1s0 {
    router no
    timeout 500
    ttl 30000
    rule 2001:470:1f06:556::/64 {
        static
    }
}
route-ttl 30000:设置路由缓存的生存时间 (TTL)。
proxy enp1s0:指定 enp1s0 接口代理 NDP 请求。该接口是局域网连接的接口。
rule 2001:470:1f06:556::/64:配置指定的 IPv6 前缀。static 规则表示该前缀将静态代理。
重启 ndppd 服务:

systemctl restart ndppd.service
3. x-ui 配置
x-ui 是管理代理服务器的图形界面工具,下面是配置规则的说明。

配置示例:

{
  "api": {
    "services": [
      "HandlerService",
      "LoggerService",
      "StatsService"
    ],
    "tag": "api"
  },
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 62789,
      "protocol": "dokodemo-door",
      "settings": {
        "address": "127.0.0.1"
      },
      "tag": "api"
    },
    {
      "listen": "0.0.0.0",
      "port": 3333,
      "protocol": "http",
      "settings": {
        "accounts": [
          {
            "user": "XXXX",
            "pass": "XXXX"
          }
        ],
        "allowTransparent": false
      },
      "tag": "inbound-3333"
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {},
      "tag": "direct"
    },
    {
      "protocol": "freedom",
      "sendThrough": "2001:470:1f06:556::/64",
      "settings": {},
      "tag": "randomip"
    },
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],
  "policy": {
    "levels": {
      "0": {
        "handshake": 10,
        "connIdle": 300,
        "uplinkOnly": 2,
        "downlinkOnly": 3,
        "statsUserUplink": true,
        "statsUserDownlink": true,
        "bufferSize": 10240
      }
    },
    "system": {
      "statsInboundDownlink": true,
      "statsInboundUplink": true
    }
  },
  "routing": {
    "rules": [
      {
        "inboundTag": ["api"],
        "outboundTag": "direct",
        "type": "field"
      },
      {
        "ip": ["geoip:private"],
        "outboundTag": "blocked",
        "type": "field"
      },
      {
        "protocol": ["bittorrent"],
        "outboundTag": "blocked",
        "type": "field"
      },
      {
        "inboundTag": ["inbound-3333"],
        "outboundTag": "randomip",
        "type": "field"
      }
    ]
  },
  "stats": {}
}
inbounds:定义监听的入站连接。
监听 127.0.0.1:62789,用于处理 API 请求。
监听 0.0.0.0:3333,用于 HTTP 代理服务,带有基本的用户名和密码认证。
outbounds:定义出站连接。
freedom:用于直接访问互联网。
randomip:通过指定的 2001:470:1f06:556::/64 地址段访问互联网。
blackhole:拦截和丢弃不合法的流量。
routing:定义流量路由规则。
流量根据入站标签和 IP 地址决定走向。Bittorrent 流量和私人 IP 流量会被丢弃。
4. x-ui 出站规则
出站服务器设置:

[
  {
    "protocol": "http",
    "settings": {
      "servers": [
        {
          "address": "x.x.x.x",
          "port": 3333,
          "users": [
            {
              "user": "XXXX",
              "pass": "XXXX"
            }
          ]
        },
        {
          "address": "x.x.x.x",
          "port": 3333,
          "users": [
            {
              "user": "XXXX",
              "pass": "XXXX"
            }
          ]
        }
      ]
    },
    "tag": "random",
    "strategy": {
      "type": "random"
    }
  }
]
servers:定义出站 HTTP 代理服务器,两个不同 IP 的服务器 x.x.x.x 和 x.x.x.x,使用相同的用户名和密码。
strategy:出站策略为随机选择 (random)。
 楼主| 发表于 2025-8-19 15:10:12 | 显示全部楼层
haowan 发表于 2025-8-19 14:56
自己研究

1. 添加本地 IPv6 路由

搞的好复杂啊,配置100个IP配置文件不得写死个人啊
发表于 2025-8-19 15:10:46 | 显示全部楼层
本帖最后由 haowan 于 2025-8-19 15:13 编辑
AWM 发表于 2025-8-19 15:10
搞的好复杂啊,配置100个IP配置文件不得写死个人啊


不用配置啊一个网卡配置文件就可以了。他是随机生成的。只要/64都是你的。
 楼主| 发表于 2025-8-19 15:17:06 | 显示全部楼层
haowan 发表于 2025-8-19 15:10
不用配置啊一个网卡配置文件就可以了。他是随机生成的。只要/64都是你的。 ...

需要IPV6 routed吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2025-9-7 13:36 , Processed in 0.072283 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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