{"id":21306942,"url":"https://github.com/oneclickvirt/6in4","last_synced_at":"2025-03-17T15:13:21.441Z","repository":{"id":203270045,"uuid":"709187855","full_name":"oneclickvirt/6in4","owner":"oneclickvirt","description":"Self-build IPv6-in-IPv4 Tunnel Server --- 自建IPv6-in-IPv4隧道服务器 ","archived":false,"fork":false,"pushed_at":"2025-01-21T01:18:36.000Z","size":202,"stargazers_count":61,"open_issues_count":0,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-02T14:19:08.641Z","etag":null,"topics":["6in4","6to4","gre","ipip","ipv6","ndpresponder","sit","tunnel","tunnelbroker"],"latest_commit_sha":null,"homepage":"https://www.spiritlhl.net/en/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oneclickvirt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"spiritlhl","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"custom":["https://afdian.net/a/spiritlhl"]}},"created_at":"2023-10-24T07:50:27.000Z","updated_at":"2025-02-20T18:26:24.000Z","dependencies_parsed_at":"2024-01-15T15:33:53.873Z","dependency_job_id":"407667f5-b04b-4acb-b60d-39db388ae787","html_url":"https://github.com/oneclickvirt/6in4","commit_stats":null,"previous_names":["oneclickvirt/6in4"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneclickvirt%2F6in4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneclickvirt%2F6in4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneclickvirt%2F6in4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oneclickvirt%2F6in4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oneclickvirt","download_url":"https://codeload.github.com/oneclickvirt/6in4/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244056425,"owners_count":20390719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["6in4","6to4","gre","ipip","ipv6","ndpresponder","sit","tunnel","tunnelbroker"],"created_at":"2024-11-21T16:29:02.127Z","updated_at":"2025-03-17T15:13:21.435Z","avatar_url":"https://github.com/oneclickvirt.png","language":"Shell","funding_links":["https://ko-fi.com/spiritlhl","https://afdian.net/a/spiritlhl"],"categories":[],"sub_categories":[],"readme":"# 6in4\n\n[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Foneclickvirt%2F6in4\u0026count_bg=%2379C83D\u0026title_bg=%23555555\u0026icon=\u0026icon_color=%23E7E7E7\u0026title=hits\u0026edge_flat=false)](https://hits.seeyoufarm.com)\n\n\n\nOne-click forwarding to migrate your IPV6 segments.\n\n[English](README.md) | [中文文档](README_zh.md)\n\nSimilar to https://tunnelbroker.net/ to build your own \"Hurricane Electric Free IPv6 Tunnel Broker\".\n\n## Features\n\n- [x] Self-built IPv6 tunnel for sit/gre/ipip protocols\n- [x] Support to customize the IPV6 subnet size to be cut out, and the appropriate IPV6 subnet information in CIDR format will be calculated automatically.\n- [x] Automatically recognizes the IPV6 subnet size of the server side\n- [x] Will automatically set up the tunnel server and print the commands that the client needs to execute\n- [x] Setting up the IPV6 tunnel is easy to understand and easy to remove\n\n## Environmental Preparation\n\n| VPS(A) | VPS(B) |\n| --------|--------|\n| one IPV4 address (server_ipv4) | one IPV4 address (clinet_ipv4) |\n| one IPV6 subnet | no IPV6 address |\n| Hereafter referred to as server | Hereafter referred to as client |\n\n## Usage\n\nDownload Script\n\n```\ncurl -L https://raw.githubusercontent.com/oneclickvirt/6in4/main/6in4.sh -o 6in4.sh \u0026\u0026 chmod +x 6in4.sh\n```\n\nExecute it\n\n```\n./6in4.sh \u003cclient_ipv4\u003e \u003cmode_type\u003e \u003csubnet_size\u003e \n```\n\nRepeatable, split into multiple subnets, corresponding to different clients (servers), ```client_ipv4``` is required, others are optional\n\nRemember 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.\n\n| Options | Optional Option 1 | Optional Option 2 | Optional Option 3 |\n|--------|--------|--------|--------|\n| \u003cmode_type\u003e | gre | sit | ipip |\n\n| Options | Optional Option 1 | Optional Option 2 | Optional Option 3 |\n|--------|--------|--------|--------|\n| \u003csubnet_size\u003e | 64 | 80 | 112 |\n\n```\u003cmode_type\u003e``` only support those three protocols for now, the more advanced the more recommended, no fill in the default is ```sit``` protocol\n\n```\u003csubnet_size\u003e``` 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```.\n\nDuring script execution, the execution path is automatically switched to ```/root```.\n\nTo 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```.\n\nTo 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.\n\n## Attention\n\n### Tunnel Route Conflicts with Default Route\n\nBecause 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.)\n\n```\ndefault_route=$(ip -6 route show | awk '/default via/{print $3}') \u0026\u0026 [ -n \"$default_route\" ] \u0026\u0026 ip -6 route del default via $default_route dev eth0\n```\n\nThis 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.\n\n### Host Multi-Network Interface\n\nThe 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.\n\nA practical example: https://github.com/oneclickvirt/6in4/issues/2\n\n## Check server status\n\n```\nsystemctl status ndpresponder\n```\n\n```\nip addr show\n```\n\n## Check client status\n\n```\nip addr show\n```\n\n```\ncurl ipv6.ip.sb\n```\n\n## Delete tunnel\n\nserver\n\nexclude\n\n```\ncat /root/6in4_server.log\n```\n\nYou can view the name of the tunnel used, starting with ```server-ipv6-```.\n\n```\nip link set \u003cname\u003e down\nip tunnel del \u003cname\u003e\n```\n\nJust replace the ```\u003cname\u003e``` above with the name you looked up.\n\nclient\n\n```\nip link set user-ipv6 down\nip tunnel del user-ipv6\n```\n\n## Persistent tunnel\n\nSee [https://www.spiritlhl.net/en/guide/incus/incus_custom.html](https://www.spiritlhl.net/en/guide/incus/incus_custom.html) and [https://ipv6tunnel.spiritlhl.top/](https://ipv6tunnel.spiritlhl.top/) for more details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneclickvirt%2F6in4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foneclickvirt%2F6in4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneclickvirt%2F6in4/lists"}