Last active
August 16, 2022 14:14
-
-
Save julianduque/8b5612db7f761976a294 to your computer and use it in GitHub Desktop.
Share internet with BeagleBone Black
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
not working, /etc/resolv.conf is rewritten at boot