Skip to content

Commit

Permalink
Merge pull request #8 from vahid-dan/main
Browse files Browse the repository at this point in the history
LoRa pendant fix and config improvement
  • Loading branch information
vahid-dan authored Aug 31, 2023
2 parents 50be239 + 20f8f1b commit 9dfa935
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 65 deletions.
5 changes: 3 additions & 2 deletions gateways/base/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ export lora_radio_mode=$(yq e '.lora_radio.mode' $config_file)
export lora_radio_serial_interface=$(yq e '.lora_radio.serial_interface' $config_file)
export lora_radio_lora_interface=$(yq e '.lora_radio.lora_interface' $config_file)
export lora_radio_evio_interface=$(yq e '.lora_radio.evio_interface' $config_file)
export lora_radio_switch_interface=$(yq e '.lora_radio.switch_interface' $config_file)
export lora_radio_uplink_interface=$(yq e '.lora_radio.uplink_interface' $config_file)
export lora_radio_node_ip=$(yq e '.lora_radio.node_ip' $config_file)
export lora_radio_switch_ip=$(yq e '.lora_radio.switch_ip' $config_file)
export lora_radio_node_netmask=$(yq e '.lora_radio.node_netmask' $config_file)
export lora_radio_lora_gateway_ip=$(yq e '.lora_radio.lora_gateway_ip' $config_file)
export lora_radio_baud_rate=$(yq e '.lora_radio.baud_rate' $config_file)
export lora_radio_mtu=$(yq e '.lora_radio.mtu' $config_file)
export lora_radio_rate=$(yq e '.lora_radio.rate' $config_file)
Expand Down
16 changes: 9 additions & 7 deletions gateways/config-files/annie/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,20 @@ lora_radio:
mode: noevio # "evio", "noevio", "noevio-nat", or "pendant"
serial_interface: ttyUSB0
lora_interface: tnc0
evio_interface: appCIBR6
switch_interface: enp1s0
node_ip: 10.10.101.2/24 # ip/netmask
switch_ip: 10.10.101.1/24 # ip/netmask, IP address of the gateway on the other side of the LoRa link
evio_interface: appCIBR6 # For "evio" mode
uplink_interface: enp1s0 # For "noevio-nat" mode, Interface on the other side of the LoRa link with internet access
node_ip: 10.10.101.2
node_netmask: /24
lora_gateway_ip: 10.10.101.1 # For "pendant" mode, IP address of the gateway on the other side of the LoRa link
baud_rate: 115200
mtu: 400 # bytes
rate: 20 # kbit
burst: 32 # kbit
latency: 400 # ms
ingress_policing_rate: 10 #kbit
ingress_policing_burst: 10 #kbit

ingress_policing_rate: 10 # kbit, For "evio" mode
ingress_policing_burst: 10 # kbit, For "evio" mode
nebula_overlay_network:
is_enabled: true
log_file: nebula-overlay-network.log

14 changes: 8 additions & 6 deletions gateways/config-files/bita/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,20 @@ lora_radio:
mode: noevio # "evio", "noevio", "noevio-nat", or "pendant"
serial_interface: ttyUSB0
lora_interface: tnc0
evio_interface: appCIBR6
switch_interface: enp1s0
node_ip: 10.10.101.2/24 # ip/netmask
switch_ip: 10.10.101.1/24 # ip/netmask, IP address of the gateway on the other side of the LoRa link
evio_interface: appCIBR6 # For "evio" mode
uplink_interface: enp1s0 # For "noevio-nat" mode, Interface on the other side of the LoRa link with internet access
node_ip: 10.10.101.2
node_netmask: /24
lora_gateway_ip: 10.10.101.1 # For "pendant" mode, IP address of the gateway on the other side of the LoRa link
baud_rate: 115200
mtu: 400 # bytes
rate: 20 # kbit
burst: 32 # kbit
latency: 400 # ms
ingress_policing_rate: 10 #kbit
ingress_policing_burst: 10 #kbit
ingress_policing_rate: 10 # kbit, For "evio" mode
ingress_policing_burst: 10 # kbit, For "evio" mode

