Hello Ka Ho Cheng,
Thank you for posting in Q&A forum.
Typically, we use SMB protocol and port 445 for folder sharing, you could use Windows Firewall to create a Inbound rule, to block access from specific IP addresses.
Here are the steps you can follow:
1.Open Windows Firewall: Go to Control Panel > System and Security > Windows Defender Firewall. Click on "Advanced settings" on the left side.
2.Create a New Rule: In the Windows Firewall with Advanced Security window, click on "Inbound Rules" and then "New Rule" on the right side.
3.Rule Type: Select "Custom" and click "Next".
4.Program: Choose "All programs" and click "Next".
5.Protocol and Ports: Leave the default settings and click "Next".
6.Scope: Here, you can specify the IP addresses. Under "Which remote IP addresses does this rule apply to?", select "These IP addresses" and add the IP addresses or ranges you want to allow or block.
7.Action: Choose "Allow the connection" or "Block the connection" based on your requirement and click "Next".
8.Profile: Select the profiles (Domain, Private, Public) where this rule should apply and click "Next".
9.Name: Give your rule a name and click "Finish".
I hope the information above is helpful.
If you have any questions or concerns, please feel free to let us know.
Best Regards,
Daisy Zhou
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.