I have a Raspberry Pi 2 Model B V1.1 running Raspbian (I'm not a confident Linux user, but I understand this is the "Jessie" distribution) and have been using it to install matplotlib and other MATLAB-esque packages to work on audio DSP. I had been using an Ethernet cable to attach to my laptop as a access point to the home WiFi router, and would highly prefer to keep this arrangement.
A fortnight ago the Pi couldn't access the internet, though I cannot trace as to where the error is. I have looked at far too many tutorials and suggestions, here and on the Pi forum, which suggested setting up a static IP address, but these have failed to work though I don't understand why.
I'm not qualified or knowledgeable to accurately diagnose the problem, but it stems from having no access to DNS servers for name resolution and an issue with the IP addresses of both the Pi's eth0 port and my PC's Local Area Network port. Pinging both a website name and IP addresses fail, though both give different error messages (see below).
I have attached below some console outputs which I understand are relevant, after picking up several commands from different questions on this site.
pi@raspberrypi ~ $ ifconfig eth0 Link encap:Ethernet HWaddr b8:27:eb:db:f7:7d inet addr:169.254.67.214 Bcast:169.254.255.255 Mask:255.255.0.0 inet6 addr: fe80::ba27:ebff:fedb:f77d/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:50 errors:0 dropped:0 overruns:0 frame:0 TX packets:53 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:7944 (7.7 KiB) TX bytes:12677 (12.3 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:320 errors:0 dropped:0 overruns:0 frame:0 TX packets:320 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:25920 (25.3 KiB) TX bytes:25920 (25.3 KiB) pi@raspberrypi ~ $ route -ne Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 pi@raspberrypi ~ $ hostname -I 169.254.67.214 pi@raspberrypi ~ $ ip -4 addr show | grep global inet 169.254.67.214/16 brd 169.254.255.255 scope global eth0 pi@raspberrypi ~ $ cat /etc/network/interfaces # Please note that this file is written to be used with dhcpcd. # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'. auto lo iface lo inet loopback auto eth0 allow-hotplug eth0 iface eth0 inet manual auto wlan0 allow-hotplug wlan0 iface wlan0 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf auto wlan1 allow-hotplug wlan1 iface wlan1 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf pi@raspberrypi ~ $ cat /etc/resolv.conf # Generated by resolvconf pi@raspberrypi ~ $ cat /etc/dhcpcd.conf # A sample configuration for dhcpcd. # See dhcpcd.conf(5) for details. # Allow users of this group to interact with dhcpcd via the control socket. #controlgroup wheel # Inform the DHCP server of our hostname for DDNS. hostname # Use the hardware address of the interface for the Client ID. clientid # or # Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361. #duid # Persist interface configuration when dhcpcd exits. persistent # Rapid commit support. # Safe to enable by default because it requires the equivalent option set # on the server to actually work. option rapid_commit # A list of options to request from the DHCP server. option domain_name_servers, domain_name, domain_search, host_name option classless_static_routes # Most distributions have NTP support. option ntp_servers # Respect the network MTU. # Some interface drivers reset when changing the MTU so disabled by default. #option interface_mtu # A ServerID is required by RFC2131. require dhcp_server_identifier # Generate Stable Private IPv6 Addresses instead of hardware based ones slaac private # A hook script is provided to lookup the hostname if not set by the DHCP # server, but it should not be run by default. nohook lookup-hostname pi@raspberrypi ~ $ ip link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether b8:27:eb:db:f7:7d brd ff:ff:ff:ff:ff:ff pi@raspberrypi ~ $ ping 22.214.171.124 connect: Network is unreachable pi@raspberrypi ~ $ ping www.duckduckgo.com ping: unknown host www.duckduckgo.com
I would follow the Static IP address answer from: How do I set up networking/WiFi/static IP address? but since the connection was working without any interference I'd like to see if I could just fix something to return to that scenario rather than manually set up the network.
My question is should I overwrite the /etc/networking/interfaces & /etc/dhcpcd.conf with the static IP address I wish to use, or is there a problem preventing the current configuration from running as intended? I know sod all about networking and am struggling to work out where the problem is in this, but I highly appreciate all help with this.