I think the below ports will work for QuickBooks Enterprise version 2019 and up. I was successful on QuickBooks Enterprise 2024 with the below ports.
- 445
- SMB Share Communication
- 8016
- For Multi-user Mode to function properly
- XXXXX
- This is a random number generated from the QuickBooks Server Database Program see picture below to find the number you are using
Go to Start>Program Files and search for QuickBooks Database Server Manager and open

Click the Port Monitor tab and your port will be there. If you click Renew that will cycle to a new port number

