When you enable file and printer sharing in Windows Vista it automatically opens the ports needed to share files or printer in the Windows Vista firewall for you.
What if you're not using the Windows Vista firewall or you're using a hardware firewall like a router, firewall appliance, Linux firewall, or a Cisco PIX?
Below is a table that lists all the ports that need to be opened in Windows Vista to share files and printers. You can manually open these ports to enable file and printer sharing on your computer.
Rule Name:File and Printer Sharing (NB Name In)
Port:137
Protocol:UDP
Notes: Used for NetBIOS Name Resolution.
Rule Name:File and Printer Sharing (NB Datagram In)
Port:138
Protocol:UDP
Notes:Used for enabling NetBIOS Datagram transmission and reception.
Rule Name:File and Printer Sharing (NB Session In)
Port:139
Protocol:TCP
Notes:Used for enabling NetBIOS session Service.
Rule Name:File and Printer Sharing (SMB In)
Port:445
Protocol:TCP
Notes: Used for enabling Server Message Block transmission and reception via Named Pipes.