---
slug: "macの、「インターネット共有」を使ってRaspberryPiと接続する(外でRaspberry-Piと接続する時などに)"
title: "Connecting to a Raspberry Pi Using Mac's \"Internet Sharing\" (For External Connections)"
description: ""
url: "https://www.ytyng.com/en/blog/macの、「インターネット共有」を使ってRaspberryPiと接続する(外でRaspberry-Piと接続する時などに)"
publish_date: "2014-06-22T13:08:57Z"
created: "2014-06-22T13:08:57Z"
updated: "2026-02-27T10:32:30.969Z"
categories: ["Raspberry-Pi"]
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20240629/2ab2bc4e16a940a9a720f08fd936bddc.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "en"
---

# Connecting to a Raspberry Pi Using Mac's "Internet Sharing" (For External Connections)

<br/>Recently, I had an opportunity to handle (practice with) a Raspberry Pi with an acquaintance in a location without well-equipped facilities, outside of home or the office.<br/>By using the "Internet Sharing" feature on a Mac, you can set up your equipment with minimal gear.<br/><br/>Normally, to SSH into a Raspberry Pi from a PC, both the Raspberry Pi and the PC need to be on the same LAN.<br/>They obtain IP addresses from a DHCP server, such as the one on your internet router, and communicate within that network.<br/>However, carrying around an internet router can be a bit cumbersome.<br/><br/>The Mac's "Internet Sharing" feature also runs a DHCP server, so it can be used as a substitute for an internet router.<br/><br/>If you have a Mac equipped with both wired Ethernet and wireless capabilities, you can connect to the Raspberry Pi either via wired or wireless connection.<br/>

<div><a href="http://ytyng.com/picture/raspberry-pi/extreme/img_0011.jpg" target="_blank"><img src="http://ytyng.com/picture/raspberry-pi/extreme/img_0011.jpg"/></a></div>

<h3>1. Setting Up the Raspberry Pi (Wired)</h3>

In the default state with Raspbian installed, the Raspberry Pi is set to obtain an IP address from DHCP for a wired connection, so no additional configuration is needed.

<h3>2. Setting Up the Raspberry Pi (Wireless)</h3>

<br/>When connecting the Raspberry Pi via wireless,<br/><br/><a href="http://ag.hatenablog.com/entry/2014/01/13/182102" target="_blank">Raspberry Pi Wireless LAN Setup Notes - Ag Blog</a> <br/>this site is extremely helpful.<br/><br/>Beforehand, decide on the SSID and passphrase you plan to set up on the Mac.<br/>

<pre># sudo wpa_passphrase ESSID pass | sudo tee -a /etc/wpa_supplicant/wpa_supplicant.conf
</pre>

<br/>Run this command to append to the wpa_supplicant configuration.<br/><br/>You can have multiple network sections, so it is a good idea to set it up like this:<br/>

<pre>ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
# For using Mac's "Internet Sharing"
network={
	ssid="ESSID"
	#psk="pass"
	psk=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	proto=RSN
	pairwise=CCMP
	group=CCMP
}
# For connecting to the home network
network={
	ssid="ESSID-HOME"
	#psk="pass"
	psk=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	proto=WPA
	pairwise=CCMP
	group=CCMP
}
</pre>

When connecting to the Mac's wireless LAN, configure it like this:
<pre>	proto=RSN
	pairwise=CCMP
	group=CCMP
</pre>
(This setting is for connecting to "WPA2 Personal")<br/>

<h3>3. Setting Up the Mac</h3>

<br/>Apple Menu → System Preferences → Sharing<br/><br/>Click on "Internet Sharing" within this menu.<br/>

<div><a href="http://ytyng.com/picture/raspberry-pi/extreme/ss1.png" target="_blank"><img src="http://ytyng.com/picture/raspberry-pi/extreme/ss1.png"/></a></div>

<br/>Connect the iPhone 5s and use it as a modem via USB.<br/><br/>Set "Share your connection from" to "iPhone USB".<br/><br/>For "To computers using", check both "Ethernet" (if available) and "Wi-Fi".<br/><br/>Click on Wi-Fi Options and set the "Network Name" and "Password".<br/>

<div><a href="http://ytyng.com/picture/raspberry-pi/extreme/ss2.png" target="_blank"><img src="http://ytyng.com/picture/raspberry-pi/extreme/ss2.png"/></a></div>

Finally, click "Internet Sharing" and click "Start" in the dialog that appears to start internet sharing.

<div><a href="http://ytyng.com/picture/raspberry-pi/extreme/ss3.png" target="_blank"><img src="http://ytyng.com/picture/raspberry-pi/extreme/ss3.png"/></a></div>

<h3>4. Connecting and Restarting the Raspberry Pi</h3>

<br/>For a wired connection, connect the Mac's wired port to the Raspberry Pi.<br/>You can connect directly with a straight cable, or if connecting multiple devices, use a small LAN hub.<br/><br/>For wireless, simply restart the Raspberry Pi with a wireless LAN dongle attached, and it should automatically connect to the Mac.<br/><br/>

<div><a href="http://ytyng.com/picture/raspberry-pi/extreme/img_0012.jpg" target="_blank"><img src="http://ytyng.com/picture/raspberry-pi/extreme/img_0012.jpg"/></a></div>
▲Practicing with the Raspberry Pi in an extreme manner at a certain rental space.
