I'm trying to show that $(n-1)^2+n^2+(n+1)^2=a^2$ does not have a solution for $n,a\in \Bbb N$. I've written $(n-1)^2+n^2+(n+1)^2=3n^2+2$, so what I need to show is that $3n^2+2$ cannot be a perfect square. From here and here I understand that there is some relationship between perfect squares and modulo, but I fail to see which is it or how should apply it in my case. I do understand, however, that, in the case of 5 consecutive numbers, $n^2+2$ needs to be a multiple of 5.
You are nearly there. Now just use the fact that $a^2 \ne 2 \pmod 3$.
The proof is here, which relies on the fact that you can just check $n=0,1,2$ (or even better, $n=-1,0,1$) for a result that holds for all natural $n$.
Toby Mak's hint settles the question but I would like to rephrase the answer without using congruences to make it comprehensible to those not-so-much into math, as this result comes up on the first page in Google search.
In order to show that
$$ (n - 1)^2 + n^2 + (n + 1)^2 \neq a^2 $$ $$ n, a \in \mathbb N $$
We will try to perform reductio ad absurdum by assuming that there is $a \in \mathbb N$ that satisfies the equation: $$ (n - 1)^2 + n^2 + (n + 1)^2 = a^2 $$ We expand the left-hand side of the equation and thus get: $$ 3n^2 + 2 = a^2 $$
Notice that the left-hand side of the equation divided by $3$ gives a remainder of $2$. That implies a question - what is the remainder of the right-hand side when divided by $3$?
We've got three cases to consider $$ a = 3k + 0 \lor a = 3k + 1 \lor a = 3k + 2, k \in \mathbb N $$ It's clear that if $a = 3k$ then the remainder of $a^2$ is $0$.
If $a = 3k + 1$ , then $a^2 = 3(3k^2 + 2k) + 1$ and thus the remainder is $1$.
If $a = 3k + 2$ , then $a^2 = 3(3k^2 + 4k + 1) + 1$, so the remainder is again $1$.
Hence, we arrived to a contradiction as it is imposible for a number which divided by 3 gives the remainder of $2$ to be equal to a number which divided by $3$ gives a remainder of $0$ or $1$.