There are lots of occasions in the books when Hogwarts grounds are hard or impossible to enter. And while they give lots of additional magical protection to it, the main thing that divides the inside and outside of Hogwarts' territory is the wall.

But I was always wondering why no one ever thought of entering the castle grounds through the Forest? The Forest seems huge - it's big enough for centaurs, acromantulas, thestrals, unicorns and occasional giants to live there without fighting for space. Even then there is enough space left for a convict on a run to hide, Death Eaters to put their rest camp, Hagrid to organize lessons, and four Dragons to be kept without bothering other inhabitants.

However big and dangerous the Forest is, it surely should have an end somewhere miles away from the castle. Maybe somewhere in the mountains. Why not enter the Forest there and pass through it to reach the castle? Or at least it could be considered as an option when you try to protect the castle grounds from unwanted intruders.

Does that mean that this huge Forest is also surrounded by the castle walls as a part of the castle grounds? That's a strange thing to imagine as it's going to be huge like the Great Chinese Wall really and it makes the centaurs trapped in the Forest like in a natural reserve.

Are there any indications in canon sources of how the Forbidden Forest is protected from the sides that are not facing the castle?

**UPD** There is related question as was indicated by @padfoot: [Are the creatures in the forbidden forest stuck on Hogwarts grounds?][1]
The answers there imply that forest creatures are free to leave (and possibly reenter?) the Forbidden Forest. Is it a breach in security that both Dumbledore and the Ministry overlooked?


  [1]: https://scifi.stackexchange.com/questions/191508/are-the-creatures-in-the-forbidden-forest-stuck-on-hogwarts-grounds