ipv6_proxy

Crates.ioipv6_proxy
lib.rsipv6_proxy
version0.1.18
sourcesrc
created_at2024-01-07 01:31:05.654943
updated_at2024-06-14 19:29:14.513387
descriptionHttp proxy, every request from a separate IPv6 address.
homepagehttps://atomgit.com/i18n-in/ipv6_proxy
repositoryhttps://atomgit.com/i18n-in/ipv6_proxy.git
max_upload_size
id1091403
size54,206
(3tieto)

documentation

README

参考:谁不想要 2^64 个 IP 的代理池 ?https://zu1k.com/posts/tutorials/http-proxy-ipv6-pool/

  1. 编辑 /etc/sysctl.conf

添加 net.ipv6.ip_nonlocal_bind=1 然后 sudo sysctl -p

apt install -y networkd-dispatcher

ipv6=$(ip -6 addr show dev eth0 | grep "inet6.*scope global" | awk '{print $2}' | sed 's/::1\//::\//')

cat <<EOF > /usr/lib/networkd-dispatcher/routable.d/50-add-route
#!/bin/sh

if [ "\$IFACE" = "eth0" ]; then
    ip route add local $ipv6 dev eth0
fi
EOF

chmod +x /usr/lib/networkd-dispatcher/routable.d/50-add-route
systemctl enable --now networkd-dispatcher || true
systemctl restart networkd-dispatcher
  1. curl 测试下

❯ curl --interface 2a02:c206:2139:9706::2 ipv6.ip.sb 2a02:c206:2139:9706::2 ❯ curl --interface 2a02:c206:2139:9706::3 ipv6.ip.sb 2a02:c206:2139:9706::3 ❯ curl --interface 2a02:c206:2139:9706::abcd ipv6.ip.sb 2a02:c206:2139:9706::abcd

git clone --depth=1 git@github.com:i18n-api/http-proxy-ipv6-pool.git
cd http-proxy-ipv6-pool
./run.sh

测试

while true; do curl -x http://127.0.0.1:3198 ipv6.ip.sb; done

Http Proxy IPv6 Pool

Make every request from a separate IPv6 address.

https://zu1k.com/posts/tutorials/http-proxy-ipv6-pool/

Tutorial

Assuming you already have an entire IPv6 subnet routed to your server, for me I purchased Vultr's server to get one.

Get your IPv6 subnet prefix, for me is 2001:19f0:6001:48e4::/64.

$ ip a
......
2: enp1s0: <BROADCAST,MULTICAST,ALLMULTI,UP,LOWER_UP> mtu 1500 qdisc fq state UP group default qlen 1000
    ......
    inet6 2001:19f0:6001:48e4:5400:3ff:fefa:a71d/64 scope global dynamic mngtmpaddr
       valid_lft 2591171sec preferred_lft 603971sec
    ......

Add route via default internet interface

ip route add local 2001:19f0:6001:48e4::/64 dev enp1s0

Open ip_nonlocal_bind for binding any IP address:

sysctl net.ipv6.ip_nonlocal_bind=1

For IPv6 NDP, install ndppd:

apt install ndppd

then edit /etc/ndppd.conf:

route-ttl 30000

proxy eth0 {
    router no
    timeout 500
    ttl 30000

    rule 2001:19f0:6001:48e4::/64 {
        static
    }
}

Now you can test by using curl:

$ curl --interface 2001:19f0:6001:48e4::1 ipv6.ip.sb
2001:19f0:6001:48e4::1

$ curl --interface 2001:19f0:6001:48e4::2 ipv6.ip.sb
2001:19f0:6001:48e4::2

Great!

Finally, use the http proxy provided by this project:

$ while true; do curl -x http://127.0.0.1:3198 ipv6.ip.sb; done
2001:19f0:6001:48e4:971e:f12c:e2e7:d92a
2001:19f0:6001:48e4:6d1c:90fe:ee79:1123
2001:19f0:6001:48e4:f7b9:b506:99d7:1be9
2001:19f0:6001:48e4:a06a:393b:e82f:bffc
2001:19f0:6001:48e4:245f:8272:2dfb:72ce
2001:19f0:6001:48e4:df9e:422c:f804:94f7
2001:19f0:6001:48e4:dd48:6ba2:ff76:f1af
2001:19f0:6001:48e4:1306:4a84:570c:f829
2001:19f0:6001:48e4:6f3:4eb:c958:ddfa
2001:19f0:6001:48e4:aa26:3bf9:6598:9e82
2001:19f0:6001:48e4:be6b:6a62:f8f7:a14d
2001:19f0:6001:48e4:b598:409d:b946:17c

Author

Http Proxy IPv6 Pool © zu1k, Released under the MIT License.

Commit count: 0

cargo fmt