The problem that the traditional trust model for P2P network can not reflect accurately peers' behaviors introduces an improved trust model based on reputation. Trust will be divided into service reputation and credibility of recommendation, and storage, computing and update algorithm of trust and the randomly extraction algorithm based on credibility of recommendation are raised in the model. The model can effectively reduce traffic and provide a more accurate recommendation, meanwhile prevent the tampering of information of trust and a variety of conspiracy to deceive.