I have an Ethernet cable which I use to connect to the internet on a desktop Windows machine.

These are the IP settings I gave the Windows machine:

IP adr.
subnet mask
preferred DNS
alternate DNS

Now I am connecting the same Ethernet cable to the Raspberry Pi 3.

I have used:

sudo ifconfig eth0 netmask up
sudo route add default gw eth0

in the terminal.

Then I am not able to use the internet. With the same cable I am able to access the internet on desktop. Why is this not the case for the Pi 3?

How do I proceed?

  • 1
    Can't you use DHCP? That should work out of the box. For static addresses on Raspbian Stretch you should use /etc/dhcpcd.conf. Examples are at the end of that file. And do not modify /etc/network/interfaces. – Dirk Feb 21 '19 at 10:01
  • It's possible that your network uses access control. – RalfFriedl Feb 21 '19 at 17:45
  • Does one of the answers help you? If so it would be nice if you could accept one. – Ingo Apr 10 '19 at 16:54

The ethernet cable has two ends. I assume one end is plugged into a port of your internet router and the other end one time to the desktop machine and the other time to the RasPi.

First of all you should not use the same ip address for the desktop device and for the RasPi. In this case it does not conflict direct because the devices are not connected at the same time but it may confuse the router because it often caches connection parameter.

For your desktop machine you have defined DNS server to use. This isn't the case for the RasPi. You should do it. But if you use a default Raspbian installation this is done in /etc/dhcpcd.conf. Don't do manual settings with ifconfig or ip addr add or within /etc/resolv.conf because this will be overwritten by dhcpcd.

Just edit /etc/dhcpcd.conf and append this entries (you will find some examples there):

static ip_address=
static routers=
static domain_name_servers=

Then restart dhcpcd with:

rpi ~$ sudo systemctl daemon-reload
rpi ~$ sudo systemctl restart dhcpcd.service

Then it should do.

| improve this answer | |

Since you haven't added DNS settings to your Raspberry Pi 3 you are unlikely able to surf the web since you have to use IP adr and cant use URL.

Add your DNS server to the file /etc/resolv.conf

| improve this answer | |

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.