From a6f34c5649eb0e497945f64627daf2901e1bc82d Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Thu, 21 Aug 2025 21:28:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E5=85=B7=E4=BD=93=E7=9A=84?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/en/guide/pve/pve_custom.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/en/guide/pve/pve_custom.md b/docs/en/guide/pve/pve_custom.md index 476440c18d..a58d815307 100644 --- a/docs/en/guide/pve/pve_custom.md +++ b/docs/en/guide/pve/pve_custom.md @@ -139,18 +139,22 @@ The above commands require the ```sudo``` and ```crontab``` commands to be avail ## Self-mapping of public ports on KVM VMs with open NATs +All of the following operations are performed on the PVE host computer + Use the ```nano``` or ```vim``` command to modify the file to add port mapping: ``` /etc/iptables/rules.v4 ``` -For example, if I have a KVM VM with an intranet IP of ```172.16.1.152```, and MYSQL has been set up to listen to ```3306```, and I need to use the ```tcp``` protocol to map out to the ```33306``` port on the host IP, I would add the following line to the ```COMMIT``` line in the file above, then add the following line +For example, if I have a KVM VM with an intranet IP of ```172.16.1.152``` (VMs can view the intranet IP address on the web side no matter what system they are on), and MYSQL has been set up to listen to ```3306```, and I need to use the ```tcp``` protocol to map out to the ```33306``` port on the host IP, I would add the following line to the ```COMMIT``` line in the file above, then add the following line ``` -A PREROUTING -i vmbr0 -p tcp -m tcp -dport 33306 -j DNAT --to-destination 172.16.1.152:3306 ``` +If it's udp protocol, just change ```tcp``` to ```udp``` in the code above + Save the file and exit file editing and then execute: ``` @@ -176,3 +180,4 @@ echo "kvm64" > /usr/local/bin/cpu_type ``` Specifying the default CPU TYPE in this way allows you to replace ```kvm64``` with the type you want +