2. Ta có: $a+2b=2 \Rightarrow 0\le a\le 2$
$\Rightarrow P=\dfrac{a}{2-a+1}+\dfrac{2-a}{a+1}=\dfrac{a}{3-a}+\dfrac{2-a}{a+1}=\dfrac{2(a^2-2a+3)}{(3-a)(a+1)}$
Ta có:
$P=1+\dfrac{3(a-1)^2}{(3-a)(a+1)}\ge 1 \Rightarrow \min P=1 \Leftrightarrow a=1$
$P=2+\dfrac{4a(a-2)}{(3-a)(a+1)}\le 2 \Rightarrow \max P=2 \Leftrightarrow \left[\begin{array}{l}a=0\\a=2\end{array}\right.$