mxywes revised this gist 10 months ago. Go to revision
1 file changed, 39 insertions
README.md(file created)
| @@ -0,0 +1,39 @@ | |||
| 1 | + | Technique found in https://github.com/Sadzurami/tunnelbroker-proxies/tree/main | |
| 2 | + | ||
| 3 | + | # Linux setup | |
| 4 | + | 1. Add `net.ipv6.ip_nonlocal_bind=1` to `/etc/sysctl.conf` | |
| 5 | + | 2. Reload sysctl with `sysctl -p` | |
| 6 | + | 3. Find your IPv6 public subnet using `ip -6 a`. Example: `2a03:b0c0:3:d0::1d4f:1/64` | |
| 7 | + | 4. Execute this command and change `YOURIPV6SUBNET` with the subnet found above: | |
| 8 | + | ``` | |
| 9 | + | /sbin/ip -6 route add local YOUR_IPV6_SUBNET dev lo | |
| 10 | + | ``` | |
| 11 | + | 5. Test if the setup works by incrementing the IPv6 address by default, for example from `2a03:b0c0:3:d0::1d4f:2` to `2a03:b0c0:3:d0::1d4f:3`. | |
| 12 | + | Then use that address in this command: `curl --interface THEIPV6ADDRESS icanhazip.com` | |
| 13 | + | 6. If you get the IPv6 address and a successful response then you are done with the setup! | |
| 14 | + | ||
| 15 | + | # Use this new ability in your program | |
| 16 | + | Like shown above you can now send requests using any IPv6 address in your IPv6 range. | |
| 17 | + | You need to find the ability to change your source address when sending an HTTP request for example. | |
| 18 | + | ||
| 19 | + | Here are some example in various languages: | |
| 20 | + | - NodeJS: | |
| 21 | + | ``` | |
| 22 | + | var https = require('https'); | |
| 23 | + | var options = { host:'icanhazip.com',path:'/',localAddress:'A_RANDOM_IPV6_ADDRESS_IN_YOUR_RANGE',family:6 }; | |
| 24 | + | callback = function(response) { | |
| 25 | + | var data = ''; | |
| 26 | + | response.on('data',function(chunk) { data+= chunk; }); | |
| 27 | + | response.on('error',function(error) { console.log("error: "+error.message); }); | |
| 28 | + | response.on('end',function() { | |
| 29 | + | console.log(data); | |
| 30 | + | }); | |
| 31 | + | } | |
| 32 | + | https.request(options,callback).end(); | |
| 33 | + | ``` | |
| 34 | + | Found in [https://github.com/nodejs/node/issues/4139](https://github.com/nodejs/node/issues/4139#issuecomment-221406802) | |
| 35 | + | - python: https://stackoverflow.com/questions/72784772/how-to-specify-source-ip-address-in-python-requests | |
| 36 | + | ||
| 37 | + | You need to implement some kind of rotating logic into your code for picking a random IPv6 address, this can easily be done by looking at some implementation like https://github.com/ycd/ipv6-rotator/blob/main/src/rotator/rotator.rs or using existing librairies: https://www.npmjs.com/package/random-ipv6 | |
| 38 | + | ||
| 39 | + | The power of being able to do that inside your program is that you are in control of when changing the IPv6 address and you can send multiple requests in a row (async) with different IPv6 addresses for each request. | |
Newer
Older