Blog/20141105 OS X Lion 10.7 Internet Sharing with Raspberry Pi

From Bjoern Hassler's website
Jump to: navigation, search

More from B's blog:

Some older entries are here.

OS X Lion 10.7 Internet Sharing with Raspberry Pi

We're thinking about Raspberry Pi, and one question is how you access the Raspberry Pi, if you don't have a screen / keyboard handy. There are various options, but one option is to connect to the Pi from another computer via ethernet (say a laptop). This requires your Pi and laptop to be on the same network. If you have a router handy, you can connect both to the router (e.g. your broadband router).

If you don't have a router handy, you can use internet sharing. Hwoever, in OS X Lion (10.7.5) there's a problem with the internet sharing. Let's say you have internet via WiFi, and you want to share that connection to the Pi via wired internet. It turns out that the macbook doesn't hand out an IP address to the Pi, i.e. DHCP somehow doesn't work, see e.g. [1].

So suppose you've got this setup:

  • Preferences > Sharing
    • Share your connection from: Wi-Fi
    • To computers using: (USB) Ethernet
    • (And enable "Service", "Internet Sharing", On)

Then in "Preferences > Network", under (USB) Ethernet, you see an IP address "169.254.x.x", which means that DHCP is somehow not working.

To fix this (see [2]), you do this:

  • Preferences > Network, "(USB) Ethernet"
    • Configure IPv4: Manually
    • IP Address: 192.168.2.2
    • Subnet Mask: 255.255.255.0
    • Router: 192.168.2.1
    • DNS Server: 192.168.2.1 (set in "Advanced > DNS")

Hit "Apply", and hey presto, your Raspberry Pi (connected via ethernet cable) gets allocated 192.168.2.3.

In fact, if you open a terminal and run

cat /private/var/db/dhcpd_leases

you should see something like

      name=raspberrypi
      ip_address=192.168.2.3

(assuming that you haven't changed the hostname). You can now e.g. use ssh to connect to the Raspberry Pi.


2014-11-05 | Leave a comment | Back to blog Share on Twitter Share on Facebook