-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstructions.txt
102 lines (59 loc) · 2.38 KB
/
Instructions.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# tethered_iphone_raspberry_pi
How to setup Internet sharing with an iPhone and raspberry pi
NOTE: this setup is for a raspberry pi 2 without Wi-Fi, for newer models with Wi-Fi you'll probably see an interface called 'wlan0' which should be disabled or added to the bridge/disabled, and should be stopped from handing out IP-adresses (step 9.1).
1. Install Raspian on raspberry pi: https://www.raspberrypi.com/software/
2. Update and upgrade system:
pi# sudo apt update & sudo apt upgrade
3. Install usb handler to connect iPhone:
pi# sudo apt install usbmuxd
4. Connect iPhone and enable iPhone hotspot, select “trust” when prompted, and check that you get a new interface eth1 with an IP:
pi# sudo ifconfig -a
5. Create bridge:
pi# sudo nano /etc/systemd/network/bridge-br0.netdev
5.1 Add the following lines in the file:
[NetDev]
Name=br0
Kind=bridge
5.2 Ctrl+X to save and exit.
6. Make eth0 member of the bridge:
pi# sudo nano /etc/systemd/network/br0-member-eth0.network
6.1 Add the following lines in the file:
[Match]
Name=eth0
[Network]
Bridge=br0
6.2 Ctrl+X to save and exit.
7. Make eth1 member of the bridge:
pi# sudo nano /etc/systemd/network/br0-member-eth1.network
7.1 Add the following lines in the file:
[Match]
Name=eth1
[Network]
Bridge=br0
7.2 Ctrl+X to save and exit.
8. Enable the systemd-networkd service to create and populate the bridge when your Raspberry Pi boots:
pi# sudo systemctl enable systemd-networkd
9. Set static fallback IP, make sure DHCP is not handed out on eth0 and eth1, and make br0 handle DHCP-requests:
pi# sudo cp /etc/dhcpcd.conf /etc/dhcpcd.conf.back
pi# sudo nano /etc/dhcpcd.conf
9.1 Add to the top of the file:
# Disable DHCP on interfaces that are bridged:
denyinterfaces eth0 eth1
9.2 Comment out following in the static IP section (change IP information to fit your network):
# It is possible to fall back to a static IP if DHCP fails:
# define static profile
profile static_eth0
static ip_address=192.168.0.65/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
# fallback to static profile on eth0
interface eth0
fallback static_eth0
9.3 Add as last lines:
# Add bridged interface:
interface br0
9.4 Ctrl+X to save and exit.
10. Reboot:
pi# sudo reboot now
11: Connect iPhone via USB and connect Ethernet to laptop and check you get an IP on your laptop from the iPhone (typically 172-range):
pi# sudo ifconfig -a