A military exercise is underway at the Riverhead Forest area north of Auckland, and locals are being warned they may hear gunfire.

Police said the exercise involved automatic weapons firing blanks, and people should not be alarmed.

Some parts of the will be inaccessible to the public.

The exercise will run until 6pm.