I've just opened the pi for the first time, with Raspbian Buster Lite. When I type route -n I get:

Destination Gateway Genmask Flags Metric Ref Use Iface

I would expect to see the gateway ip here.

If if try sudo route add default gw I get SIOCADDRT: Network is unreachable.

Some context: I'm trying to ssh into the pi, without success so far even though ssh is enabled. (getting a ssh: connect to host xxx.xxx.x.xxx port 22: Connection refused)

  • Routing table can only be empty if you have no network interfaces that are up. How do you plan to connect to the network anyway? WiFi? – Dmitry Grigoryev Jul 19 at 8:16

After a lot of trials to setup the pi with wifi, I gave up on solving this with wifi alone and ended up connecting the pi via ethernet cable. Just plug the cable and that's it!

Now route -n returns two rows.

(I will not mark my answer as accepted, as perhaps there are better ways to solve this)

  • Do you had a problem with wifi? It wasn't clear from the question. So your solution is to use the wired connection instead of wifi? – Ingo Jul 18 at 18:37
  • The pi was never connected to the internet in any way. And I was trying to setup it up for the first time using wifi. I didn't manage, while with ethernet is automatic, just plug the cable and the pi gets the default gateway. – Rexcirus Jul 18 at 18:43
  • Something confusing in my question (which now I edited) is that I was initially thinking to have the pi connected, but this was not true. – Rexcirus Jul 18 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.