Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@julianduque
Last active August 16, 2022 14:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julianduque/8b5612db7f761976a294 to your computer and use it in GitHub Desktop.
Save julianduque/8b5612db7f761976a294 to your computer and use it in GitHub Desktop.
Share internet with BeagleBone Black
#!/bin/bash
# bbb.sh -- Share Internet with the BeagleBone Black
# using my Linux HOST as a router
bbbAddr="192.168.7.2"
hostAddr="192.168.7.1"
# Configure IP forwarding on HOST
echo "Setting up Routing"
sudo iptables -A POSTROUTING -t nat -j MASQUERADE
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward > /dev/null
echo "Configuring Router"
ssh root@$bbbAddr "/sbin/route add default gw $hostAddr"
# Add Google DNS Servers
echo "Configuring DNS"
ssh root@$bbbAddr "echo nameserver 8.8.8.8 > /etc/resolv.conf"
ssh root@$bbbAddr "echo nameserver 8.8.4.4 >> /etc/resolv.conf"
# Set date
echo "Setting Date"
ssh root@$bbbAddr "ntpdate -b -s -u pool.ntp.org"
@spoutnik16
Copy link

not working, /etc/resolv.conf is rewritten at boot

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