We consider an electric network on the $d$-dimensional integer lattice with an edge between every two points $x$ and $y$. The conductance of the edge $\{x,y\}$ equals $\|x-y\|^{-s}$, for some $s>d$. We show that the random walk on this network is recurrent if and only if $d \in \{1,2\}$ and $s\geq 2d$. We also discuss how this result relates to the return properties of random walks on percolation clusters, particularly on the two-dimensional weight-dependent random connection model.