6. Given positive integers $a$ and $b$ satisfy the equation $a+2a^2=$ $b+3b^2$. Then the numbers $\sqrt{1+2a+2b}$ and $\sqrt{1+3a+3b}$ are ( ).
(A) both rational numbers
(B) both irrational numbers
(C) one is a rational number, the other is an irrational number
(D) any of the above three situations may occur
6.A.

From the given equation, we have $\frac{a}{b}=\frac{3 b+1}{2 a+1}$.
By the properties of proportions, we have
$$
\frac{a}{b}=\frac{3 a+3 b+1}{2 a+3 b+1}, \frac{a}{b}=\frac{2 a+3 b+1}{2 a+2 b+1} \text {. }
$$

Therefore, $\frac{3 a+3 b+1}{2 a+3 b+1}=\frac{2 a+3 b+1}{2 a+2 b+1}$, which means
$$
(2 a+2 b+1)(3 a+3 b+1)=(2 a+3 b+1)^{2} .
$$

Since $2 a+2 b+1$ and $3 a+3 b+1$ are coprime, both must be perfect squares.