Sayyiduna Anas bin Malik (may Allah be pleased with him) narrates that whenever the Prophet Muhammad (peace be upon him) halted at any place, he would perform two rak'ahs before departing from there.
Hadith Referenceصحيح ابن خزيمه / جماع أبواب صلاة التطوع فى السفر / 1260