A friend set up my Raspberry Pi so that it creates its own wireless network and I can connect to it through SSH over the air. The /etc/network/interfaces file looks like this:
auto lo iface lo inet loopback iface eth0 inet dhcp allow-hotplug wlan0 iface wlan0 inet static address 192.168.1.1 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 up iptables-restore < /etc/iptables.ipv4.nat It's great. The Pi hosts its own wifi network, I can join the network from my laptop and connect to the Pi through ssh [email protected].
But now I need the Pi to access the internet. I connect it to my router with an ethernet cable but it doesn't really work. I can ping 8.8.8.8 and get a response. But ping google.com fails. So there is a DNS problem.
I tried
- adding
nameserver 8.8.8.8at the end of /etc/network/interfaces - adding
allow-hotplug eth0beforeiface eth0 inet dhcp
both of which didn't help.
I looked at the router configuration but didn't quite know what to look for. See screenshots below. One thing I noticed is that the Pi's wlan0 ip is static and set to 192.168.1.1 which is the same address that the router claims for itself (?). But then I thought: Hey, that's a wifi issue and should have nothing to do with my current LAN problem. Correct? Any ideas?

This is the content of /etc/iptables.ipv4.nat:
# Generated by iptables-save v1.4.14 on Mon Aug 11 15:58:35 2014 *nat :PREROUTING ACCEPT [32:5915] :INPUT ACCEPT [30:4763] :OUTPUT ACCEPT [3:226] :POSTROUTING ACCEPT [0:0] -A POSTROUTING -o eth0 -j MASQUERADE COMMIT # Completed on Mon Aug 11 15:58:35 2014 # Generated by iptables-save v1.4.14 on Mon Aug 11 15:58:35 2014 *filter :INPUT ACCEPT [214:21125] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [111:13809] -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT -A FORWARD -i wlan0 -o eth0 -j ACCEPT COMMIT # Completed on Mon Aug 11 15:58:35 2014