aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/network_beaglebone.sh13
-rw-r--r--scripts/network_host.sh11
2 files changed, 24 insertions, 0 deletions
diff --git a/scripts/network_beaglebone.sh b/scripts/network_beaglebone.sh
new file mode 100644
index 0000000..11fdce4
--- /dev/null
+++ b/scripts/network_beaglebone.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+# Config
+NAMESERVER="162.19.75.102"
+
+# Setup
+ifconfig eth0 down
+ifconfig usb1 down
+ifconfig usb0 10.0.0.2/24
+iptables -F
+ip route del default
+ip route add default via 10.0.0.1 dev usb0
+echo "nameserver ${NAMESERVER}" > /etc/resolv.conf
diff --git a/scripts/network_host.sh b/scripts/network_host.sh
new file mode 100644
index 0000000..d48b90b
--- /dev/null
+++ b/scripts/network_host.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+# Config
+INTERNET_INTERFACE="wlp0s20f3"
+BEAGLEBONE_INTERFACE="enp0s20f0u4u4u2"
+
+# Setup
+iptables -F
+iptables -t nat -A POSTROUTING -o ${INTERNET_INTERFACE} -j MASQUERADE
+iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
+iptables -A FORWARD -i ${BEAGLEBONE_INTERFACE} -o ${INTERNET_INTERFACE} -j ACCEPT