0

I have connected my desktop computer (running Ubuntu 16.04) to my Raspberry Pi through a router (ethernet connection). My computer can access internet with USB tethering from my phone. I can SSH to the Raspberry Pi, but it cannot connect to internet.

ping google.com says ping: google.com: Temporary failure in name resolution

sudo apt update says Temporary failure resolving 'raspbian.raspberrypi.org'.

How to forward my computer's internet connection to Raspberry Pi?

The router is only connected to the desktop and the Raspberry Pi.

  • you must enable internet access sharoing on the desktop (i don't remember how to do it with the NetWorkManager of old 16.04) It should be quite simple to achieve :: desktop runs dhcp and add the route (ie acts as a router for the Pi) – cmak.fr Jul 17 at 8:22
0

On the Raspberry Pi, enter this command:

sudo ip route add default via xxx.xxx.xxx.xxx

where xxx.xxx.xxx.xxx is your desktop computer's IP address.

Your RPi already knows where your local network is. This command tells the RPi that there is a route to all other IP addresses (a default route) and it goes through your Ubuntu machine.

You may need to set DNS name servers as well.

  • Does not work. The RPi still does not connect to the internet – Archisman Panigrahi Jul 17 at 7:35
0

I directly connected the Raspberry Pi to my computer through ethernet, and connected a monitor to the Pi. Then I ran ifconfig in the Pi to get its IP address (it was 10.42.0.38, maybe this is the default?)

Then I sshed to the RPi from my desktop, and now it is connected to the internet. However, this does not solve the issue when RPi is connected to a router and there is no way to connect a display.

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.