To counteract the phenomenon of software aging and system failures, a software rejuvenation model based on reconfiguration is proposed. The continuous time Markov chain is adopted to describe the rejuvenation model for software systems with two degradation states. The formal definition and analysis of the system availability and of the expected total cost per unit time are given. The optimal rejuvenation interval is obtained by either maximizing the availability or minimizing the expected cost. A reconfiguration threshold is derived by comparing the rejuvenation method based on reconfiguration with the periodical rejuvenation method. Simulation results show that the system availability increases and the downtime cost decreases as the success probability of the reconfiguration increases. A comparison with the periodical rejuvenation method shows that when the success probability of the reconfiguration is 1, the system downtime cost is reduced by 48.9%.