We investigated the reversible ferromagnetic (FM) behavior of pure and Co doped CeO2 nanopowders. The as-sintered samples displayed an increasing paramagnetic contribution upon Co doping. Room temperature FM is obtained simply by performing thermal treatments in vacuum at temperatures as low as 500^{circ}C and it can be switched off by performing thermal treatments in oxidizing conditions. The FM contribution is enhanced as we increase the time of the thermal treatment in vacuum. Those systematic experiments establish a direct relation between ferromagnetism and oxygen vacancies and open a path for developing materials with tailored properties.