Sunan Ibn Majah, Book 16, Hadith 51 (Ibn Majah 2486)

It was narrated from 'Abdullah bin Mughaffal that the Prophet (ﷺ) said:

“Whoever digs a well, is entitled to forty forearms' length surrounding it is as a resting place for his flocks.”