Skip to content

Instantly share code, notes, and snippets.

@rklancer
Created July 27, 2013 20:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rklancer/6096148 to your computer and use it in GitHub Desktop.
Save rklancer/6096148 to your computer and use it in GitHub Desktop.
Rasbpi setup for internet over direct ethernet connection to a Mac running Mountain Lion
Lives at https://www.dropbox.com/s/nrnwn27vqal93mg/rasbpi-setup.txt
d/l latest raspbian from http://www.raspberrypi.org/downloads
connect sd card reader, then at the command line:
$ diskutil list
# identify the disk (not partition) of your SD card. e.g. disk2 (not disk2s1)
$ diskutil unmountDisk /dev/<disk# from diskutil>
$ sudo dd bs=1m if=<your image file>.img of=/dev/rdisk<disk # from diskutil>
# for additional speed, we are prepending "disk" with "r" (for raw)
# e.g. sudo dd bs=1m if=~/Downloads/013-05-25-wheezy-raspbian.img of=/dev/rdisk2
# (This will take about 2 minutes)
$ cd /Volumes/boot # or whatever the volume is called
# OS X puts these here, but they screw up the RPi boot process
$ rm -rf ._.Trashes
$ rm -rf .Trashes
$ rm -rf .fseventsd
# now set up so we can share internet
# REFERENCES:
# http://blog.afkham.org/2013/02/how-to-connect-raspberry-pi-to-internet.html
# http://pihw.wordpress.com/guides/direct-network-connection/
Open Network Preferences -> Ethernet
Configure IPv4: Manually
IP Address: 192.168.2.1
Subnet mask: 255.255.255.0
System Preferences -> Sharing
make sure Internet Sharing is *OFF* (it screws up ssh)
$ cd /Volumes/boot
$ subl cmdline.txt:
# add 192.168.2.2 to the end of the single line in this file.
$ diskutil unmountDisk /dev/disk<#>
attach the RPi to the ethernet cable and the ethernet cable to the computer, insert SD card, and boot up. Wait a couple minutes, then:
$ ssh pi@192.168.2.2
password: "raspberry"
Now, on the pi:
pi$ nano /boot/cmdline.txt
# REMOVE the 192.168.2.2 from the file (we're going to use /etc/network/interfaces instead)
pi$ nano /etc/network/interfaces
remove all lines about eth0 and add the following stanza:
auto eth0
iface eth0 inet static
address 192.168.2.2
netmask 255.255.255.0
gateway 192.168.2.1
Shut down the Pi:
pi$ sudo shutdown -h 0
Finally, turn sharing back on:
System Preferences -> Sharing
select share your connection from "WiFi"
to computers using: "Ethernet"
*now*, check "Internet Sharing" and click "start" when prompted
Finally, powercycle the Pi, and connect to it:
$ ssh pi@192.168.2.2
# may seem to hang for a minute or two while the pi boots up
and check the internet connection:
pi$ ping www.google.com
PING www.google.com (173.194.43.51) 56(84) bytes of data.
64 bytes from lga15s35-in-f19.1e100.net (173.194.43.51): icmp_req=1 ttl=54 time=17.0 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment