The sign, magnitude, and range of the exchange couplings between pairs of Mn ions is determined for (Ga,Mn)N and (Ga,Mn)N:Si with x < 3%. The samples have been grown by metalorganic vapor phase epitaxy and characterized by secondary-ion mass spectroscopy; high-resolution transmission electron microscopy with capabilities allowing for chemical analysis, including the annular dark-field mode and electron energy loss spectroscopy; high-resolution and synchrotron x-ray diffraction; synchrotron extended x-ray absorption fine-structure; synchrotron x-ray absorption near-edge structure; infra-red optics and electron spin resonance. The results of high resolution magnetic measurements and their quantitative interpretation have allowed to verify a series of ab initio predictions on the possibility of ferromagnetism in dilute magnetic insulators and to demonstrate that the interaction changes from ferromagnetic to antiferromagnetic when the charge state of the Mn ions is reduced from 3+ to 2+.