nebula_overlay_network:
is_enabled: true
log_file: nebula-overlay-network.log

14 changes: 8 additions & 6 deletions gateways/config-files/bjorn/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,20 @@ lora_radio:
mode: noevio # "evio", "noevio", "noevio-nat", or "pendant"
serial_interface: ttyUSB0
lora_interface: tnc0
evio_interface: appCIBR6
switch_interface: enp1s0
node_ip: 10.10.101.2/24 # ip/netmask
switch_ip: 10.10.101.1/24 # ip/netmask, IP address of the gateway on the other side of the LoRa link
evio_interface: appCIBR6 # For "evio" mode
uplink_interface: enp1s0 # For "noevio-nat" mode, Interface on the other side of the LoRa link with internet access
node_ip: 10.10.101.2
node_netmask: /24
lora_gateway_ip: 10.10.101.1 # For "pendant" mode, IP address of the gateway on the other side of the LoRa link
baud_rate: 115200
mtu: 400 # bytes
rate: 20 # kbit
burst: 32 # kbit
latency: 400 # ms
ingress_policing_rate: 10 #kbit
ingress_policing_burst: 10 #kbit
ingress_policing_rate: 10 # kbit, For "evio" mode
ingress_policing_burst: 10 # kbit, For "evio" mode

nebula_overlay_network:
is_enabled: true
log_file: nebula-overlay-network.log

13 changes: 7 additions & 6 deletions gateways/config-files/carina/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,18 @@ lora_radio:
mode: noevio # "evio", "noevio", "noevio-nat", or "pendant"
serial_interface: ttyUSB0
lora_interface: tnc0
evio_interface: appCIBR6
switch_interface: enp1s0
node_ip: 10.10.101.2/24 # ip/netmask
switch_ip: 10.10.101.1/24 # ip/netmask, IP address of the gateway on the other side of the LoRa link
evio_interface: appCIBR6 # For "evio" mode
uplink_interface: enp1s0 # For "noevio-nat" mode, Interface on the other side of the LoRa link with internet access
node_ip: 10.10.101.2
node_netmask: /24
lora_gateway_ip: 10.10.101.1 # For "pendant" mode, IP address of the gateway on the other side of the LoRa link
baud_rate: 115200
mtu: 400 # bytes
rate: 20 # kbit
burst: 32 # kbit
latency: 400 # ms
ingress_policing_rate: 10 #kbit
ingress_policing_burst: 10 #kbit
ingress_policing_rate: 10 # kbit, For "evio" mode
ingress_policing_burst: 10 # kbit, For "evio" mode

nebula_overlay_network:
is_enabled: true
Expand Down
20 changes: 11 additions & 9 deletions gateways/config-files/diana/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ git_garbage_collector:
- /data/diana-logs

health_checks_io:
is_enabled: true
is_enabled: false
log_file: health-checks-io.log
ping_url: https://hc-ping.com/8c074ee7-de97-4c50-9dfc-987386c0d886
max_time: 60
max_time: 300
retry: 5

reverse_ssh:
Expand Down Expand Up @@ -88,18 +88,20 @@ lora_radio:
mode: pendant # "evio", "noevio", "noevio-nat", or "pendant"
serial_interface: ttyUSB0
lora_interface: tnc0
evio_interface: appCIBR6
switch_interface: enp1s0
node_ip: 10.10.101.2/24 # ip/netmask
switch_ip: 10.10.101.1/24 # ip/netmask, IP address of the gateway on the other side of the LoRa link
evio_interface: appCIBR6 # For "evio" mode
uplink_interface: enp1s0 # For "noevio-nat" mode, Interface on the other side of the LoRa link with internet access
node_ip: 10.10.101.2
node_netmask: /24
lora_gateway_ip: 10.10.101.1 # For "pendant" mode, IP address of the gateway on the other side of the LoRa link
baud_rate: 115200
mtu: 400 # bytes
rate: 20 # kbit
burst: 32 # kbit
latency: 400 # ms
ingress_policing_rate: 10 #kbit
ingress_policing_burst: 10 #kbit

