How to Add Firewall Rules in VMware ESXi 7.x

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.

Reference Link:

https://community.broadcom.com/vmware-cloud-foundation/discussion/custom-firewall-setting-in-esxi70-operation-not-permitted#bm1d2e608e-5023-418a-8cfc-3b6dfd8eaeac

Leave a Reply

Your email address will not be published. Required fields are marked *