This commit is contained in:
spiritlhl
2024-05-19 11:47:11 +00:00
parent da8a04659d
commit e6aec3744b
2 changed files with 27 additions and 0 deletions

View File

@@ -378,6 +378,19 @@ The above command is used to create a virtual machine with an independent IPV4 a
| IPV6 | None |
| MAC_ADDRESS | None |
## Incoming and outgoing traffic goes to the bound IPV4 address
execute
```
line="-A POSTROUTING -s 172.16.1.0/24 -o vmbr0 -j MASQUERADE"
sed -i "/$line/d" /etc/iptables/rules.v4
service netfilter-persistent restart
```
This will cause the host to lose the ability to open VMs/containers with NAT that do not have a separate IPV4 address, so be careful!
After this, You will only be able to open VMs with separate IPV4 addresses.
## Creating Virtual Machines with Pure IPv6 Addresses

View File

@@ -432,6 +432,20 @@ curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt
| IPV4地址 | a.b.c.d |
| IPV6 | 无 |
## 进出流量都走绑定的IPV4地址
执行
```
line="-A POSTROUTING -s 172.16.1.0/24 -o vmbr0 -j MASQUERADE"
sed -i "/$line/d" /etc/iptables/rules.v4
service netfilter-persistent restart
```
即可但这会导致宿主机丧失开设非独立IPV4地址的NAT的虚拟机/容器的能力,慎重执行
执行后你只能开设独立IPV4地址的虚拟机了。
## 开设纯IPV6地址的虚拟机
前提是宿主机给的是IPV6子网而不是单独一个IPV6地址且宿主机未开启MAC地址校验