Peer-to-peer content distribution has becomea major source of bandwidth costs for Internet serviceproviders (ISPs). One way for ISPs to decrease these costsis to deploy caches for p2p traffic. To make efficient useof the caches, in this paper we propose a cooperativecaching and relaying scheme that is compatible with theexisting business relations between ISPs. We formulate theproblem of cooperative caches as a resource allocationproblem, and show that it is related to the problemof r-configuration studied in graph theory. We proposea distributed algorithm to solve the resource allocationproblem, and show that cooperation leads to significantgains compared to non-cooperative caching.