1

I already tried How do I set up networking/WiFi/Static IP but without success.

The IP address I would like to assign the pi would be 10.0.0.5. This worked well and at the time I am connected to it via SSH. But unfortunately I can not resolve any hostnames.

E.g. ping www.google.com results in unknown host but ping 8.8.8.8 works. I also cannot get any packages which is obvious because it cannot resolve the hostnames.

Below is my current /etc/network/interfaces file. The address, netmask and gateway are correct. I also disabled dhcpcd and enabled networking as mentioned in Network Interfaces method at the linked answer. I also tried the dhcpcd method but it is not working either. I am running Raspbian Jessie on it.

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 10.0.0.5
    netmask 255.255.255.0
    gateway 10.0.0.138

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

I cannot find a way to get it working and I am hoping someone could help me to be able to resolve the hostnames again

Nico T
  • 111
  • 1
  • 1
  • 6
  • You don't appear to have defined any dns servers – Steve Robillard Aug 26 '16 at 08:30
  • I had it in the config but it doesn't also if it is defined. Also Milliways said that it wouldn't be necessary to define one – Nico T Aug 26 '16 at 08:33
  • 1
    You probably HAVEN"T followed the tutorial (which still is sub-optimal). List the values you obtained in "Find the Settings of your local Network" – Milliways Aug 26 '16 at 08:33
  • 2
    No I said "this is generally not necessary", because this is often the same as `gateway`. Your `gateway` looks unusual. Also if you want to manually set IP you really need to understand what the settings mean. – Milliways Aug 26 '16 at 08:36
  • You probably don't need a static IP either. – Steve Robillard Aug 26 '16 at 08:37
  • As said @Milliways I also felt the same regarding the gateway. The gateway address looks very much unusual. – Varad A G Aug 26 '16 at 08:46
  • As unusual it looks but the gateway is the right one. I returned `/etc/network/interfaces` to its first state. Tried the dhcpcd method again and now it works. Must have had a typo the first time I tried it. Thanks anyways – Nico T Aug 26 '16 at 08:54
  • You should either answer your own question or in this case delete it.As a typo is not likely too help others. – Steve Robillard Aug 26 '16 at 09:31

3 Answers3

5

You have not defined a DNS-server. You have to manually define that when you are setting a static IP in the /etc/network/interfaces file. If you instead have used to router (or DHCP-server) to assign an IP-address, defining a DNS-server would not be necessary.

Change the following lines:

auto eth0
iface eth0 inet static
address 10.0.0.5
netmask 255.255.255.0
gateway 10.0.0.138

to

auto eth0
iface eth0 inet static
address 10.0.0.5
netmask 255.255.255.0
gateway 10.0.0.138
dns-nameservers 8.8.8.8 8.8.4.4

where 8.8.8.8 and 8.8.4.4 is the DNS servers (in this case it is googles primary and secondary DNS)

Orphans
  • 222
  • 2
  • 9
  • Use `1.1.1.1` and `1.0.0.1` for CloudFlare DNS servers if you don't like Google (they're [also 25% faster](https://www.dnsperf.com/#!dns-resolvers)). – MS Berends May 01 '20 at 14:40
  • It was just an example, however - you should not give cloudflare your data either – Orphans May 05 '20 at 06:17
1

You said:

I also tried the dhcpcd method but it is not working either

For anyone who uses this method (like me) by editing /etc/dhcpcd.conf, you should set the DNS servers accordingly:

interface eth0
# your static IP address:
static ip_address=192.168.1.251/24
static routers=192.168.1.1
# CloudFlare DNS servers (faster than Google, and... it's not Google)
static domain_name_servers=1.1.1.1 1.0.0.1

Reboot:

sudo reboot now

And confirm:

cat /etc/resolv.conf
# Generated by resolvconf
# nameserver 1.1.1.1
# nameserver 1.0.0.1
MS Berends
  • 113
  • 4
0

see this video for how to fix wifi instance on Rasbian Jessie 1.3.6 and OctoPi 0.14.0

https://www.youtube.com/watch?v=dZeJb6Jv-9E

From Wheezy to Jessie they changed the way that the wifi instance connects to router using a static ip address... (or something, Im not a developer...)

tyler
  • 1