0

My laptop is connected to the pi through the ethernet port.
And my laptop is connected to the internet through wifi.
I am able to ssh into the pi from the laptop without any problems.
But once I ssh into the pi, I'm not able to ping google or yahoo.
I am using raspbian on the pi.
Here are my config details

Laptop ethernet interface config

ipv4 settings method is "Link-Local Only"
ip 169.254.8.225
broadcast 169.254.255.255
mask 255.255.0.0

Laptop wifi interface config

ipv4 settings method is "Shared to other computers"
ip 192.168.0.103
broadcast 192.168.0.255
mask 255.255.255.0
default route 192.168.0.1
primary dns 192.168.0.1

Pi ethernet interface config in (/etc/network/interfaces)

auto lo
iface lo inet loopback
iface eth0 inet dhcp
netmask 255.255.0.0
gateway 169.254.8.225
broadcast 169.254.255.255

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /ec/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

These are my config details. Am I making a mistake somewhere? Because even after doing all this I am still not able to ping...say google or yahoo from the pi.

On the pi, if I do ping google.com I get ping: unknown host google.com

4
  • You need to allow internet sharing on your laptop. You also need a DHCP server somewhere (do you have a router), unless you assign a fixed address to the Pi. This is not a Pi question, but about how configure the OS on your laptop.
    – Milliways
    Oct 5, 2013 at 7:28
  • 1
    im using linux on my laptop. And I have the wifi connection on my laptop that is set to be shared
    – Jay
    Oct 5, 2013 at 7:56
  • Can you try ping 8.8.8.8 and see the results?
    – hatef
    Feb 4, 2014 at 10:37
  • Have you solved your problem? If so, please mark the answer that helped you, or if you solved it on your own, create a self-answer and mark it as such. We are trying to get the site Q:A ratio up and marking answers is what does that. If you resolved it and mark then people in the future will be able to profit from what you did and it helps move the site closer to graduation. Thanks! Mar 23, 2014 at 17:01

3 Answers 3

1

Ensure you have IP forwarding enabled on the routing machine (your laptop).

echo 1 > /proc/sys/net/ipv4/ip_forward

Source: www.ducea.com

-1

As well as enabling forwarding and providing dns you need to either give the pi an address on your lan and set some complicated routing up, or more easily, add nat. This link should help. http://chrisjrob.com/2011/03/14/sharing-a-wireless-connection-via-ethernet-port/

In your case you could, on the laptop, if you have enabled forwarding and assuming your wireless interface is wlan0, type:

sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
1
  • Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. Dec 14, 2014 at 14:11
-3

This link has got the solution:

https://support.microsoft.com/en-us/kb/99686

1
  • Welcome to Raspberry Pi! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. Mar 27, 2016 at 1:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.