In this paper, we study p2p systems, where peers have to share their available resources between their own and other peers' needs. One such example is a system of peers who use their capacity-limited access links both for their upstream and downstream connections. In the selfish approach, each peer would like to exploit the full capacity of his access link only for his downloads. However, if all peers acted selfishly, the system would collapse. In order to motivate peers to cooperate, we propose a distributed reputation-based system according to which peers earn reputation analogous to their contributions. In this way, each peer has to trade off the capacity he will dedicate for uploading in order to increase his reputation and therefore his revenue and the capacity he will dedicate for his downloads. All peers act rationally, trying to maximize their utility. Our proposed policies lead rational peers to cooperation while promoting fairness, as peers receive resources in proportio...