The coordination number of an ion is defined as a number of oppositely charged ions surrounding that particular ion in the crystal lattice. The crystal arrangement of rock salt is shown in the figure. It shows that the coordination number of each ion is 6. So, the coordination number of nearest oxide ions to Mg2+ ion is 6.