In verse 6, they addressed Yehoshua and Ish Yisrael. Why did they now speak [only] to Yehoshua?
Malbim: They saw that Yisrael doubted their words. They told Yehoshua that they came to make a Bris between their king and him, to help each other; such a Bris is not limited to neighbors.
Why did Yehoshua ask "who are you, and from where are you"?
Malbim: If they are really from so far away, it is not feasible that they will help each other! He asked these two questions, for some the name of the nation is known, and sometimes the country is known. Yehoshua needs to know with whom he makes a Bris!