We have a community user say "U1" which is having a internal contact say "C1" in salesforce and that contact is related to an Account say "A1". So when user "U1" login into the community and go to contacts tab we have to show only the contacts related to account "A1". i.e The community user can only be able to see the Account contacts with which its internal contact is related to.
You need to create the
Sharing Set on the Communities. If you go to
Setup--> Customize --> Communities --> Communities Settings, you will find the section called
Sharing Sets. Create a new sharing set with name and add the relevant profiles. Then add Account and Contacts to your available objects list. Then, below select object, you can find the section to configure access to these objects. Click on Setup besides Accounts first. Set the rule as shown below.
Hope this helps!
For Customer Community user, you can use Sharing Set to share the Contact records.
Note to make your OWD as private for Account and Contacts. Access might something like as follows: