2. In Rt $\triangle A B C$, $a$, $b$, and $c$ represent the lengths of the three sides. If $\frac{a+b+c}{a+c}=\sqrt{2}$, then the ratio of the three sides of Rt $\triangle A B C$ is $(\quad)$.
(A) $1: 2: \sqrt{5}$
(B) $1: 1: \sqrt{2}$
(C) $1: \sqrt{2}: \sqrt{3}$
(D) $1: \sqrt{3}: 2$
2.B.

From $\frac{a+b+c}{a+c}=\sqrt{2}$, we get $\sqrt{2}-1=\frac{b}{a+c}$, which means $a+c=(\sqrt{2}+1) b$.
If $b$ is the hypotenuse, then $a+c<2 b$. This contradicts the given condition, so $b$ is not the hypotenuse.
Among $a$ and $c$, let's assume $c$ is the hypotenuse, thus,
$$
a^{2}+b^{2}=c^{2}=[(\sqrt{2}+1) b-a]^{2} \text {. }
$$

Simplifying this, we get $a=b$.
Therefore, $a: b: c=1: 1: \sqrt{2}$.