וקשרתם לאות על ידך והיו לטטפת בין עיניך. נתבאר בס׳ שמות ס״פ בא דזה הלשון ענינו דקשירת תפלין המה כלי מלחמה נגד המפריעים לשמור סגולת היהדות בשני אופני מלחמה שמועיל החרב כמבואר שם בארוכה: And you shall tie them as a sign on your hand, and they shall be for totaphoth between your eyes. It was explained in the Book of Exodus at the end of Parshas Bo (Netziv to Exodus 13:16), that this language's meaning is that the tying of Tefillin is like weapons of war against that which interferes with the guarding of Jewish virtue, in the two aspects of war in which the sword can be effective, as was explained there at length.
וכתבתם על מזזות ביתך. על משמעו לקבוע במסמר על המזוזה מבחוץ: And you should write them on the doorposts of your houses. "On" implies that they should be set with a nail on the outside of the doorpost.
ובשעריך. משמע לחקוק בשער ולתחוב הפ׳ בחקיקת מזוזת השער. ומובן דה״ה להיפך כשר אלא אורחא דמילתא דבבית שהוא מקום משומר ונקי יותר טוב שיהא נראה הפ׳ מבחוץ ובשערי הצרות ועיר שאין המקום משומר ונקי כ״כ יותר טוב שיהא סגור: And on your gates. This implies to carve into the gate and to inset the passage into the carving on the doorpost of the gate . And it is understood that the opposite is also valid, but the way of things is that in the house, which is a clean and protected place, it is better that the passage should be visible on the outside, and on the gates of the city, where the place is not clean and protected so much, it is better that they [the words] be enclosed.