Botnets, especially peer-to-peer (P2P) botnets have become the root because of many Internet attacks recently. A novel dynamical model is presented to describe the propagation of P2P botnets which is called SIIR model. To effectively suppress P2P botnets, quarantine and virtual patching strategy are proposed and two dynamical models are given based on the SIIR model (SIIQR model and SIIQPR model). The two models can examine the impact of different containment strategies on the growth of the P2P botnets. In addition, the stability of equilibrium is investigated and the basic reproduction number is obtained which governs whether or not P2P botnets are extinct. The virtual patching strategy and quarantine strategy can effectively contain the propagation of the P2P botnets. Numerical and simulation results show the effectiveness of our models, larger infected rate and larger deploying rate of virtual patching can control the number of infected hosts more effectively.