1

I have a mac and raspberry pi connected via ethernet cable which are communicated fine. Internet sharing is turned on but my raspberry pi can't connect to the internet.

My mac is connected to the internet via Wifi with the following settings: enter image description here

Internet is working on my mac and have connected an ethernet cable between my mac and my raspberry pi. I turned on internet sharing on my mac and gave the ethernet the following settings: enter image description here

I gave my raspberry pi a static IP address in the same subnet (192.168.1.20) by editing the network/interaces file and set the gateway the same as my Macs ip address, which looks like this:

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.20
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.90
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

I can ping from my RPi to my mac (ping 192.168.1.90) and can ssh into my RPi from my mac (set up previously; ssh [email protected]).

The problem: I can't seem to connect to the internet. Running sudo apt-get update shows errors in the lines of "temporary failure resolving archive.raspberrypi.org'. Any help or advice is appreciated.

Update 1: The output of "route" is (after waiting many seconds):

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.254   0.0.0.0         UG    0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
9
  • try changing the gateway to the router ip address of 192.168.1.254
    – rob
    Commented Nov 4, 2014 at 10:33
  • I tried but 'sudo apt-get update' still gives the same error that it cannot connect..
    – crazjo
    Commented Nov 4, 2014 at 10:46
  • what is the output of the command "route"? and can you ping google.com?
    – rob
    Commented Nov 4, 2014 at 10:48
  • I added the output of "route" to the post above. If I type "ping google.com" nothing happens and after a long while it says "ping: unknown host google.com"
    – crazjo
    Commented Nov 4, 2014 at 10:54
  • Do you have the DNS set correctly? I also had an issue with Mac Internet Sharing, and rebooting fixed my issue.
    – baum
    Commented Nov 4, 2014 at 13:56

2 Answers 2

2

Your route is incorrect: default 192.168.1.254

If your gateway (in this case the Mac) is at .1.90, your gateway has to be at .1.90

If you have just set the fixed IP in network/interfaces, then you may need to restart your networking stack (/etc/init.d/network restart).

Also check your current network configuration with "ifconfig eth0", you may see the problem right there. To fix your route do this: "route add default gw 192.168.1.90"

0

You have to enable this in 'Sharing' under 'Settings'

Follow this

http://millibit.blogspot.com/2014/12/ceph-pi-making-pi-with-mac.html#internet_sharing

1

Your Answer

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

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