2. A cube is painted red on all its faces, then cut into $n^{3}(n>2)$ identical smaller cubes. If the number of smaller cubes with only one face painted red is the same as the number of smaller cubes with no faces painted red, then $n=$ $\qquad$ .
2.8.

The total number of small cubes with only one face painted red is $6(n-2)^{2}$, and the total number of small cubes with no faces painted red is $(n-2)^{3}$. According to the problem,
$$
6(n-2)^{2}=(n-2)^{3} \Rightarrow n=8 \text {. }
$$