"The LORD spoke to Moses and to Aaron, saying: Each man by his standard, with the banners of their fathers' houses, etc." (Numbers 2:1-2). Let our master teach us: Within how many cubits is a person permitted to walk on the Sabbath? Thus did our masters teach: One who rests for the Sabbath while on the road makes himself circles up to four cubits — these are the words of R. Hananyah ben Antigonus — and he carries within four cubits on the Sabbath, and he says, "My Sabbath rest is in my place," and his place acquires for him two thousand cubits in every direction. And how much are four cubits? R. Judah says: Enough that he may take a jug from at his feet and place it at his head. And one who rests for the Sabbath in a city, even if it is as large as Antioch, may walk through all of it, and its outskirts, and beyond its outskirts two thousand cubits. And what are its outskirts? The shops and the inns that are outside the city upon the road. And one who rests for the Sabbath in a cave, even if it is as large as the cave in which Zedekiah king of Judah fled, which was twelve miles, may walk through all of it, and beyond it two thousand cubits in any direction he wishes. And from where did the Sages derive support? From the words of the Torah, [as it is said:] "And you shall measure outside the city the east side, two thousand by the cubit, etc." (Numbers 35:5). And likewise you find with Joshua, when he went to destroy Jericho: Joshua said to them, "You are destined to observe the Sabbath there. Do not go far from the Ark more than two thousand cubits in every direction" — so that you may be permitted to come to pray before the Ark on the Sabbath. And so it says: "Yet there shall be a distance between you and it of about two thousand cubits by measure" (Joshua 3:4). And likewise you find, when God said to Moses that he should settle Israel by standards, He said to him: Settle them by their standards in every direction. From where? From what they read on the matter: "Each man by his standard, with the banners of their fathers' houses, shall they encamp" (Numbers 2:2).
Sabbath Boundaries and the Tribal Standards in Bamidbar
Midrash Tanchuma Buber, Bamidbar 9:1
וידבר ה' אל משה ואל אהרן לאמר איש על דגלו באותות לבית אבותם וגו' (במדבר ב א ב), ילמדנו רבינו בתוך כמה אמות מותר לאדם להלך בשבת, כך שנו רבותינו, השובת בדרך עושה לו עגולות עד ארבע אמות, דברי ר' חנניא בן אנטיגנוס, ומטלטל בתוך ארבע אמות בשבת ואומר שביתתי במקומי, וזכה לו מקומו אלפים אמה לכל רוח ורוח, וכמה הן ד' אמות, ר' יהודה אומר כדי שיטול חבית מן מרגלותיו ויתננה במראשותיו, והשובת במדינה אפי' היא גדולה כאנטוכיא מהלך את כולה, ועיבורה וחוץ מעיבורה אלפים אמה, ומהו עיבורה, החנויות והפונדקיות שחוץ למדינה על הדרך, והשובת במערה, אפי' היא גדולה כמערה שברח בה צדקיה מלך יהודה, שהיה בה שנים עשר מיל, מהלך את כולה, וחוץ ממנה אלפים אמה לכל רוח שירצה, ומנין סמכו חכמים, מדברי תורה [שנאמר] ומדותם מחוץ לעיר את פאת קדמה אלפים באמה וגו' (במדבר לה ה), וכל אתה מוצא ביהושע כשהלך להחריב את יריחו, אמר להם יהושע עתידים אתם לעשות שם את השבת, אל תרחקו מן הארון יותר מן אלפים אמה לכל רוח, למה שתהיו רשאין לבוא להתפלל לפני הארון בשבת, וכן הוא אומר אך רחוק יהיה ביניכם וביניו כאלפים אמה במדה (יהושע ג ד), וכן אתה מוצא כשאמר האלהים למשה שישרה את ישראל דגלים, א"ל השרה אותם לדגליהם לכל רוח, מנין ממה שקראו בענין איש על דגלו באותות לבית אבותם יחנו.