Skip to content

Commit c0e6b26

Browse files
committed
增加PVE的屏蔽滥用的部分说明
1 parent de8bcf7 commit c0e6b26

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

docs/en/guide/block/block_pve.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,24 @@
22
outline: deep
33
---
44

5-
# To be developed, stay tuned
5+
# Avoid theft by setting up a firewall to limit the IPs used by the VMs
6+
7+
Create the following file under the PVE's host machine
8+
9+
```shell
10+
/etc/pve/firewall/<VMID>.fw
11+
[IPSET ipfilter-<net0>]
12+
xxx.xxx.xxx.xxx
13+
```
14+
15+
```<VMID>``` is replaced with the VMID number of the virtual machine, ```<net0>``` is replaced with the corresponding alias in the network device (which generally doesn't need to be changed unless you're restricted to IPV6), and ```xxx.xxx.xxx.xxx``` is replaced with the public IP address, noting that this IP corresponds to the network device in front of it.
16+
17+
The idea here is that net0 can only use the IP xxx.xxx.xxx.xxx, if you use any other IP the data will be dropped, thus restricting the VM to only use this IP.
18+
19+
There can be more than one IP, once this rule is enabled the VM can't use any other IP, if you don't write an IPv6 address it means the VM can't use an IPv6 address.
20+
21+
:::tip
22+
This setting is only recommended when opening **VMs** with separate IPs that are not NAT full port mapped, otherwise it may cause strange issues resulting in the server being without a network.
23+
:::
24+
25+
This method **is not suitable** for use on PVEs that open any NAT VMs/containers.

docs/guide/block/block_pve.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,26 @@
22
outline: deep
33
---
44

5-
# 待开发,敬请期待
5+
# 通过设置防火墙限制虚拟机使用的IP避免盗用
6+
7+
在PVE的宿主机下创建以下文件
8+
9+
```shell
10+
/etc/pve/firewall/<VMID>.fw
11+
12+
[IPSET ipfilter-<net0>]
13+
xxx.xxx.xxx.xxx
14+
```
15+
16+
```<VMID>```替换为虚拟机的VMID数字,```<net0>```替换为网络设备中对应的别名(一般不用修改,除非你限制的IPV6),```xxx.xxx.xxx.xxx```替换为公网IP地址,注意此IP对应前面的网络设备。
17+
18+
19+
这里的意思是net0只能使用xxx.xxx.xxx.xxx这个IP,如果使用其他的IP数据将会被丢弃,从而达到限制虚拟机只能使用此IP的目的。
20+
21+
这里可以有多个IP,一旦启用此规则该VM就无法使用除此之外的任何IP,如果你没有写IPv6地址则代表该VM无法使用IPv6地址。
22+
23+
:::tip
24+
本设置仅推荐在开设**非NAT全端口映射的独立IP的虚拟机**时使用,否则可能导致奇奇怪怪的问题造成服务器没网。
25+
:::
26+
27+
该方法**不适合**开设任何NAT虚拟机/容器的PVE上使用。

0 commit comments

Comments
 (0)