ingress_policing_rate: 10 # kbit, For "evio" mode
ingress_policing_burst: 10 # kbit, For "evio" mode
nebula_overlay_network:
is_enabled: true
log_file: nebula-overlay-network.log

15 changes: 8 additions & 7 deletions gateways/config-files/henrietta/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,19 @@ lora_radio:
mode: noevio # "evio", "noevio", "noevio-nat", or "pendant"
serial_interface: ttyUSB0
lora_interface: tnc0
evio_interface: appCIBR6
switch_interface: enp1s0
node_ip: 10.10.101.3/24 # ip/netmask
switch_ip: 10.10.101.1/24 # ip/netmask, IP address of the gateway on the other side of the LoRa link
evio_interface: appCIBR6 # For "evio" mode
uplink_interface: enp1s0 # For "noevio-nat" mode, Interface on the other side of the LoRa link with internet access
node_ip: 10.10.101.3
node_netmask: /24
lora_gateway_ip: 10.10.101.1 # For "pendant" mode, IP address of the gateway on the other side of the LoRa link
baud_rate: 115200
mtu: 400 # bytes
rate: 20 # kbit
burst: 32 # kbit
latency: 400 # ms
ingress_policing_rate: 10 #kbit
ingress_policing_burst: 10 #kbit

ingress_policing_rate: 10 # kbit, For "evio" mode
ingress_policing_burst: 10 # kbit, For "evio" mode
nebula_overlay_network:
is_enabled: true
log_file: nebula-overlay-network.log
16 changes: 9 additions & 7 deletions gateways/config-files/norvel/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,20 @@ lora_radio:
mode: noevio-nat # "evio", "noevio", "noevio-nat", or "pendant"
serial_interface: ttyUSB0
lora_interface: tnc0
evio_interface: appCIBR6
switch_interface: enx0015ff030033
node_ip: 10.10.101.1/24 # ip/netmask
switch_ip: 10.10.101.1/24 # ip/netmask, IP address of the gateway on the other side of the LoRa link
evio_interface: appCIBR6 # For "evio" mode
uplink_interface: enx0015ff030033 # For "noevio-nat" mode, Interface on the other side of the LoRa link with internet access
node_ip: 10.10.101.1
node_netmask: /24
lora_gateway_ip: 10.10.101.1 # For "pendant" mode, IP address of the gateway on the other side of the LoRa link
baud_rate: 115200
mtu: 400 # bytes
rate: 20 # kbit
burst: 32 # kbit
latency: 400 # ms
ingress_policing_rate: 10 #kbit
ingress_policing_burst: 10 #kbit

ingress_policing_rate: 10 # kbit, For "evio" mode
ingress_policing_burst: 10 # kbit, For "evio" mode
nebula_overlay_network:
is_enabled: true
log_file: nebula-overlay-network.log

8 changes: 4 additions & 4 deletions gateways/cron-jobs/non-root
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
@reboot sleep 90 && /home/ubuntu/miscellaneous/gateways/remote-access/reverse-ssh.sh

# Notifies the system is booted up
@reboot sleep 60 && /home/ubuntu/miscellaneous/gateways/system-monitors/startup-notifier.sh
@reboot sleep 90 && /home/ubuntu/miscellaneous/gateways/system-monitors/startup-notifier.sh

# Captures and logs the status of the system
@reboot sleep 60 && /home/ubuntu/miscellaneous/gateways/system-monitors/status-monitor.sh
@reboot sleep 90 && /home/ubuntu/miscellaneous/gateways/system-monitors/status-monitor.sh
25 00,08,14,20 * * * /home/ubuntu/miscellaneous/gateways/system-monitors/status-monitor.sh

# Pushes the new additions to the remote repo and runs Git garbage collection afterwards
Expand All @@ -25,9 +25,9 @@
@reboot /home/ubuntu/miscellaneous/gateways/system-monitors/network-interface-monitor.sh

# Runs Nebula Overlay Network
@reboot sleep 90 && /home/ubuntu/miscellaneous/gateways/remote-access/nebula-overlay-network.sh
@reboot sleep 60 && /home/ubuntu/miscellaneous/gateways/remote-access/nebula-overlay-network.sh
00 * * * * /home/ubuntu/miscellaneous/gateways/remote-access/nebula-overlay-network.sh

