A novel method of generating tunable microwave signals in the photonic domain is proposed. Eighteen pairs of stable dual-wavelength single longitudinal mode lasings are achieved by incorporating a fiber Bragg grating based Fabry–Pérot filter and a tunable fiber grating into a fiber ring cavity. The frequency of the generated microwave signal obtained by beating the dual-wavelength laser with a photodetector can be tuned simply through configuring the working wavelength of the laser. A series of microwave frequencies of 9.4885, 9.572, 9.7111, 9.8498, 9.9598 and 10.0712 GHz are generated experimentally. The proposed method is useful in applications such as wireless access networks, sensor networks, radio-over-fiber systems and software-defined radio.