Giter VIP home page Giter VIP logo

6in4's Introduction

6in4

Hits

One-click forwarding to migrate your IPV6 segments.

English | 中文文档

Similar to https://tunnelbroker.net/ to build your own "Hurricane Electric Free IPv6 Tunnel Broker".

Features

  • Self-built IPv6 tunnel for sit/gre/ipip protocols
  • Support to customize the IPV6 subnet size to be cut out, and the appropriate IPV6 subnet information in CIDR format will be calculated automatically.
  • Automatically recognizes the IPV6 subnet size of the server side
  • Will automatically set up the tunnel server and print the commands that the client needs to execute
  • Setting up the IPV6 tunnel is easy to understand and easy to remove

Environmental Preparation

VPS(A) VPS(B)
one IPV4 address (server_ipv4) one IPV4 address (clinet_ipv4)
one IPV6 subnet no IPV6 address
Hereafter referred to as server Hereafter referred to as client

Usage

Download Script

curl -L https://raw.githubusercontent.com/oneclickvirt/6in4/main/6in4.sh -o 6in4.sh && chmod +x 6in4.sh

Execute it

./6in4.sh <client_ipv4> <mode_type> <subnet_size> 

Repeatable, split into multiple subnets, corresponding to different clients (servers), client_ipv4 is required, others are optional

Remember to replace client_ipv4 with the IPV4 address of the machine you want to attach IPV6 to, and the command you need to execute on the client side will be sent back to you after execution, see the instructions after execution for details.

Options Optional Option 1 Optional Option 2 Optional Option 3
<mode_type> gre sit ipip
Options Optional Option 1 Optional Option 2 Optional Option 3
<subnet_size> 64 80 112

<mode_type> only support those three protocols for now, the more advanced the more recommended, no fill in the default is sit protocol

<subnet_size> As long as it is larger than the original system subnet mask, and is a multiple of 8, if the difference between the cut subnet and the original subnet size is greater than 2 to the 16th power, it will be automatically adjusted, if you do not fill in the default is 80.

During script execution, the execution path is automatically switched to /root.

To prevent forgetting to copy commands, the commands to be executed by the client itself will be written to the 6in4_client.log file under the current path, and the commands to be executed by the client can be queried using cat 6in4_client.log.

To prevent forgetting that the server tunnel disappears after reboot, the commands to be executed by the server itself will be written to the 6in4_server.log file under the current path, you can use cat 6in4_server.log to query the commands that need to be executed by the server to redeploy the tunnel after reboot.

Attention

Tunnel Route Conflicts with Default Route

Because some servers have default intranet IPV6 routes that conflict with the tunnel, you can use the following command to remove the default IPV6 routes.(The following commands should only be executed if you get an error when attaching and the attachment fails, otherwise do not execute the following commands lightly.)

default_route=$(ip -6 route show | awk '/default via/{print $3}') && [ -n "$default_route" ] && ip -6 route del default via $default_route dev eth0

This assumes that your client's server's default NIC is eth0, and you can use ip -6 route to see the default route and replace it, the default route starts with default via and uses dev to specify the default NIC, you just need to find it by following this rule.

Host Multi-Network Interface

The script is not compatible with multiple network interfaces by default, in case of no output after ipv6_gateway: appears in the execution log, you need to execute ip -6 route show to check the gateway address of ipv6 and then write it to the file /usr/local/bin/6in4_ipv6_gateway by yourself and then run the script again.

A practical example: #2

Check server status

systemctl status ndpresponder
ip addr show

Check client status

ip addr show
curl ipv6.ip.sb

Delete tunnel

server

exclude

cat /root/6in4_server.log

You can view the name of the tunnel used, starting with server-ipv6-.

ip link set <name> down
ip tunnel del <name>

Just replace the <name> above with the name you looked up.

client

ip link set user-ipv6 down
ip tunnel del user-ipv6

Persistent tunnel

See https://www.spiritlhl.net/en/guide/incus/incus_custom.html and https://ipv6tunnel.spiritlhl.top/ for more details

