Skip to content

Instantly share code, notes, and snippets.

@Mathews2115
Last active February 8, 2020 10:53
Show Gist options
  • Save Mathews2115/30dda785ae9ad95e8a69e63b1b65009c to your computer and use it in GitHub Desktop.
Save Mathews2115/30dda785ae9ad95e8a69e63b1b65009c to your computer and use it in GitHub Desktop.
Pi networking Cheat Sheet

Goals:

  • Eliminate all hotplug/auto networking interfacing on bootup
  • Get 2 RPI3 to talk to each other, one being the Outer Pi and one being the Inner Pi
  • Outer Pi has access to the internet, inner pi can get access to the net through the Outer Pi
  • helpful links
  • (setting up wifi manually, node, etc) https://www.w3schools.com/nodejs/nodejs_raspberrypi.asp

Outer Pi (access to the internet)

  • (disable all AUTO network interfaces…we are manually configuring from here on out)
    • sudo update-rc.d dhcpcd disable
  • put the below chunk in /etc/rc.local
#Manually set up network interfaces since we disabled dhcp
ip link set eth0 up
ip addr add 10.66.66.1/24 dev eth0

#forward stuff to inside pi
sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

#uncomment the below to connect to wifi
#ip link set wlan0 up
#wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
#dhclient -v wlan0
  • Above, where you see 'uncomment the below to connect to wifi: when you do want to connect, well need to setup your ssid>
  • sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
  • put the below chunk in the wpa_supplicant.conf file:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
    ssid=“THE SSID“
    psk=“THE PASSOWRD”
}
  • this should be it for the outer pi. Now for the inner pi...

Inner Pi

  • (disable all AUTO network interfaces…we are manually configuring from here on out)
    • sudo update-rc.d dhcpcd disable
  • put the below chunk in /etc/rc.local
ip link set eth0 up
ip addr add 10.66.66.2/24 dev eth0
ip route add default via 10.66.66.1

disabling bt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment