This commit is contained in:
spiritlhl
2024-01-15 13:16:41 +00:00
parent e0c3851302
commit d3d7587876
61 changed files with 2249 additions and 54 deletions

View File

@@ -12,7 +12,7 @@
Documentation for one-click virtualization
一键安装与使用 Proxmox VE、LXD、Docker 的说明文档
一键安装与使用 Proxmox-VE、incus、LXD、Docker 的说明文档
支持中英双语
@@ -22,13 +22,13 @@ Documentation for one-click virtualization
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FspiritLHLS%2Fpve&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)
## 通过LXD命令批量或单独开设NAT服务器以及维护
## LXD相关的各种一键脚本
[https://github.com/spiritLHLS/lxd](https://github.com/spiritLHLS/lxd)
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FspiritLHLS%2Flxd&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)
## 通过docker批量或单独开设NAT服务器
## Docker相关的各种一键脚本
[https://github.com/spiritLHLS/docker](https://github.com/spiritLHLS/docker)

View File

@@ -74,12 +74,12 @@ export default defineConfig({
}
}
},
en_US: {
en: {
lang: 'en-US',
label: 'English',
title: 'One Click Virtualization',
description: 'Open source, easy to use server virtualization project',
link: '/en_US/',
link: '/en/',
themeConfig: {
logo: { src: 'https://raw.githubusercontent.com/spiritlhls/pages/main/logo.png', width: 24, height: 24 },
lastUpdatedText: 'Last Updated',
@@ -88,13 +88,13 @@ export default defineConfig({
pattern: 'https://github.com/oneclickvirt/oneclickvirt.github.io/edit/main/docs/:path',
},
nav: [
{ text: 'One Click Virtualization', link: '/en_US/', activeMatch: '^/en_US/guide/' },
{ text: 'Development Manual', link: '/en_US/developer/index', activeMatch: '^/en_US/developer/' }
{ text: 'One Click Virtualization', link: '/en/', activeMatch: '^/en/guide/' },
{ text: 'Development Manual', link: '/en/developer/index', activeMatch: '^/en/developer/' }
],
sidebar: {
'/en_US/': getGuideSidebarEnUS(),
'/en_US/guide/': getGuideSidebarEnUS(),
'/en_US/developer/': getDeveloperSidebarEnUS()
'/en/': getGuideSidebarEnUS(),
'/en/guide/': getGuideSidebarEnUS(),
'/en/developer/': getDeveloperSidebarEnUS()
},
},
},
@@ -126,36 +126,48 @@ function getGuideSidebarZhCN() {
{
text: 'Proxmox VE',
items: [
{ text: '系统和硬件配置要求', link: '/guide/pve_precheck.html' },
{ text: 'PVE主体安装', link: '/guide/pve_install.html' },
{ text: 'KVM虚拟化', link: '/guide/pve_kvm.html' },
{ text: 'LXC虚拟化', link: '/guide/pve_lxc.html' },
{ text: '自定义', link: '/guide/pve_custom.html' },
{ text: '致谢', link: '/guide/pve_thanks.html' },
{ text: '常见问题答疑', link: '/guide/pve_qa.html' }
{ text: '系统和硬件配置要求', link: '/guide/pve/pve_precheck.html' },
{ text: 'PVE主体安装', link: '/guide/pve/pve_install.html' },
{ text: 'KVM虚拟化', link: '/guide/pve/pve_kvm.html' },
{ text: 'LXC虚拟化', link: '/guide/pve/pve_lxc.html' },
{ text: '自定义', link: '/guide/pve/pve_custom.html' },
{ text: '致谢', link: '/guide/pve/pve_thanks.html' },
{ text: '常见问题答疑', link: '/guide/pve/pve_qa.html' }
]
},
{
text: 'LXD',
text: 'incus',
items: [
{ text: '系统和硬件配置要求', link: '/guide/lxd_precheck.html' },
{ text: 'LXD主体安装', link: '/guide/lxd_install.html' },
{ text: 'LXC虚拟化', link: '/guide/lxd_lxc.html' },
{ text: '更多配置', link: '/guide/lxd_extra_config.html' },
{ text: '自定义', link: '/guide/lxd_custom.html' },
{ text: '致谢', link: '/guide/lxd_thanks.html' },
{ text: '常见问题答疑', link: '/guide/lxd_qa.html' }
{ text: '系统和硬件配置要求', link: '/guide/incus/incus_precheck.html' },
{ text: 'incus主体安装', link: '/guide/incus/incus_install.html' },
{ text: 'LXC虚拟化', link: '/guide/incus/incus_lxc.html' },
{ text: '更多配置', link: '/guide/incus/incus_extra_config.html' },
{ text: '自定义', link: '/guide/incus/incus_custom.html' },
{ text: '致谢', link: '/guide/incus/incus_thanks.html' },
{ text: '常见问题答疑', link: '/guide/incus/incus_qa.html' }
]
},
{
text: 'Docker',
items: [
{ text: '系统和硬件配置要求', link: '/guide/docker_precheck.html' },
{ text: 'Docker主体安装', link: '/guide/docker_install.html' },
{ text: 'Docker虚拟化', link: '/guide/docker_build.html' },
{ text: '自定义', link: '/guide/docker_custom.html' },
{ text: '致谢', link: '/guide/docker_thanks.html' },
{ text: '常见问题答疑', link: '/guide/docker_qa.html' }
{ text: '系统和硬件配置要求', link: '/guide/docker/docker_precheck.html' },
{ text: 'Docker主体安装', link: '/guide/docker/docker_install.html' },
{ text: 'Docker虚拟化', link: '/guide/docker/docker_build.html' },
{ text: '自定义', link: '/guide/docker/docker_custom.html' },
{ text: '致谢', link: '/guide/docker/docker_thanks.html' },
{ text: '常见问题答疑', link: '/guide/docker/docker_qa.html' }
]
},
{
text: 'LXD',
items: [
{ text: '系统和硬件配置要求', link: '/guide/lxd/lxd_precheck.html' },
{ text: 'LXD主体安装', link: '/guide/lxd/lxd_install.html' },
{ text: 'LXC虚拟化', link: '/guide/lxd/lxd_lxc.html' },
{ text: '更多配置', link: '/guide/lxd/lxd_extra_config.html' },
{ text: '自定义', link: '/guide/lxd/lxd_custom.html' },
{ text: '致谢', link: '/guide/lxd/lxd_thanks.html' },
{ text: '常见问题答疑', link: '/guide/lxd/lxd_qa.html' }
]
},
{
@@ -200,42 +212,54 @@ function getGuideSidebarEnUS() {
{
text: 'Pre-requisites for all projects',
items: [
{ text: 'Preparation', link: '/en_US/guide/dashboard.html' }
{ text: 'Preparation', link: '/en/guide/dashboard.html' }
]
},
{
text: 'Proxmox VE',
items: [
{ text: 'Configuration requirements', link: '/en_US/guide/pve_precheck.html' },
{ text: 'PVE main installation', link: '/en_US/guide/pve_install.html' },
{ text: 'KVM Virtualization', link: '/en_US/guide/pve_kvm.html' },
{ text: 'LXC Virtualization', link: '/en_US/guide/pve_lxc.html' },
{ text: 'Custom', link: '/en_US/guide/pve_custom.html' },
{ text: 'Acknowledgements', link: '/en_US/guide/pve_thanks.html' },
{ text: 'FAQ', link: '/en_US/guide/pve_qa.html' }
{ text: 'Configuration requirements', link: '/en/guide/pve/pve_precheck.html' },
{ text: 'PVE main installation', link: '/en/guide/pve/pve_install.html' },
{ text: 'KVM Virtualization', link: '/en/guide/pve/pve_kvm.html' },
{ text: 'LXC Virtualization', link: '/en/guide/pve/pve_lxc.html' },
{ text: 'Custom', link: '/en/guide/pve/pve_custom.html' },
{ text: 'Acknowledgements', link: '/en/guide/pve/pve_thanks.html' },
{ text: 'FAQ', link: '/en/guide/pve/pve_qa.html' }
]
},
{
text: 'LXD',
text: 'incus',
items: [
{ text: 'Configuration requirements', link: '/en_US/guide/lxd_precheck.html' },
{ text: 'LXD main installation', link: '/en_US/guide/lxd_install.html' },
{ text: 'LXC Virtualization', link: '/en_US/guide/lxd_lxc.html' },
{ text: 'Extra configuration', link: '/en_US/guide/lxd_extra_config.html' },
{ text: 'Custom', link: '/en_US/guide/lxd_custom.html' },
{ text: 'Acknowledgements', link: '/en_US/guide/lxd_thanks.html' },
{ text: 'FAQ', link: '/en_US/guide/lxd_qa.html' }
{ text: 'Configuration requirements', link: '/en/guide/incus/incus_precheck.html' },
{ text: 'incus main installation', link: '/en/guide/incus/incus_install.html' },
{ text: 'LXC Virtualization', link: '/en/guide/incus/incus_lxc.html' },
{ text: 'Extra configuration', link: '/en/guide/incus/incus_extra_config.html' },
{ text: 'Custom', link: '/en/guide/incus/incus_custom.html' },
{ text: 'Acknowledgements', link: '/en/guide/incus/incus_thanks.html' },
{ text: 'FAQ', link: '/en/guide/incus/incus_qa.html' }
]
},
{
text: 'Docker',
items: [
{ text: 'Configuration requirements', link: '/en_US/guide/docker_precheck.html' },
{ text: 'Docker main installation', link: '/en_US/guide/docker_install.html' },
{ text: 'Docker Virtualization', link: '/en_US/guide/docker_build.html' },
{ text: 'Custom', link: '/en_US/guide/docker_custom.html' },
{ text: 'Acknowledgements', link: '/en_US/guide/docker_thanks.html' },
{ text: 'FAQ', link: '/en_US/guide/docker_qa.html' }
{ text: 'Configuration requirements', link: '/en/guide/docker/docker_precheck.html' },
{ text: 'Docker main installation', link: '/en/guide/docker/docker_install.html' },
{ text: 'Docker Virtualization', link: '/en/guide/docker/docker_build.html' },
{ text: 'Custom', link: '/en/guide/docker/docker_custom.html' },
{ text: 'Acknowledgements', link: '/en/guide/docker/docker_thanks.html' },
{ text: 'FAQ', link: '/en/guide/docker/docker_qa.html' }
]
},
{
text: 'LXD',
items: [
{ text: 'Configuration requirements', link: '/en/guide/lxd/lxd_precheck.html' },
{ text: 'LXD main installation', link: '/en/guide/lxd/lxd_install.html' },
{ text: 'LXC Virtualization', link: '/en/guide/lxd/lxd_lxc.html' },
{ text: 'Extra configuration', link: '/en/guide/lxd/lxd_extra_config.html' },
{ text: 'Custom', link: '/en/guide/lxd/lxd_custom.html' },
{ text: 'Acknowledgements', link: '/en/guide/lxd/lxd_thanks.html' },
{ text: 'FAQ', link: '/en/guide/lxd/lxd_qa.html' }
]
},
{
@@ -252,7 +276,7 @@ function getDeveloperSidebarEnUS() {
{
text: 'Development Manual',
items: [
{ text: 'l10n', link: '/en_US/developer/l10n.html' }
{ text: 'l10n', link: '/en/developer/l10n.html' }
]
}
]

View File

@@ -0,0 +1,475 @@
---
outline: deep
---
# Attach free IPV6 address segments to host machines
Some machines don't have an IPV6 /64 subnet on the machine itself, here is a method given to attach an IPV6 subnet for free.
Here is a solution using the 6in4 method for a host machine that doesn't have an IPV6 address on its own.
:::tip
The operations on this page must be performed on the original system, and ensure that no other scripts from this project are installed(Except for PVE, which needs to be installed first), as this may lead to environment conflicts.
:::
Here are the platforms that are currently running in 2023 that offer IPV6 subnets for free.
| Supported Platforms | Corresponding Required Installation Packages | Protocols | Number of Channels/Subnets
|---------------------------|----------------|----------------|----------------|
| tunnelbroker.net | ifupdown OR ifupdown2 | v4tunnel OR sit | 3✖/64 或 5✖/64 |
| tunnelbroker.ch | ifupdown OR ifupdown2 | v4tunnel OR sit | 3✖/64 |
| ip4market.ru | ifupdown OR ifupdown2 | v4tunnel OR sit | 1✖/64 |
| netassist.ua | ifupdown OR ifupdown2 | v4tunnel OR sit | 1✖/64 |
| https://github.com/oneclickvirt/6in4 | ifupdown2 | sit、gre、ipip | 自定义 |
The free platform only solves the problem that IPV6 is not available, it does not provide premium IPV6 bandwidth.
If you need high quality bandwidth, please build your own tunnel. When both ifupdown and ifupdown2 are available, try ifupdown first to see if it can be installed successfully, otherwise install ifupdown2.
After the installation is complete, select which package is installed behind to convert the format.
## Initial environment modifications
Execute
```
touch /etc/cloud/cloud-init.disabled
```
Turn off the automated overwrite of cloud-init first, and then to see what the local machine is using to manage the network, run
```
systemctl is-active systemd-networkd
```
and
```
systemctl is-active networking
```
See which case this falls into, if it's the former active and the latter inactive, you need to reinstall/DD a system that isn't configured this way, or switch the local machine to use ifupdown/ifupdown2 to manage network execution
```
# Judge for yourself whether you need to disable the original network management or not
# systemctl stop systemd-networkd
# systemctl disable systemd-networkd
# systemctl stop systemd-networkd.socket
# systemctl disable systemd-networkd.socket
```
If you want to install ```ifupdown``` to control the network, this tool is available on all major linux systems.
```
apt-get install ifupdown -y
```
If you want to install ```ifupdown2``` for network management, which is generally only available on debian systems, you can install
```
apt-get install ifupdown2 -y
```
After the installation is complete, select which package is installed behind to convert the format.
```
systemctl start networking
systemctl enable networking
```
Then restart the server, check whether the machine's network will be rebooted due to the modification of the case of loss of connection, and run```uptime```to observe that the startup has been more than 1 minute before proceeding to the next steps
If it is inactive and active, there is no need to switch the network management program and you can proceed directly to the next step.
Since some servers have default intranet IPV6 routes that will conflict with the tunnel, you can use the following command to remove the default IPV6 routes
```
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```, 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 according to this rule
## tunnelbroker_net
Combined with a script that opens containers with IPV6 addresses with a single click, you can attach an IPV6 address from he to each container
The downside is that the addresses are dark/dirty, and cloudflare's cdn will most likely not be able to latch on, test it yourself
1. Register an account at [https://tunnelbroker.net/](https://tunnelbroker.net/) and click```Create Regular Tunnel```on the left.
![1](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/35923be5-821f-45c8-8401-962ea3f97726)
2. Fill in your server's IPV4 address in the red box, choose a connection point that is physically close to your server, for example, if your machine is in Los Angeles, choose a connection point on the west coast of the United States, and then click```Create Tunnel```to create the tunnel when you are prompted by the green box!
![2](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/cab04113-4d6a-4d6f-9952-d3851057fc4a)
![3](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/518dc62a-c8d0-48e3-bb13-befc39348990)
![4](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/6188de3f-e83c-400e-9594-dd3f73aaf46a)
3. Wait for the following screen, click```Example Configurations```and select the corresponding system, for example, the host of incus is definitely Debian/Ubuntu.
![5](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/9f0045fc-b1ac-4954-9ecd-1fba47d07d8a)
![6](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/2fb7c951-371c-452c-b775-78f69b980a2c)
4. The boxed part is the file to be modified and the content to be filled in.
![7](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/c0156902-b4c0-4001-823e-50f611215393)
5. Exchange the format of the command then add IPV6 settings to your network configuration file.
Then open [https://ipv6tunnel.spiritlhl.top/](https://ipv6tunnel.spiritlhl.top/) and select```Option```for```TunnelBrokerNet```, another drop-down selection box to choose the name of the package you successfully installed previously, then paste what you copied in the input box.
Then click```Covert```to convert the format, and wait for the page to refresh to show the converted configuration file.
Then use vim or vi to modify the```/etc/network/interfaces```file to add content, or modify the following command to add new content
```
tee -a /etc/network/interfaces <<EOF
# Here, copy and paste the contents of the configuration file in the red box, and then run this command.
EOF
```
Then you can use```cat /etc/network/interfaces```to see if the configuration file is written correctly.
6. If all of the above is OK, then you need to enable the network interfaces
```
apt-get install net-tools iproute2 -y
systemctl restart networking
```
7. Then you can test the IP address of the network interface.
Execute the```ifconfig```command, and there should be a he-ipv6 interface, similar to the following:
![8](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/1760af85-2b60-4352-ad8c-3c69e49fc1e4)
Or execute:
```
curl ipv6.ip.sb
```
Returns the IPV6 address you bound to
8. Additional settings for NAT VPS
IPv4 NAT VPS may require some additional settings beyond the IP replacement operation mentioned earlier, otherwise it may still not be able to access the IPv6 network.
```
apt-get install ufw -y
ufw allow 41
```
Add the relevant routing rules
```
route -A inet6 add ::/0 dev he-ipv6
```
9. If the IPV6 network is no longer needed and you want to delete it, delete the he-ipv6 network interface configuration.
If you want to delete the he-ipv6 network interface configuration (if not, it will be enabled automatically after reboot), remember to modify the```/etc/network/interfaces```file to remove the content added in the red box before.
Then reboot the server to remove the
## tunnelbroker_ch
Similar to the above, first register an account at [https://www.tunnelbroker.ch/](https://www.tunnelbroker.ch/) and click on the activation email after registering.
Then you have to fill in the IPV4 address of your server.
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/e018c7bc-e73c-4c68-88b6-b073f0dbd150)
After creating an account, you need to go to the Config page instead of the details page.
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/d919dda7-571d-45b1-9d2f-03f29866269e)
Don't use the following page, first refresh the page without the light blue box and then stop refreshing it
Don't stop refreshing after the light blue box pops up
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/aefd1477-d5f5-4a4e-a66c-80ef5f9250c6)
Record the content of the last red box on the following page, and prepare to modify the host configuration file.
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/9329974c-9549-4ff2-a8a0-a53c00e2863d)
Copy the last red box of the page without the blank lines.
Then open [https://ipv6tunnel.spiritlhl.top/](https://ipv6tunnel.spiritlhl.top/) and select```Option```for```TunnelBrokerCh```, another drop-down selection box to choose the name of the package you successfully installed previously, then paste what you copied in the input box.
Then click```Covert```to convert the format, and wait for the page to refresh to show the converted configuration file.
Then use vim or vi to modify the```/etc/network/interfaces```file to add content, or modify the following command to add new content
```
tee -a /etc/network/interfaces <<EOF
# Modify the
EOF
```
Then you'll need to reboot the system a bit, or run
```
apt-get install net-tools iproute2 -y
systemctl restart networking
```
Make sure the environment is OK before you do anything else
## ip4market_ru
Similar to the above, first register an account at [https://tb.ip4market.ru](https://tb.ip4market.ru/), the registered email address must be an unseen email address, the phone number can be written randomly without verification, and the IP address should be the IPV4 address of the host you want to attach.
The IP address is the IPV4 address of the host computer you are attaching to![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/24df37f2-12fe-49b6-87df-f07213346fbe)
Then you have to go through Recaptcha's human-machine verification, and click register.
You will receive an activation email with your password, memorize it.
Then login on the homepage
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/38b3f5a7-a5e1-47e0-b13e-8570e946c61c)
Then you will be taken to this page
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/fc1d38b9-b45a-41de-a931-5dbe96e9791c)
Hold down the right button and copy the four lines framed in red, which are
```
Server IPv4.
Client IPv4
Server IPv6
Client IPv6
```
For these four lines, press ctrl+c to copy or right-click to copy
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/69c946e6-e82f-4665-b3c1-3c97e27f8487)
Then open [https://ipv6tunnel.spiritlhl.top/](https://ipv6tunnel.spiritlhl.top/) and select```Option```for```ip4market```, another drop-down selection box to choose the name of the package you successfully installed previously, then paste what you copied in the input box.
Then click```Covert```to convert the formatting
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/b9ca3ee1-4f13-4e10-bdc8-1ed1cc23ab05)
Then the page will be refreshed automatically and you need to modify the contents of the```/etc/network/interfaces```file with vim or vi commands, or modify the following commands to add new contents.
```
tee -a /etc/network/interfaces <<EOF
# Modify the
EOF
```
Then you'll need to reboot the system a bit, or run
```
apt-get install net-tools iproute2 -y
systemctl restart networking
```
Make sure the environment is OK before you do anything else
## netassist_ua
Similar to the above operation, first in [https://tb.netassist.ua/](https://tb.netassist.ua/) register an account first, after registration, click on the activation of the mail, the activation page will have a password display, remember to record!
Then fill in the IPV4 address of your server, you can change it later, just fill in a random one first.
Then you will get to this page
![a](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/4af680d4-3b01-495a-91d1-3cf4f187d0df)
The first red box is the location of your host's IPV4 address, if you want to modify it, modify it there, and then click change to save.
The second red box is for```Linux``, and then click on show
![b](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/099d43a0-0397-4e02-9275-9ec3099c0ff1)
The above content will appear, copy all the boxed parts without blank lines.
Then open [https://ipv6tunnel.spiritlhl.top/](https://ipv6tunnel.spiritlhl.top/) and select```Option```for```NetAssist```, another drop-down selection box to choose the name of the package you successfully installed previously, then paste what you copied in the input box.
Then click on```Covert```to convert the formatting
![c](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/7324c7ff-d22f-4c17-b3c2-b5338ca6dfee)
Then the page will be refreshed automatically and you need to modify the contents of the```/etc/network/interfaces```file with vim or vi commands, or modify the following commands to add new contents.
```
tee -a /etc/network/interfaces <<EOF
# Modify the
EOF
```
Then you'll need to reboot the system a bit, or run
```
apt-get install net-tools iproute2 -y
systemctl restart networking
```
Make sure the environment is OK before you do anything else
## Transfer IPV6 subnets between different servers
Related repository: [https://github.com/oneclickvirt/6in4](https://github.com/oneclickvirt/6in4)
This method will provide a way to split a /80 out of the IPV6 segment on A and attach it to B to use.
### 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>
```
| Options | Optional Option 1 | Optional Option 2 | Optional Option 3 |
|--------|--------|--------|--------|
| <mode_type> | gre | sit | ipip |
| <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 you don't fill it in, it defaults to ```80```.
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.
To prevent you from forgetting to copy the commands, the commands themselves will be written to the ```6in4.log``` file under the current path, you can use ```cat 6in4.log``` to query the commands that need to be executed on the client side
For copied commands, be sure to select option ``6in4`` in [https://ipv6tunnel.spiritlhl.top/](https://ipv6tunnel.spiritlhl.top/) before converting!
Then the page will be refreshed automatically and you need to modify the contents of the```/etc/network/interfaces```file with vim or vi commands, or modify the following commands to add new contents.
```
tee -a /etc/network/interfaces <<EOF
# Modify here
EOF
```
Then you'll need to reboot the system a bit, or run
```
apt-get install net-tools iproute2 -y
systemctl restart networking
```
Make sure the environment is OK before you do anything else
### Check server status
```
systemctl status ndpresponder
```
```
ip addr show
```
### Check client status
```
ip addr show
```
```
curl ipv6.ip.sb
```
### Delete tunnel
server
```
ip link set server-ipv6 down
ip tunnel del server-ipv6
```
client
```
ip link set user-ipv6 down
ip tunnel del user-ipv6
```
The above deletion is only temporary, for permanent deletion you must modify and delete the contents of the ``/etc/network/interfaces`` file that you have previously added.
### one more thing
In fact [https://tunnelbroker.net/](https://tunnelbroker.net/) supports the application of IPV6 subnets of size ```/48```
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/07987e41-0158-430c-bcc5-f7cd8652b2c4)
Make the request here, then when converting the format change the original ```/64``` IPV6 address to a ```/48``` IPV6 address and you'll get a larger IPV6 subnet!

View File

@@ -0,0 +1,117 @@
---
outline: deep
---
# Custom Configuration
:::tip
The following configurations may increase the load on the server. Only install them if necessary.
:::
:::tip
If you are using the server for personal use, you can ignore the installation of some abuse prevention scripts.
:::
## Automatic IPV6 Address Configuration
- (Optional, not required if not using)
- **This script is only suitable for servers that have an ```IPV6``` subnet with a prefix, and the server has bound the ```first IP``` of the subnet as its ```IPV6 address or IPV6 gateway```.**
- Automatically configures ```IPV6``` addresses for incus containers created with incus.
- Integrated into ```buildone.sh``` and can be controlled by variables without needing to be downloaded beforehand. You don't need to manually use this script; when using ```buildone.sh```, configure with variable Y to enable it.
Download Script
Command:
```bash
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/build_ipv6_network.sh -o build_ipv6_network.sh && chmod +x build_ipv6_network.sh
```
Automatically configure IPV6 mapped addresses for containers
```bash
bash build_ipv6_network.sh Container_Name(change_me)
```
A message is printed when the mapping is complete (Default mapping without iptables)
Example (automatically configure the test container with an IPV6 address, a test_v6 file is written when the configuration is complete)
```bash
bash build_ipv6_network.sh test
```
**PS: Add ipv6 processing can choose whether to use ip6tables for mapping, the default is not to use ip6tables for mapping but to add new network devices for mapping**.
Use ip6tables for mapping
```bash
bash build_ipv6_network.sh Container_name Y
```
If ip6tables is used for mapping, remove all IPV6 mapped rules available:
```bash
ip6tables -t nat -F PREROUTING
ip6tables-legacy -t nat -F PREROUTING
ip6tables-save > /etc/iptables/rules.v6
netfilter-persistent save
netfilter-persistent reload
service netfilter-persistent restart
```
Uninstall the IPV6 address binding daemon and corresponding files
```shell
systemctl stop add-ipv6.service
systemctl disable add-ipv6.service
rm /etc/systemd/system/add-ipv6.service
systemctl daemon-reload
rm /usr/local/bin/add-ipv6.sh
```
## Blocking Ingress/Egress Traffic on Easily Abused Ports and Filtering Out Port Scanning and Exploitation Toolkits
- (***Optional***, this script is solely for preventing container abuse and is not mandatory to install.)
- Precautionary Measures
Command:
```shell
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/rules.sh -o rules.sh && chmod +x rules.sh && bash rules.sh
```
## Use the 'screen' command to configure monitoring and blocking of certain processes' commands: terminate containers immediately upon the appearance of specific processes.
- To stop monitoring, you can use the 'screen' command to stop the window named 'lxc_monitor' and delete it.
- (***Optional***, this script is only for preventing misuse of containers; it's fine not to install it.)
- Shutdown afterwards.
Command:
```shell
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/build_monitor.sh -o build_monitor.sh && chmod +x build_monitor.sh && bash build_monitor.sh
```
## One-click Installation of Common Pre-configured Environment for incus Hosts with vnstat Integration
- (***Optional***, this script is only for easy monitoring integration with the site, it's fine if you choose not to install)
Command:
```shell
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/backend.sh -o backend.sh && chmod +x backend.sh && bash backend.sh
```
## One-Click Installation of Cockpit Visualization Panel for Mother Hen
- (***Optional***, this panel is just for convenient visualization operations, it's okay if not present)
- Original author's repository: [Link](https://github.com/turtle0x1/incusMosaic)
```shell
incus config set core.https_address [::]
incus config set core.trust_password some-secret-string
snap install incusmosaic
```
After the installation is complete, open the hen IP address, follow the prompts to set the password for admin, other all the way to the default will be able to use the panel!

View File

@@ -0,0 +1,96 @@
---
outline: deep
---
# incus Installation Guide
If your host does not have an IPV6 subnet and you want to assign IPV6 addresses to containers, then please check the ``Customize`` partition in the ``incus`` module for the ``Attach a free IPV6 address segment`` to the host, and attach an IPV6 subnet to the host before installing the environment.
## One-Click Installation
:::warning
If this is a new server, make sure that both 'apt update' and 'apt install curl' are working properly before executing this script.
:::
:::tip
It's recommended to wait for at least 5 minutes after the system boots up before executing the following commands. This is to avoid the script being executed by the default system settings, which could cause issues with apt sources.
:::
- Prerequisites: Ubuntu 18+ (recommended), Debian 8+ (x86_64 architecture only)
**If you are on a Debian-based host, be sure to execute this script within a 'screen' session to prevent ZFS compilation installation failure due to SSH interruptions during long-term runs.**
The virtual memory mentioned here refers to the desired SWAP size, and the storage pool represents the total size of all disks allocated for your virtual machines.
During the environment installation process, **you might need to restart the server to load the kernel with ZFS support and then execute the installation command again. Follow the prompts in the command line after running for accurate instructions.**
Enable the lxcfs-related configuration of incus by default, so that in-container querying of container information changes to information about the container itself rather than the host.
If the script prompts you to restart the system and execute the script again, and if the second execution still requires a system restart to load the kernel, it means the kernel loading failed during the previous attempt. It's recommended to reinstall the host system using an Ubuntu-based version to resolve this issue.
Each time you run the script, you'll need to input the initialization configuration. So, if the script prompts you to restart the system and execute again, you'll need to input the initialization configuration again.
Command:
```shell
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/incus_install.sh -o incus_install.sh && chmod +x incus_install.sh && bash incus_install.sh
```
Example of initialization configuration:
If there is 18GB of unused disk space on the system disk, after deducting the space already occupied, and you want to allocate 2GB of virtual memory (2048MB of SWAP) and a 15GB storage pool, then following the prompts in the command line, enter ```2048``` and ```15```.
## Manual Installation
Recommended for beginners to avoid potential troubleshooting. However, if you're experienced and comfortable with debugging bugs, you can also use the later one-click installation method for convenience.
### Disable Firewall
```bash
apt update
apt install curl wget sudo dos2unix ufw jq -y
ufw disable
```
### Enabling Virtual Memory SWAP
The amount of memory depends on how many instances you want to run. If you want to run 8 instances and calculate, you'll need 2GB of memory. If your actual physical memory is 512MB, you'll need an additional 1.5GB. To be cautious, allocate 2GB of virtual memory.
Execute the following commands: Enter '1', then enter '2048'. This signifies allocating 2GB of virtual memory.
Command:
```shell
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/swap.sh -o swap.sh && chmod +x swap.sh && bash swap.sh
```
### Installing incus
Actually, the virtual memory allocated for swap should be twice the size of the actual memory. So, it's reasonable to allocate 1GB if the actual memory is 500MB. The scenario I described above is an excessive allocation.
```
apt install snapd -y
snap install incus
incus init
```
If the following error occurs in the above command
(snap "incus" assumes unsupported features: snapd2.39 (try to update snapd and refresh the core snap))
Use the command patch before installing incus
```
snap install core
```
If there are no exceptions, the results of the above three lines of commands are as follows
![图片](https://user-images.githubusercontent.com/103393591/233270028-5a43d0f7-45f5-4175-969e-d4d182cb877a.png)
Just enter the default for the normal options
Choose the size of the physical disk (hint: select the default option with a minimum of 1GB). Generally, I fill in the available disk space minus the memory size, then multiply by 0.95 and round down. Here, I entered 10GB.
Remember to select 'no' for options containing 'auto' when prompted to update the image, in order to avoid occupying the system.

View File

@@ -0,0 +1,273 @@
---
outline: deep
---
# incus virtualization
## Generate only one NAT server
- Generate only one NAT server, with customizable restrictions on all content.
Downloading the boot script is **NOT REQUIRED**, if you have used the command to install incus with one click, the corresponding boot script will be downloaded automatically, so you don't need to download the script again.
Command:
```shell
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/buildone.sh -o buildone.sh && chmod +x buildone.sh && dos2unix buildone.sh
```
### Usage
```
. /buildone.sh name Cpu_num Memory_size Hard_disk_size SSH_port Extranet_start_port Extranet_stop_port Download_speed Upload_speed Whether_IPV6_is_enabled(Y or N) System(leave blank for debian11)
```
Memory size is calculated in MB, hard disk size is calculated in GB, download speed upload speed is calculated in Mbit, whether to enable IPV6 does not have to fill in Y or N, no this parameter can also be left blank default does not enable IPV6
If ```external start port`` and ```external stop port`` are both set to 0, then we don't do interval port mapping, only the basic SSH port is mapped, note that ```can't be null``, and it needs to be set to 0 if it's not to be mapped.
Support for customizing the system of the server, do not fill out the default use of debian11 when left blank, note that the incoming parameters for the system name + version number, such as:
- debian10, debian11, debian12
- ubuntu18, ubuntu20, ubuntu22
- centos8, centos9 (actually opened out of the Stream version)
- alpine3.15, alpine3.16, alpine3.17, alpine3.18
- openwrt21openwrt22fedora37fedora38fedora39
- rockylinux8rockylinux9oralce8oracle9
- oralce7centos7 (CGroupV1 needs to be enabled in GRUB or it won't start.)
- kaliarchlinux
* Note that the combination of lowercase letters + numbers or only lowercase letters, try it yourself, if the search is not the system will automatically exit the script
* The version number can be with English decimal point, in order to adapt to the alpine version number has been supported.
* If you can't open it, it may be that the hard disk is not big enough or it doesn't fit the host, try it by yourself.
:::tip
The version number has ended the long-term maintenance of the general no longer have an official mirror, temporarily did not find the archive address of the historical mirror, if you find welcome to leave a message I will add support!
:::
### Example
Here is the information about the example chick that is being raised:
| Attribute | Value |
|-----------------------------|-----------------|
| server's Name | test |
| Username for SSH Login | root |
| Password for SSH Login | Randomly generated |
| Number of CPU Cores | 1 |
| Memory Size | 256MB |
| Disk Size | 2G |
| Range of Internal and External Port Mapping | 20002 to 20025 |
| Upload Bandwidth | 500Mbit |
| Download Bandwidth | 500Mbit |
| Automatically Set External IPv6 Address | No |
| Operating System | Debian 11 |
```
./buildone.sh test 1 256 2 20001 20002 20025 500 500 N
```
If you need to see the information, run
```shell
cat ct_name_change_me
```
For example, the information for the query example is
```shell
cat test
```
If you have already generated chicks through the above methods and still need to batch generate chicks, you can use a customized batch generation version of the script, but note that you should first delete the test chicks before batch generating chicks
### Delete Test Chick
```shell
incus stop test
incus delete test
rm -rf test
rm -rf test_v6
ls
```
## Normal version batch generation
Opened Chick Configuration:
- 1 core 256MB RAM 1GB hard disk limited to 300Mbit bandwidth
- With 1 SSH port, 25 extranet ports
- Default memory and hard disk size
:::tip
incus if the command is no problem, the execution of the initialization of the opening of the servers, this step is best to put ```screen`` in the background to suspend the execution of the opening of the servers, the length of time with you to open a few and the mother hen configuration-related
:::
Execute the following command to load the boot script
Command:
```shell
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/init.sh -o init.sh && chmod +x init.sh && dos2unix init.sh
```
The following command opens **10** chicks with the name prefix **tj**.
```shell
./init.sh tj 10
```
Sometimes there is a problem with the path where init.sh is run, in this case it is recommended to add sudo in front of it to force it to run in the root directory
## Bulk generation of pure SSH port versions
Opened Chick Configuration:
- 1 core 128MB RAM 300MB hard disk limited to 300Mbit bandwidth
- Only one SSH port
- Unable to mount warp
:::tip
incus if the command is no problem, the execution of the initialization of the opening of the chick, this step is best to put the ```screen`` in the background to hang the execution of the opening of the chick, the length of time you open the chick with the opening of a few and the mother hen configuration-related
:::
Load boot script
Command:
```shell
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/least.sh -o least.sh && chmod +x least.sh && dos2unix least.sh
```
The last line of the following command opens **10** chicks with the chick name prefix **tj**
```shell
./least.sh tj 10
```
Sometimes there is a problem with the path where last.sh is run, in this case it is recommended to force the root directory to run by adding sudo in front of it.
## Custom Batch Generation of Versions
- Customizable memory and hard disk sizes
- It's also fine if you have manually executed the above batch generation before; the configuration inherits without overwriting
If you need to batch-generate servers multiple times, you can use the following:
Command:
```
curl -L https://github.com/oneclickvirt/incus/raw/main/scripts/add_more.sh -o add_more.sh && chmod +x add_more.sh && bash add_more.sh
```
Can be run multiple times to batch generate chicks, and inherit the previous part has been generated in the back to add, customizable memory and hard disk size
## View the information of the batch opened chicks
After opening the chicks, the specific information will be generated in the log file in the current directory, with the following format
```shell
Server_1_Name Password SSH_Port Public_Port_Start Public_Port_End
Server_2_Name Password SSH_Port Public_Port_Start Public_Port_End
```
To view it, simply print the log file by executing the following command in the current directory
```shell
cat log
```
:::warning
Don't use the chicks opened by this script as a production environment, incus virtualization doesn't support changing kernel, dd, turning on bbr, etc.
:::
## Some common incus commands
View all containers:
```bash
incus list
```
View details of a specific container:
```bash
incus info container_name
```
Start a specific container:
```bash
incus start container_name
```
Stop a specific container:
```bash
incus stop container_name
```
Delete a specific container:
```bash
incus delete -f container_name
```
Enter the container's shell:
```bash
incus exec container_name /bin/bash
```
:::tip
Instead of /bin/bash, you can use /bin/sh in alpine, which is /bin/bash on regular systems.
:::
To exit, type ```exit`` and enter.
Delete all incus containers
```bash
incus list -c n --format csv | xargs -I {} incus delete -f {}
```
Perform deletion of useless logs within a container
```bash
sudo apt-get autoremove
sudo apt-get clean
sudo find /var/log -type f -delete
sudo find /var/tmp -type f -delete
sudo find /tmp -type f -delete
sudo find /var/cache/apt/archives -type f -delete
```
## Update all commands related to the above one-click scripts
Delete the original configuration script
```bash
rm -rf /usr/local/bin/ssh_sh.sh
rm -rf /usr/local/bin/config.sh
rm -rf /usr/local/bin/ssh_bash.sh
rm -rf /usr/local/bin/check-dns.sh
rm -rf /root/ssh_sh.sh
rm -rf /root/config.sh
rm -rf /root/ssh_bash.sh
rm -rf /root/buildone.sh
rm -rf /root/add_more.sh
rm -rf /root/build_ipv6_network.sh
```
Download back the relevant configuration scripts for the new version
```bash
wget https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/check-dns.sh -O /usr/local/bin/check-dns.sh && chmod +x /usr/local/bin/check-dns.sh
wget https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/config.sh -O /usr/local/bin/config.sh && chmod +x /usr/local/bin/config.sh
wget https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/ssh_bash.sh -O /usr/local/bin/ssh_bash.sh && chmod +x /usr/local/bin/ssh_bash.sh
wget https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/ssh_sh.sh -O /usr/local/bin/ssh_sh.sh && chmod +x /usr/local/bin/ssh_sh.sh
wget https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/build_ipv6_network.sh -O /root/build_ipv6_network.sh && chmod +x /root/build_ipv6_network.sh
wget https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/buildone.sh -O /root/buildone.sh && chmod +x /root/buildone.sh
```
Just download the other one-click scripts yourself.

View File

@@ -0,0 +1,52 @@
---
outline: deep
---
# Preface
The following is the introduction of the non-customized part, the customized part has its own corresponding introduction, do not get confused!
If your host does not have an IPV6 subnet and you want to assign IPV6 addresses to containers, then please check the ``Customize`` partition in the ``incus`` module for the ``Attach a free IPV6 address segment`` to the host, and attach an IPV6 subnet to the host before installing the environment.
## Requirements
Hardware requirements.
- System: Debian 8+, Ubuntu 18+ (20.04 recommended).
- Virtualization: KVM, VMWARE recommended.
- Memory: At least 512MB of RAM
- Hard disk: hard disk (system disk) at least 10G
- Network: Independent IPV4 address, IPV6 is optional, bandwidth can download scripts on the line, the network can connect to the Github raw page on the line
PS: If the hardware is very good and has a lot of resources, you can use PVE to batch open KVM virtualized VMs [Jump](https://github.com/spiritLHLS/pve)
PS: If the hardware resources are even worse, virtualization is not supported, you can use the docker version, the adaption surface is wider [Jump](https://github.com/spiritLHLS/docker)
## Project Features
- This set of script development using **Ubuntu20**, Ubuntu other long-term maintenance version should also be no problem, Debian can not use zfs automatically switch to another storage type!
- Set up both TCP and UDP forwarding, in addition to SSH ports, other mapping intranet and extranet ports are the same.
- Support for docker nested virtualization of open incus containers has been set up, and the default normal version and pure probe version use the debian11 system.
- lxcfs has been set to be enabled by default, so that querying resources within a container uses the configured view rather than the host's view
- Have blocked the container may be used to abuse the toolkit and IPV4 network TCP/UDP protocol ports ( 3389 8888 54321 65432 ), to prevent the container is used for scanning and blasting, and can be external process checking for problems automatically shut down
- Has supported one-click configuration of IPV6 addresses for incus containers (provided that the mother hen has an IPV6 subnet, no IPV6 address is not configured), automatically adapted to the size of the subnet
- Ensure that the disk you want to open is the default system disk (sda or sda1) and not the mounted disk (sdb and so on), if you are not sure, use ``fdisk -l`` and ``df`` to check.
- See [Other notes](https://github.com/oneclickvirt/incus/blob/main/README_other.md) for details on mounting other disks.
- One-click scripts support custom restrictions on all content, the normal version supports multiple runs of the batch generation does not overwrite the previously generated configuration
## Detecting the environment
**Use the subsequent script must execute this command to detect the hen whether it meets the requirements**
Command:
```
bash <(wget -qO- --no-check-certificate https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/pre_check.sh)
```

View File

@@ -0,0 +1,35 @@
---
outline: deep
---
## Solve the puzzle
## What to do if you open centos7 and find that CGroupV1 is not supported?
Enable CGroup V1: To enable CGroup V1 on an Ubuntu system, you need to edit the kernel boot parameters.
Please note that before changing kernel boot parameters, make sure to backup important data and settings to prevent unexpected problems.
Edit the ```/etc/default/grub`` file and add ``systemd.unified_cgroup_hierarchy=0`` to the end of the parameters in ``GRUB_CMDLINE_LINUX_DEFAULT``, just like:
```
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash systemd.unified_cgroup_hierarchy=0"
```
Save the file and run the following command to update the GRUB boot.
```bash
sudo update-grub
```
Reboot the system for the changes to take effect
If the above changes still do not support the opening of centos7, try using a different host system.
## Currently verified VPS vendors that can open containers with separate IPV6 addresses.
[kuroit](https://my.kuroit.com/aff.php?aff=5) Phoenix, USA regular
[datalix](https://t.me/vps_reviews/338) German AMD Promotions
[luxvps](https://billing.luxvps.xyz/aff.php?aff=36) German AMD Promotions

View File

@@ -0,0 +1,19 @@
## Acknowledgements
https://github.com/lxc/lxd
https://lxdware.com/
https://discuss.linuxcontainers.org/
https://discuss.linuxcontainers.org/t/how-to-run-docker-inside-lxc-container/13017/4
https://discuss.linuxcontainers.org/t/error-seccomp-notify-not-supported-on-container-start/15038/3
https://discuss.linuxcontainers.org/t/how-do-i-assign-a-public-ipv6-address-to-a-lxc-container/6028
https://github.com/turtle0x1/LxdMosaic
https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/index.html
https://github.com/SuperManito/LinuxMirrors

View File

@@ -0,0 +1,436 @@
---
outline: deep
---
# 给宿主机附加免费的IPV6地址段
有的机器本身没有IPV6的/64子网这里给出一个方法免费附加IPV6的子网。
这里是使用6in4方法解决宿主机本身没有IPV6地址的问题。
:::tip
本页面的操作务必在原始系统上操作,保证未使用本项目的其他脚本安装环境(除了PVEPVE需要先安装好),否则可能导致环境冲突
:::
以下是2023年目前还在运行的免费提供IPV6子网的平台
| 支持的平台 | 对应需要的安装包 | 协议 | 通道/子网数量 |
|---------------------------|----------------|----------------|----------------|
| tunnelbroker.net | ifupdown 或 ifupdown2 | v4tunnel 或 sit | 3✖/64 或 5✖/64 |
| tunnelbroker.ch | ifupdown 或 ifupdown2 | v4tunnel 或 sit | 3✖/64 |
| ip4market.ru | ifupdown 或 ifupdown2 | v4tunnel 或 sit | 1✖/64 |
| netassist.ua | ifupdown 或 ifupdown2 | v4tunnel 或 sit | 1✖/64 |
| https://github.com/oneclickvirt/6in4 | ifupdown2 | sit、gre、ipip | 自定义 |
免费的平台只解决IPV6有没有的问题不提供优质的IPV6带宽。
如需优质的带宽请自建隧道当ifupdown和ifupdown2都可时先尝试ifupdown是否可安装成功否则就安装ifupdown2.
安装完毕后,安装了哪个包后面就选择哪个包进行格式转换。
## 初始环境修改
执行
```
touch /etc/cloud/cloud-init.disabled
```
关闭cloud-init的自动化覆写先然后查看本机使用什么管理网络执行
```
systemctl is-active systemd-networkd
```
```
systemctl is-active networking
```
看看属于哪种情况如果是前者active后者inactive你需要重装/DD一个不是这样配置的系统或者切换本机使用ifupdown/ifupdown2管理网络
```
# 是否需要禁用原网络管理自行评判
# systemctl stop systemd-networkd
# systemctl disable systemd-networkd
# systemctl stop systemd-networkd.socket
# systemctl disable systemd-networkd.socket
```
如果需要安装的是```ifupdown```控制网络这个工具一般的主流linux系统都有
```
apt-get install ifupdown -y
```
如果需要安装的是```ifupdown2```进行网络管理而这个工具一般只在debian系上可安装使用
```
apt-get install ifupdown2 -y
```
安装完毕后,安装了哪个包后面就选择哪个包进行格式转换。
```
systemctl start networking
systemctl enable networking
```
然后重启服务器,检验机器的网络是否会因为修改出现重启失联的情况,且执行```uptime```观察启动已超过1分钟后再进行后续步骤
如果是是前者inactive后者active则不需要切换网络管理程序直接进行后续操作即可。
由于部分服务器存在默认的内网IPV6路由会与隧道冲突此时可使用以下命令删除默认的IPV6路由
```
default_route=$(ip -6 route show | awk '/default via/{print $3}') && [ -n "$default_route" ] && ip -6 route del default via $default_route dev eth0
```
这里假设了你的客户端的服务器的默认网卡是```eth0```,你可以使用```ip -6 route```查看默认的路由并替换它,默认路由以```default via```开头,使用```dev```指定默认网卡,你只需要按照这个规则找到它即可
## tunnelbroker_net
结合一键开设带IPV6地址的容器的脚本就能给每个容器附加来自he的IPV6地址了
缺点是地址比较黑/脏cloudflare的cdn极有可能套不上自行测试
1. 在 [https://tunnelbroker.net/](https://tunnelbroker.net/) 注册账户,并点击左边的 ```Create Regular Tunnel```
![1](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/35923be5-821f-45c8-8401-962ea3f97726)
2. 红框处填写你的服务器的IPV4地址选择物理距离近的连接点比如机器在美国洛杉矶就选美国西海岸的连接点然后显示绿框提示点```Create Tunnel```创建即可
![2](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/cab04113-4d6a-4d6f-9952-d3851057fc4a)
![3](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/518dc62a-c8d0-48e3-bb13-befc39348990)
![4](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/6188de3f-e83c-400e-9594-dd3f73aaf46a)
3. 等待出以下界面,点击```Example Configurations```然后选择对应的系统比如incus的宿主机那肯定就是Debian/Ubuntu了
![5](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/9f0045fc-b1ac-4954-9ecd-1fba47d07d8a)
![6](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/2fb7c951-371c-452c-b775-78f69b980a2c)
4. 框住的部分就是要修改的文件和需要复制的内容了
![7](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/c0156902-b4c0-4001-823e-50f611215393)
复制的时候不要带空行
5. 转换格式后给你的网络配置文件附加IPV6的设置
然后打开 [https://ipv6tunnel.spiritlhl.top/](https://ipv6tunnel.spiritlhl.top/) 选择```Option```为```TunnelBrokerNet```,另一个下拉选择框选择你之前安装成功的包名,然后在输入框内粘贴你复制的内容
然后点击```Covert```转换格式,等待页面刷新显示转换格式后的配置文件内容
然后用vim或者vi命令修改```/etc/network/interfaces```文件增加内容,或者修改以下命令新增
```
tee -a /etc/network/interfaces <<EOF
# 这里修改复制粘贴一下转换格式后的配置文件内容,然后执行此命令
EOF
```
然后你可以使用```cat /etc/network/interfaces```查看配置文件是否正常写入了
6. 如果上面都没问题,就需要启用网络接口即可
```
apt-get install net-tools iproute2 -y
systemctl restart networking
```
7. 然后你就可以测试IPV6网络是否已附加
执行```ifconfig```命令,这时应该有一个 he-ipv6 接口,类似下面这样:
![8](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/1760af85-2b60-4352-ad8c-3c69e49fc1e4)
或者执行:
```
curl ipv6.ip.sb
```
回传你绑定IPV6地址
8. NAT VPS 的额外设置
IPv4 NAT VPS 除了前面提到的替换 IP 操作以外,可能还需要一些额外的设置,否则可能还是无法访问 IPv6 网络。
```
apt-get install ufw -y
ufw allow 41
```
添加相关的路由规则
```
route -A inet6 add ::/0 dev he-ipv6
```
9. 如果不需要该IPV6网络了想要删除
删除 he-ipv6 网络接口配置(若没有删除重启后会自动启用),记得修改```/etc/network/interfaces```文件,删除之前红框添加的内容
然后重启服务器,就删除了
## tunnelbroker_ch
类似上述的操作,先在 [https://www.tunnelbroker.ch/](https://www.tunnelbroker.ch/) 注册一个账户先,注册后点击激活的邮件
然后就是填写你的服务器IPV4地址
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/e018c7bc-e73c-4c68-88b6-b073f0dbd150)
创建后需要进入Config页面而不是详情页面
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/d919dda7-571d-45b1-9d2f-03f29866269e)
见到以下页面千万别使用,先刷新一下本页面,不要弹那个浅蓝色框后再停止刷新
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/aefd1477-d5f5-4a4e-a66c-80ef5f9250c6)
记录以下页面的最后一个红框的内容,准备修改宿主机配置文件
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/9329974c-9549-4ff2-a8a0-a53c00e2863d)
页面的最后一个红框框住的部分复制下来,不要带空行
然后打开 [https://ipv6tunnel.spiritlhl.top/](https://ipv6tunnel.spiritlhl.top/) 选择```Option```为```TunnelBrokerCh```,另一个下拉选择框选择你之前安装成功的包名,然后在输入框内粘贴你复制的内容
然后点击```Covert```转换格式,等待页面刷新显示转换格式后的配置文件内容
然后用vim或者vi命令修改```/etc/network/interfaces```文件增加内容,或者修改以下命令新增
```
tee -a /etc/network/interfaces <<EOF
# 这里修改一下
EOF
```
然后你就需要重启一下系统,或者执行
```
apt-get install net-tools iproute2 -y
systemctl restart networking
```
保证环境无问题再进行别的操作了
## ip4market_ru
类似上述的操作,先在 [https://tb.ip4market.ru](https://tb.ip4market.ru/) 注册一个账户先注册邮箱得是非常见邮箱电话可随便写不验证的IP填上你要附加的宿主机的IPV4地址
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/24df37f2-12fe-49b6-87df-f07213346fbe)
然后就是过Recaptcha的人机验证点击注册
邮箱会收到激活邮件,里面附带有你的密码,记住它
然后在首页进行登录
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/38b3f5a7-a5e1-47e0-b13e-8570e946c61c)
然后就会进入这个页面
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/fc1d38b9-b45a-41de-a931-5dbe96e9791c)
按住右键,然后复制红框框住的四行内容,也就是
```
Server IPv4:
Client IPv4
Server IPv6
Client IPv6
```
这四行内容按ctrl+c复制或者右键复制
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/69c946e6-e82f-4665-b3c1-3c97e27f8487)
然后打开 [https://ipv6tunnel.spiritlhl.top/](https://ipv6tunnel.spiritlhl.top/) 选择```Option```为```ip4market```,另一个下拉选择框选择你之前安装成功的包名,然后在输入框内粘贴你复制的内容
然后点击```Covert```转换格式
![](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/b9ca3ee1-4f13-4e10-bdc8-1ed1cc23ab05)
然后就会自动刷新页面出现需要自己用vim或者vi命令修改```/etc/network/interfaces```文件增加的内容了,或者修改以下命令新增
```
tee -a /etc/network/interfaces <<EOF
# 这里修改一下
EOF
```
然后你就需要重启一下系统,或者执行
```
apt-get install net-tools iproute2 -y
systemctl restart networking
```
保证环境无问题再进行别的操作了
## netassist_ua
这个平台你在切换网络管理时务必使用```ifupdown2```而不是```ifupdown2```安装包该平台使用sit协议而sit协议需要在```ifupdown2```控制的环境中使用
类似上述的操作,先在 [https://tb.netassist.ua/](https://tb.netassist.ua/) 注册一个账户先,注册后点击激活的邮件,激活页面会有密码显示,记得记录
然后就是填写你的服务器IPV4地址这个后面可以自己修改先随便填一个都没问题
然后就到了这个页面了
![a](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/4af680d4-3b01-495a-91d1-3cf4f187d0df)
第一个红框是你宿主机的IPV4地址需要填写的位置要修改就修改那里然后点change保存
第二个下拉红框选择```Linux```然后点击show
![b](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/099d43a0-0397-4e02-9275-9ec3099c0ff1)
会出现上面的内容,全选框住的部分复制下来,不要带空行
然后打开 [https://ipv6tunnel.spiritlhl.top/](https://ipv6tunnel.spiritlhl.top/) 选择```Option```为```NetAssist```,另一个下拉选择框选择你之前安装成功的包名,然后在输入框内粘贴你复制的内容
然后点击```Covert```转换格式
![c](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/7324c7ff-d22f-4c17-b3c2-b5338ca6dfee)
然后就会自动刷新页面出现需要自己用vim或者vi命令修改```/etc/network/interfaces```文件增加的内容了,或者修改以下命令新增
```
tee -a /etc/network/interfaces <<EOF
# 这里修改一下
EOF
```
然后你就需要重启一下系统,或者执行
```
apt-get install net-tools iproute2 -y
systemctl restart networking
```
保证环境无问题再进行别的操作了
## 转移不同服务器之间的IPV6子网
相关仓库:[https://github.com/oneclickvirt/6in4](https://github.com/oneclickvirt/6in4)
该方法将提供一种方式将A上的IPV6网段拆分一个子ipv6网段的出来附加到B上使用
你需要在B所在的服务器上使用本套脚本给容器一键配置IPV6地址
### 功能
- 自建sit/gre/ipip协议的IPv6隧道
- 支持自定义要切分出来的IPV6子网大小将自动计算出合适的CIDR格式的IPV6子网信息
- 自动识别服务端的IPV6子网大小
- 将自动设置隧道服务端并打印客户端需要执行的命令
- 设置IPV6隧道的方法简单易懂易于删除
### 环境准备
| VPS(A) | VPS(B) |
|--------|--------|
| 一个IPV4地址(server_ipv4) | 一个IPV4地址(clinet_ipv4) |
| 一个IPV6子网 | 无IPV6地址 |
| 以下称之为服务端 | 以下称之为客户端 |
### 使用方法
下载脚本
```
curl -L https://raw.githubusercontent.com/oneclickvirt/6in4/main/6in4.sh -o 6in4.sh && chmod +x 6in4.sh
```
执行命令
```
./6in4.sh client_ipv4 <mode_type> <subnet_size>
```
| 选项 | 可选的选项1 | 可选的选项2 | 可选的选项3 |
|--------|--------|--------|--------|
| <mode_type> | gre | sit | ipip |
| <subnet_size> | 64 | 80 | 112 |
```<mode_type>```暂时只支持那三种协议,越靠前的越推荐,不填则默认为```sit```协议
```<subnet_size>```只要比原系统子网掩码大就行且是8的倍数不填则默认为```80```
记得```client_ipv4```替换为需要附加IPV6的机器的IPV4地址执行完毕后会回传你需要在客户端执行的命令详见执行后的说明即可
为防止忘记复制命令,命令本身也将写入到当前路径下的```6in4.log```文件中,可使用```cat 6in4.log```查询客户端需要执行的命令
复制下来的命令,务必在 [https://ipv6tunnel.spiritlhl.top/](https://ipv6tunnel.spiritlhl.top/) 中选择选项```6in4```后进行转换
然后就会自动刷新页面出现需要自己用vim或者vi命令修改```/etc/network/interfaces```文件增加的内容了,或者修改以下命令新增
```
tee -a /etc/network/interfaces <<EOF
# 这里修改一下
EOF
```
然后你就需要重启一下系统,或者执行
```
apt-get install net-tools iproute2 -y
systemctl restart networking
```
保证环境无问题再进行别的操作了
### 检测服务端
```
systemctl status ndpresponder
```
```
ip addr show
```
### 检测客户端
```
ip addr show
```
```
curl ipv6.ip.sb
```
### 删除隧道
服务端
```
ip link set server-ipv6 down
ip tunnel del server-ipv6
```
客户端
```
ip link set user-ipv6 down
ip tunnel del user-ipv6
```
以上删除的方式只是临时删除,永久删除务必修改删除```/etc/network/interfaces```文件中你之前增加的内容
### 后言
实际上 [https://tunnelbroker.net/](https://tunnelbroker.net/) 支持申请```/48```大小的IPV6子网只需要在
![图片](https://github.com/oneclickvirt/oneclickvirt.github.io/assets/103393591/07987e41-0158-430c-bcc5-f7cd8652b2c4)
这里进行申请,然后转换格式的时候将原先```/64```的IPV6地址改成```/48```的IPV6地址你就能获得一个更大的IPV6子网了

View File

@@ -0,0 +1,141 @@
---
outline: deep
---
# 其他自定义配置
:::tip
以下的配置安装会加重宿主机的负担,非必要不要安装
:::
:::tip
如果是个人使用,可忽略防滥用部分脚本的安装
:::
## 自动配置IPV6地址
- (***非必须***,不使用的也没问题)
- **该脚本仅适用于宿主机有给```IPV6```子网且是至少```/112```的,且宿主机绑定了子网的```第一个IP```做```宿主机的IPV6地址或IPV6的gateway```**
- 自动为incus创建的LXC容器配置```IPV6```地址
- 已集成到```buildone.sh```中可使用变量控制且无需事先下载,该脚本可不手动使用,在使用```buildone.sh```时配置Y开启即可
下载脚本
国际
```bash
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/build_ipv6_network.sh -o build_ipv6_network.sh && chmod +x build_ipv6_network.sh
```
国内
```shell
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/build_ipv6_network.sh -o build_ipv6_network.sh && chmod +x build_ipv6_network.sh
```
自动为容器配置IPV6映射地址(默认不使用iptables进行映射)
```bash
bash build_ipv6_network.sh 容器名称
```
映射完毕会打印信息
示例(给test容器自动配置IPV6地址配置完成会写入一个test_v6的文件信息)
```bash
bash build_ipv6_network.sh test
```
**PS增加ipv6处理过程中可选择是否使用ip6tables进行映射默认不使用ip6tables方式进行映射而使用新增网络设备的方式进行映射**
使用ip6tables进行映射
```bash
bash build_ipv6_network.sh 容器名称 Y
```
若使用了ip6tables进行映射则删除所有IPV6已映射的规则可用
```bash
ip6tables -t nat -F PREROUTING
ip6tables-legacy -t nat -F PREROUTING
ip6tables-save > /etc/iptables/rules.v6
netfilter-persistent save
netfilter-persistent reload
service netfilter-persistent restart
```
卸载IPV6地址绑定的守护进程和对应的文件可用
```shell
systemctl stop add-ipv6.service
systemctl disable add-ipv6.service
rm /etc/systemd/system/add-ipv6.service
systemctl daemon-reload
rm /usr/local/bin/add-ipv6.sh
```
## 屏蔽容易被滥用的端口的出入流量以屏蔽端口和屏蔽滥用工具包
- (***非必须***,该脚本仅仅是为了防止容器滥用方便,不装的也没问题)
- 事前预防
国际
```shell
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/rules.sh -o rules.sh && chmod +x rules.sh && bash rules.sh
```
国内
```shell
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/rules.sh -o rules.sh && chmod +x rules.sh && bash rules.sh
```
## 使用screen配置监控屏蔽某些进程的执行遇到某些进程的出现直接关闭容器
- 如需停止监控可使用```screen```命令停止```lxc_moniter```这个名字的窗口并删除
- (***非必须***,该脚本仅仅是为了防止容器滥用方便,不装的也没问题)
- 事后停机
国际
```shell
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/build_monitor.sh -o build_monitor.sh && chmod +x build_monitor.sh && bash build_monitor.sh
```
国内
```shell
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/build_monitor.sh -o build_monitor.sh && chmod +x build_monitor.sh && bash build_monitor.sh
```
## 一键安装开incus宿主机所需要的带vnstat环境的常用预配置环境
- (***非必须***,该脚本仅仅是为了站点对接监控方便,不装的也没问题)
国际
```shell
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/backend.sh -o backend.sh && chmod +x backend.sh && bash backend.sh
```
国内
```shell
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/backend.sh -o backend.sh && chmod +x backend.sh && bash backend.sh
```
## 一键安装宿主机可视化操作的面板
- (***非必须***,该面板只是为了方便可视化操作,没有也没问题)
- 原作者仓库:[跳转](https://github.com/turtle0x1/incusMosaic)
```shell
incus config set core.https_address [::]
incus config set core.trust_password some-secret-string
snap install incusmosaic
```
安装完毕后打开宿主机IP地址按照提示设置admin的密码其他一路默认就能使用面板了

View File

@@ -0,0 +1,107 @@
---
outline: deep
---
# incus主体安装
如果你的宿主机本身没有IPV6的子网又想给容器分配IPV6地址那么请先查看```incus```模块中的```自定义```分区中的```给宿主机附加免费的IPV6地址段```的内容给宿主机附加上IPV6子网后再进行环境安装
## 一键安装
:::warning
如果是全新的服务器务必保证apt update和apt install curl都无问题再执行本脚本
:::
:::tip
且自开机起最好等待5分钟后再执行以下命令避免系统默认设置中就执行了本脚本导致apt源卡死
:::
- 环境要求Ubuntu 18+(推荐)Debian 8+(仅限x86_64架构)
- **如果是Debian系的宿主机务必在screen中执行本脚本避免长期运行时SSH中断导致ZFS编译安装失败**
- 这里的虚拟内存是说要开的SWAP大小存储池则是你所有要开的服务器占的盘的大小的总和
- 环境安装过程中**可能需要重启服务器以加载含zfs的内核然后再次执行安装命令一切以运行后命令行的提示为准**
- 默认启用incus的lxcfs相关配置使得容器内查询容器信息变更为容器本身的信息而不是宿主机信息
如果脚本提示重启系统后需要再次执行脚本第二次执行安装脚本仍提示重启系统加载内核那么意味着内核在上一次加载中失败了最好重装宿主机系统为ubuntu系解决这个问题
每次执行脚本都需要输入一次初始化的配置,所以遇到脚本提示需重启系统再次执行,那么就得再次输入初始化的配置
国际
```shell
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/incus_install.sh -o incus_install.sh && chmod +x incus_install.sh && bash incus_install.sh
```
国内
```shell
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/incus_install.sh -o incus_install.sh && chmod +x incus_install.sh && bash incus_install.sh
```
初始化配置的例子:
如果系统盘除去已占用空间还有18G硬盘空余想开2G虚拟内存(2048MB的SWAP)15G的存储池按照命令行的提示则依次输入```2048```和```15```
## 手动安装
新手推荐避免有bug不知道怎么修当然如果只是图方便又是老手懂排查BUG用后面的一键安装也行
### 关闭防火墙
```bash
apt update
apt install curl wget sudo dos2unix ufw jq -y
ufw disable
```
### 开设虚拟内存SWAP
内存看你开多少服务器这里如果要开8个换算需要2G内存实际内存如果是512MB内存还需要开1.5G保守点开2G虚拟内存即可
执行下面命令输入1再输入2048代表开2G虚拟内存
国际
```shell
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/swap.sh -o swap.sh && chmod +x swap.sh && bash swap.sh
```
国内
```shell
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/swap.sh -o swap.sh && chmod +x swap.sh && bash swap.sh
```
### 安装incus
实际swap开的虚拟内存应该是实际内存的2倍也就是开1G是合理的上面我描述的情况属于超开了
```
apt install snapd -y
snap install incus
incus init
```
如果上面的命令中出现下面的错误
(snap "incus" assumes unsupported features: snapd2.39 (try to update snapd and refresh the core snap))
使用命令修补后再进行incus的安装
```
snap install core
```
如果无异常,上面三行命令执行结果如下
![图片](https://user-images.githubusercontent.com/103393591/233270028-5a43d0f7-45f5-4175-969e-d4d182cb877a.png)
一般的选项回车默认即可
选择配置物理盘大小(提示默认最小1GB那个选项)一般我填空闲磁盘大小减去内存大小后乘以0.95并向下取整这里我填了10GB
提示带auto的更新image的选项记得选no避免更新占用系统
```
incus -h
```

View File

@@ -0,0 +1,306 @@
---
outline: deep
---
# LXC虚拟化
## 单独生成一个NAT服务器
- 只生成一个NAT服务器可自定义限制所有内容
下载开机脚本是**非必须**的如果你使用过一键安装incus的命令自动已下载对应的开机脚本不需要重复下载该脚本
国际
```shell
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/buildone.sh -o buildone.sh && chmod +x buildone.sh && dos2unix buildone.sh
```
国内
```shell
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/buildone.sh -o buildone.sh && chmod +x buildone.sh && dos2unix buildone.sh
```
### 使用方法
```
./buildone.sh 服务器名称 CPU核数 内存大小 硬盘大小 SSH端口 外网起端口 外网止端口 下载速度 上传速度 是否启用IPV6(Y or N) 系统(留空则为debian11)
```
CPU核数需要小于或等于宿主机的核数内存大小以MB计算硬盘大小以GB计算下载速度上传速度以Mbit计算是否启用IPV6不一定要填Y或者N没有这个参数也行留空默认不开启IPV6
如果```外网起端口```和```外网止端口```都设置为0则不做区间外网端口映射了只映射基础的SSH端口注意```不能为空```不进行映射需要设置为0
支持自定义服务器的系统不填写留空时默认使用debian11注意传入参数为系统名字+版本号,如:
- debian10debian11debian12
- ubuntu18ubuntu20ubuntu22
- centos8centos9 (实际开设出来都是Stream版本)
- alpine3.15alpine3.16alpine3.17alpine3.18
- openwrt21openwrt22fedora37fedora38fedora39
- rockylinux8rockylinux9oralce8oracle9
- oralce7centos7 (都需要在GRUB中启用CGroupV1否则无法启动详细介绍见常见问题答疑)
- kaliarchlinux
* 注意都是小写字母+数字的组合或仅小写字母,自行尝试,如果搜索无该系统则会自动退出脚本
* 版本号可以带英文小数点为了适配alpine的版本号已支持
* 开不起来的可能是硬盘或内存不够大或者本身就不适配宿主机,自行尝试查看开不起来的报错
:::tip
版本号中已结束长期维护的一般不再有官方镜像了,暂时未找到历史镜像的存档地址,如果有找到欢迎留言我会添加支持
:::
### 示例
以下为开设的示例服务器的信息:
| 属性 | 值 |
|---------------------------|----------------|
| 服务器名字 | test |
| SSH登录的用户名 | root |
| SSH登录的密码 | 随机生成 |
| CPU核数 | 1 |
| 内存大小 | 256MB |
| 磁盘大小 | 2G |
| 内外网映射端口一致的区间 | 20002到20025 |
| 上传带宽 | 500Mbit |
| 下载带宽 | 500Mbit |
| 自动设置外网IPV6地址 | N |
| 系统 | debian11 |
```
./buildone.sh test 1 256 2 20001 20002 20025 500 500 N
```
需要进入容器内部则执行
```
incus exec test /bin/bash
```
退出则输入exit回车即可
需要查看信息则执行
```shell
cat 服务器名字
```
比如查询示例的信息就是
```shell
cat test
```
如果已通过以上方法生成过服务器,还需要批量生成服务器,可使用自定义批量生成版本的脚本,但注意先删除测试服务器再进行批量生成服务器
### 删除测试服务器
```shell
incus stop test
incus delete test
rm -rf test
rm -rf test_v6
ls
```
## 普通版本批量生成
开出的服务器配置:
- 1核256MB内存1GB硬盘限速300Mbit带宽
- 带1个SSH端口25个外网端口
- 默认内存和硬盘大小
:::tip
lxc若命令无问题执行初始化开服务器这一步最好放```screen```中后台挂起执行,开服务器时长与你开几个和宿主机配置相关
:::
执行下面命令加载开机脚本
国际
```shell
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/init.sh -o init.sh && chmod +x init.sh && dos2unix init.sh
```
国内
```shell
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/init.sh -o init.sh && chmod +x init.sh && dos2unix init.sh
```
下面命令为开服务器名字前缀为**tj**的**10**个服务器
```shell
./init.sh tj 10
```
有时候init.sh的运行路径有问题此时建议前面加上sudo强制根目录执行
## 纯SSH端口版本批量生成
开出的服务器配置:
- 1核128MB内存300MB硬盘限速300Mbit带宽
- 只有一个SSH端口
- 无法挂载warp
:::tip
lxc若命令无问题执行初始化开服务器这一步最好放```screen```中后台挂起执行,开服务器时长与你开几个和宿主机配置相关
:::
加载开机脚本
国际
```shell
curl -L https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/least.sh -o least.sh && chmod +x least.sh && dos2unix least.sh
```
国内
```shell
curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/least.sh -o least.sh && chmod +x least.sh && dos2unix least.sh
```
下列命令最后一行为开服务器名字前缀为**tj**的**10**个服务器
```shell
./least.sh tj 10
```
有时候least.sh的运行路径有问题此时建议前面加上sudo强制根目录执行
## 自定义批量生成版本
- 可自定义内存和硬盘大小
- 有执行过上面的手动批量生成过也没问题,配置是继承的不覆盖
如果需要多次批量生成服务器,可使用
国际
```
curl -L https://github.com/oneclickvirt/incus/raw/main/scripts/add_more.sh -o add_more.sh && chmod +x add_more.sh && bash add_more.sh
```
国内
```shell
curl -L https://cdn.spiritlhl.net/https://github.com/oneclickvirt/incus/raw/main/scripts/add_more.sh -o add_more.sh && chmod +x add_more.sh && bash add_more.sh
```
可多次运行批量生成服务器,且继承前面已生成的部分在后面添加,可自定义内存和硬盘大小
## 查看已批量开设的信息
开完服务器后具体信息会生成在当前目录下的log文件中格式如下
```shell
1号服务器名称 密码 ssh端口 外网端口起始 外网端口终止
2号服务器名称 密码 ssh端口 外网端口起始 外网端口终止
```
如果想要查看只需在当前目录执行以下命令打印log文件即可
```shell
cat log
```
:::warning
不要拿该脚本开出的服务器当生产环境LXC虚拟化不支持换内核dd开启bbr等操作
:::
## 部分常用incus命令
查看所有
```bash
incus list
```
查看个例
```bash
incus info 服务器名字
```
启动个例
```bash
incus start 服务器名字
```
停止个例
```bash
incus stop 服务器名字
```
删除个例
```bash
incus delete -f 服务器名字
```
进入内部
```bash
incus exec 服务器名字 /bin/bash
```
:::tip
在alpine中不用/bin/bash而是用/bin/sh常规的系统都是/bin/bash
:::
退出则输入```exit```回车即可
删除所有LXC容器
```bash
incus list -c n --format csv | xargs -I {} incus delete -f {}
```
在容器内执行删除无用日志
```bash
sudo apt-get autoremove
sudo apt-get clean
sudo find /var/log -type f -delete
sudo find /var/tmp -type f -delete
sudo find /tmp -type f -delete
sudo find /var/cache/apt/archives -type f -delete
```
## 更新上述所有一键脚本的相关命令
删除原始配置脚本
```bash
rm -rf /usr/local/bin/ssh_sh.sh
rm -rf /usr/local/bin/config.sh
rm -rf /usr/local/bin/ssh_bash.sh
rm -rf /usr/local/bin/check-dns.sh
rm -rf /root/ssh_sh.sh
rm -rf /root/config.sh
rm -rf /root/ssh_bash.sh
rm -rf /root/buildone.sh
rm -rf /root/add_more.sh
rm -rf /root/build_ipv6_network.sh
```
下载回新版本的相关配置脚本
```bash
wget https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/check-dns.sh -O /usr/local/bin/check-dns.sh && chmod +x /usr/local/bin/check-dns.sh
wget https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/config.sh -O /usr/local/bin/config.sh && chmod +x /usr/local/bin/config.sh
wget https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/ssh_bash.sh -O /usr/local/bin/ssh_bash.sh && chmod +x /usr/local/bin/ssh_bash.sh
wget https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/ssh_sh.sh -O /usr/local/bin/ssh_sh.sh && chmod +x /usr/local/bin/ssh_sh.sh
wget https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/build_ipv6_network.sh -O /root/build_ipv6_network.sh && chmod +x /root/build_ipv6_network.sh
wget https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/buildone.sh -O /root/buildone.sh && chmod +x /root/buildone.sh
```
其他一键脚本自己对应下载回来就行了

View File

@@ -0,0 +1,60 @@
---
outline: deep
---
# 前言
以下为非自定义部分的介绍,自定义部分有自己对应的介绍,勿弄混了
如果你的宿主机本身没有IPV6的子网又想给容器分配IPV6地址那么请先查看```incus```模块中的```自定义```分区中的```给宿主机附加免费的IPV6地址段```的内容给宿主机附加上IPV6子网后再进行环境安装
## 要求
硬件要求:
- 系统Debian 8+, Ubuntu 18+(推荐20.04)
- 虚拟化推荐KVM、VMWARE虚拟化
- 内存内存至少512MB
- 硬盘:硬盘(系统盘)至少10G
- 网络独立的IPV4地址IPV6可有可无带宽能下载脚本就行网络能连接Github的raw页面就行
PS: 如果硬件非常好资源很多可使用PVE批量开KVM虚拟化的虚拟机 [跳转](https://github.com/spiritLHLS/pve)
PS: 如果硬件资源更烂虚拟化不支持可使用docker版本的适配面更广 [跳转](https://github.com/spiritLHLS/docker)
## 项目特点
- 本套脚本开发使用的**Ubuntu20**Ubuntu别的长期维护版本应该也没问题Debian无法使用zfs时自动切换别的存储类型
- 已设置同时进行TCP和UDP转发除了SSH端口其他的映射内网外网端口一致
- 已设置支持开出的LXC容器进行docker嵌套虚拟默认普通版本和纯探针版本使用debian11系统
- 已设置默认启用lxcfs使得在容器内的查询资源时使用的是配置的视图而不是宿主机的视图
- 已屏蔽容器内可能用于滥用的工具包和IPV4网络的TCP/UDP协议的端口( 3389 8888 54321 65432 ),以防止容器被用于扫描和爆破,且可外置进程检查有问题自动停机
- 已支持一键为LXC容器配置IPV6地址(前提是宿主机有IPV6子网无IPV6地址则不配置),自动适配子网大小
- 已增加清华镜像源,如果官方镜像丢失时,将使用镜像源下载容器镜像
- 保证你要开的盘为默认的系统盘(sda或者sda1)而不是挂载的盘(sdb之类的),不确定的使用```fdisk -l```和```df```查看
- 挂载其他盘的详看 [其他说明](https://github.com/oneclickvirt/incus/blob/main/README_other.md)
- 一键脚本支持自定义限制所有内容,普通版本支持多次运行批量生成不覆盖先前生成的配置
## 检测环境
**使用后续脚本的务必执行本命令检测宿主机是否符合要求**
国际
```
bash <(wget -qO- --no-check-certificate https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/pre_check.sh)
```
国内
```
bash <(wget -qO- --no-check-certificate https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/incus/main/scripts/pre_check.sh)
```

View File

@@ -0,0 +1,35 @@
---
outline: deep
---
# 解惑
## 开设centos7发现报错CGroupV1不支持怎么办
启用CGroup V1要在Ubuntu系统上启用CGroup V1需要编辑内核启动参数。
请注意,在更改内核启动参数之前,请务必备份重要的数据和设置,以防止意外的问题。
编辑```/etc/default/grub```文件,将```GRUB_CMDLINE_LINUX_DEFAULT```中的参数末尾加上```systemd.unified_cgroup_hierarchy=0```,如
```
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash systemd.unified_cgroup_hierarchy=0"
```
保存文件并运行以下命令更新GRUB引导。
```bash
sudo update-grub
```
重启系统,使更改生效
如果上述更改仍旧不支持开设centos7那么请使用别的宿主机系统尝试
## 目前已验证可开带独立IPV6地址容器的VPS商家
[kuroit](https://my.kuroit.com/aff.php?aff=5) 中的 美国凤凰城 regular
[datalix](https://t.me/vps_reviews/338) 中的 德国AMD 促销款
[luxvps](https://billing.luxvps.xyz/aff.php?aff=36) 中的 德国AMD 促销款

View File

@@ -0,0 +1,19 @@
## 致谢
https://github.com/lxc/lxd
https://lxdware.com/
https://discuss.linuxcontainers.org/
https://discuss.linuxcontainers.org/t/how-to-run-docker-inside-lxc-container/13017/4
https://discuss.linuxcontainers.org/t/error-seccomp-notify-not-supported-on-container-start/15038/3
https://discuss.linuxcontainers.org/t/how-do-i-assign-a-public-ipv6-address-to-a-lxc-container/6028
https://github.com/turtle0x1/LxdMosaic
https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/index.html
https://github.com/SuperManito/LinuxMirrors