6in4's People

Contributors

spiritlhls avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

6in4's Issues

报错了 404

--2024-06-13 16:50:00-- https://cdn0.spiritlhl.top/https://raw.githubusercontent.com/spiritLHLS/pve/main/extra_scripts/ndpresponder.service
Resolving cdn0.spiritlhl.top (cdn0.spiritlhl.top)... 172.67.208.154, 104.21.66.226
Connecting to cdn0.spiritlhl.top (cdn0.spiritlhl.top)|172.67.208.154|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2024-06-13 16:50:02 ERROR 404: Not Found.

Failed to start ndpresponder.service: Unit ndpresponder.service is masked.
Failed to enable unit: Unit file /etc/systemd/system/ndpresponder.service is masked.
○ ndpresponder.service
Loaded: masked (Reason: Unit ndpresponder.service is masked.)
Active: inactive (dead)

IT新人,针对脚本检测ipv4地址问题

想将脚本应用于AWS lightsail 上,创建SIT隧道与fortinet vpn一起使用。因为lightsail在vm内部使用的是私有IP,在跑完脚本后提示的服务端IPV4为vm私有段IP,请问这种状态下client -server 的隧道可以正常建立吗?还是说IPV4地址需要直接attach到服务器的网卡上?假如需要直接在网卡上pppoe后ppp接口上的地址可以作为服务端的IPV4地址使用吗?

Please help, I get nothing when trying this method.

Hello
First, thanks for your work
I have VPS with IPV6 /56 under Ubuntu 22.04 and home PC. I use tunnel from hurricane and wanna use my own 6in4 tunnel. Then i tried your scrypt. And i got nothing. Please help.
This is installatiobn log, that is all what i have, there is no server log or client log...

Will use gre protocol for ipv6 tunnel creation
将使用gre协议进行ipv6隧道创建
脚本当天运行次数:8,累计运行次数:1340
Updating package management sources
Installing dos2unix
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
dos2unix
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 384 kB of archives.
After this operation, 1367 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy/universe amd64 dos2unix amd64 7.4.2-2 [384 kB]
Fetched 384 kB in 0s (1845 kB/s)
Selecting previously unselected package dos2unix.
(Reading database ... 106410 files and directories currently installed.)
Preparing to unpack .../dos2unix_7.4.2-2_amd64.deb ...
Unpacking dos2unix (7.4.2-2) ...
Setting up dos2unix (7.4.2-2) ...
Processing triggers for man-db (2.10.2-1) ...
NEEDRESTART-VER: 3.5
NEEDRESTART-KCUR: 6.5.0-21-generic
NEEDRESTART-KEXP: 6.5.0-21-generic
NEEDRESTART-KSTA: 1
Installing ipcalc
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
ipcalc
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 25.4 kB of archives.
After this operation, 73.7 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy/universe amd64 ipcalc all 0.42-2 [25.4 kB]
Fetched 25.4 kB in 0s (275 kB/s)
Selecting previously unselected package ipcalc.
(Reading database ... 106509 files and directories currently installed.)
Preparing to unpack .../archives/ipcalc_0.42-2_all.deb ...
Unpacking ipcalc (0.42-2) ...
Setting up ipcalc (0.42-2) ...
Processing triggers for man-db (2.10.2-1) ...
NEEDRESTART-VER: 3.5
NEEDRESTART-KCUR: 6.5.0-21-generic
NEEDRESTART-KEXP: 6.5.0-21-generic
NEEDRESTART-KSTA: 1
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
iproute2 is already the newest version (5.15.0-1ubuntu2).
iproute2 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
net-tools is already the newest version (1.60+git20181103.0eebece-1ubuntu5).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
IP area being detected ......
CDN available, using CDN
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
openssl is already the newest version (3.0.2-0ubuntu1.14).
openssl set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
This step will take about 1 minute, please be patient.
在此步骤中将停留约 1 分钟,请耐心等待
root@xxx:~# systemctl status ndpresponder
Unit ndpresponder.service could not be found.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.