Skip to content

Instantly share code, notes, and snippets.

@deadprogram
Forked from zankich/bbb_connect.sh
Last active September 4, 2015 03:28
Show Gist options
  • Save deadprogram/eea3aabcee1c39dffd7b to your computer and use it in GitHub Desktop.
Save deadprogram/eea3aabcee1c39dffd7b to your computer and use it in GitHub Desktop.
connect to your beaglebone black using the usb->ethernet and forward the internet from your host computer to the beaglebone black
#!/bin/bash
#
# run this script on your linux host computer to connect to the bbb and forward your internet.
# be sure to replace "enp0s20u1" with the appropriate usb device for your bbb, which can be found
# by doing an "ifconfig" on your host computer.
#
sudo -- sh -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'
sudo iptables -A POSTROUTING -t nat -j MASQUERADE
sudo ifconfig enp0s20u1 192.168.7.1 255.255.255.0
ssh [email protected]
#!/bin/bash
#
# run this script on your bbb to use the internet forwarded from your host linux computer
#
ROUTE=`route | grep 0.0.0.0 | wc -l`
if [ $ROUTE -eq 0 ]
then
sudo -- sh -c 'echo "nameserver 8.8.8.8" >> /etc/resolv.conf'
sudo /sbin/route add default gw 192.168.7.1
sudo ntpdate ntp.ubuntu.com
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment