In the case of ESXi, while it seems like everything can be done through the GUI, adding firewall rules is restricted to starting or stopping existing rules, and adding new rules is not supported.
Previous Method
In ESXi 6.x versions, it was possible to add editing permissions (# chmod 644 ...
) and directly modify the firewall rules file (# vi ...
).
Firewall rule path: /etc/vmware/firewall/service.xml
From ESXi 7.x
Starting from ESXi 7.x, it is no longer possible to add editing permissions or use the vi
editor to directly modify the file.
Solution
After researching, I found that you can add rules in the /etc/vmware/firewall/
directory in the same format as the service.xml
file.
The commands I used are as follows:
# cp /etc/vmware/firewall/service.xml /etc/vmware/firewall/custom.xml
# vi /etc/vmware/firewall/custom.xml
// Add the rules properly as needed.
# esxcli network firewall refresh
// Refresh the firewall rules.
Finally, log in to VMware ESXi web → Networking → Check the Firewall rules!
You should be able to see the newly added rule.