[openwrt] add new script to configure LTE uplink

This commit is contained in:
Nico Schottelius 2020-09-11 13:23:14 +02:00
parent 8a7acfd23d
commit 55f2843ce3

43
openwrt-add-lte.sh Normal file
View file

@ -0,0 +1,43 @@
#!/bin/sh
# Based on work of Samuel Hailu, 2020-09-10
if [ $# -ne 2 ]; then
echo "$0 ip-address interface"
echo " ip-address: where to find the OpenWRT device"
echo " interface: which interface (eth3 for instance) is the LTE device"
exit 1
fi
my_ip=$1; shift
interface=$1; shift
cat <<EOF | ssh -t "root@${my_ip}"
set -x
# update the sources & allow https handling
opkg update
opkg install libustream-openssl ca-bundle ca-certificates
# Install needed kernel module
opkg install kmod-usb-net-cdc-ether usb-modeswitch
# Create interface
uci set network.LTE=interface
uci set network.LTE.ifname='${interface}'
uci set network.LTE.proto='dhcp'
# add to correct firewall zone
current_networks=\$(uci get firewall.@zone[1].network)
if ! echo \$current_networks | grep -q LTE; then
uci set firewall.@zone[1].network='\${current_networks} LTE'
fi
# commit
uci commit
# reboot
reboot
EOF