# Runs LoRa Radio
@reboot sleep 90 && /home/ubuntu/miscellaneous/gateways/remote-access/lora-radio.sh
@reboot sleep 60 && /home/ubuntu/miscellaneous/gateways/remote-access/lora-radio.sh
00 * * * * /home/ubuntu/miscellaneous/gateways/remote-access/lora-radio.sh
2 changes: 1 addition & 1 deletion gateways/git-maintenance/git-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ echo "########## START ##########"
readarray -t dir_array <<< "$git_push_directories"

for dir in "${dir_array[@]}"; do
timestamp=$(date +"%D %T %Z %z")
timestamp=$(date +"%a %Y-%m-%d %T %Z")
echo "Processing: $dir"
cd "$dir" || continue
git add .
Expand Down
17 changes: 9 additions & 8 deletions gateways/remote-access/lora-radio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@ echo "########## START ##########"

# Bring lora interface down and up
sudo /usr/bin/killall tncattach || true
sleep 5
sleep 1

echo "LoRa in $lora_radio_mode mode"
case $lora_radio_mode in
"pendant")
sudo /usr/local/bin/tncattach /dev/$lora_radio_serial_interface $lora_radio_baud_rate -d -e -n -m $lora_radio_mtu -i $lora_radio_node_ip
sudo /usr/local/bin/tncattach /dev/$lora_radio_serial_interface $lora_radio_baud_rate -d -e -n -m $lora_radio_mtu -i $lora_radio_node_ip$lora_radio_node_netmask
sudo /usr/sbin/tc qdisc add dev $lora_radio_lora_interface root tbf rate "$lora_radio_rate"kbit burst "$lora_radio_burst"kbit latency "$lora_radio_latency"ms
sudo /usr/sbin/ip route delete default
sudo /usr/sbin/ip route add default via $lora_radio_switch_ip
if ip route | grep -q default; then
sudo /usr/sbin/ip route delete default
fi
sudo /usr/sbin/ip route add default via $lora_radio_lora_gateway_ip
;;

"noevio")
Expand All @@ -56,9 +57,9 @@ case $lora_radio_mode in
sudo /usr/local/bin/tncattach /dev/$lora_radio_serial_interface $lora_radio_baud_rate -d -e -n -m $lora_radio_mtu -i $lora_radio_node_ip
sudo /usr/sbin/tc qdisc add dev $lora_radio_lora_interface root tbf rate "$lora_radio_rate"kbit burst "$lora_radio_burst"kbit latency "$lora_radio_latency"ms
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward > /dev/null
sudo /sbin/iptables -t nat -A POSTROUTING -o $lora_radio_switch_interface -j MASQUERADE
sudo /sbin/iptables -A FORWARD -i $lora_radio_switch_interface -o $lora_radio_lora_interface -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo /sbin/iptables -A FORWARD -i $lora_radio_lora_interface -o $lora_radio_switch_interface -j ACCEPT
sudo /sbin/iptables -t nat -A POSTROUTING -o $lora_radio_uplink_interface -j MASQUERADE
sudo /sbin/iptables -A FORWARD -i $lora_radio_uplink_interface -o $lora_radio_lora_interface -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo /sbin/iptables -A FORWARD -i $lora_radio_lora_interface -o $lora_radio_uplink_interface -j ACCEPT
;;

"evio")
Expand Down
7 changes: 5 additions & 2 deletions gateways/system-monitors/startup-notifier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ echo "########## START ##########"

cd $general_apps_dir/$startup_notifier_local_repo_dir/$general_gateway_name
date > $general_gateway_name
timestamp=$(date +"%a %Y-%m-%d %T %Z")
git add $general_gateway_name
git commit -m "$(date +"%D %T %Z %z")"
git commit -m "$timestamp"
git pull --rebase
git push
for commit in $(git log --reverse --format="%H" --branches --not --remotes); do
git push --force origin $commit:refs/heads/$(git rev-parse --abbrev-ref HEAD) || continue
done

########## FOOTER ##########

Expand Down

0 comments on commit 9dfa935

Please sign in to comment.