From 3a233e0a3fb6a2f7ad49d9520bd219f4e0642f55 Mon Sep 17 00:00:00 2001 From: Pothi Kalimuthu <1254302+pothi@users.noreply.github.com> Date: Tue, 8 Aug 2023 08:13:29 +0530 Subject: [PATCH] Update docs; improve NTP client config, etc --- README.md | 2 +- bootstrap-scripts/sxt-lte-bootstrap.rsc | 58 +++++++++++++++---------- 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 2d2e055..d49f286 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MikroTik LTE Scripts -Scripts for MikroTik LTE products such as SXT LTE Kit. MikroTik LTE products with LTE modem have some unique features such as SMS. So, they require a bit different set of scripts for day-to-day tasks such as forwarding of an SMS to email, etc. Here are the scripts that I use. +Scripts for MikroTik LTE products such as SXT LTE Kit. MikroTik LTE products with LTE modem have some unique features such as SMS. So, they require a bit different set of scripts for day-to-day tasks such as forwarding of an SMS to email, etc. #### More MikroTik scripts by me... diff --git a/bootstrap-scripts/sxt-lte-bootstrap.rsc b/bootstrap-scripts/sxt-lte-bootstrap.rsc index 9d064b1..65a8f13 100644 --- a/bootstrap-scripts/sxt-lte-bootstrap.rsc +++ b/bootstrap-scripts/sxt-lte-bootstrap.rsc @@ -2,26 +2,28 @@ :global identity "Mikrotik"; :global myPassword; +# my subnet +# override the default 192.168.88.1 only if you use more than one MikroTik product +:global mySubnetCIDR "10.88.50.0/24"; +:global dhcpServerIP "10.88.50.1"; +:global dhcpPoolRange "10.88.50.88-10.88.50.100"; +:global dhcpName "my-dhcp"; +:global myBridgeAddress "10.88.50.1/24"; + # override the default values here :set identity "SXT LTE Kit"; :set myPassword [:pick ([/cert scep-server otp generate as-value minutes-valid=1]->"password") 0 20] :put "Your new password is..." :put $myPassword -# my subnet -:global mySubnetCIDR "10.88.50.0/24"; -:global dhcpServerIP "10.88.50.1"; -:global dhcpPoolRange "10.88.50.88-10.88.50.100"; -:global dhcpName "my-dhcp"; -:global myBridgeAddress "10.88.50.1/24"; - -# SSH -:global sshUserName "pothi"; - ### ------------------------------------------------------------------------------------ ### # Generic Tweaks # ### ------------------------------------------------------------------------------------ ### +# find RouterOS version +:local rosVersion +:set rosVersion [:pick [/system/routerboard/get current-firmware] 0 1] + # Configure Identity /system identity set name=$identity @@ -32,17 +34,14 @@ set wan-interface-list=all set internet-interface-list=all -# Wireless tweaks - # install public SSH key :put "Importing SSH key..." -{ - :local result [ /tool fetch https://launchpad.net/~pothi/+sshkeys dst-path=pothi-ssh-key-rsa as-value]; - :while ($result->"status" != "finished") do={ :delay 2s } -} +:local result [ /tool fetch https://launchpad.net/~pothi/+sshkeys dst-path=pothi-ssh-key-rsa as-value]; +:while ($result->"status" != "finished") do={ :delay 2s } :delay 1s /user ssh-keys import public-key-file=pothi-ssh-key-rsa; :delay 1s +# removed automatically in RouterOS v7 /file remove pothi-ssh-key-rsa; :put "Done importing SSH key." @@ -50,8 +49,19 @@ /ip dhcp-server config set store-leases-disk=never; # Configure NTP Client -/system ntp client set primary-ntp=[ :resolve pool.ntp.org ]; -/system ntp client set secondary-ntp=[ :resolve time.cloudflare.com ]; +:if ( $rosVersion = 7 ) do={ + /system ntp client servers + add address=128.138.140.44 comment="NIST.gov" + add address=[ :resolve pool.ntp.org ] comment="pool.ntp.org" + add address=[ :resolve time.cloudflare.com ] comment="time.cloudflare.com" + add address=time.google.com + add address=0.in.pool.ntp.org +} else={ + /system ntp client + set primary-ntp=128.138.140.44 + set secondary-ntp=[ :resolve time.cloudflare.com ] + set server-dns-names=time.cloudflare.com,time.google.com,0.in.pool.ntp.org +} /system ntp client set enabled=yes; ### ------------------------------------------------------------------------------------ ### @@ -60,8 +70,13 @@ # SMS Receive capability /tool sms set auto-erase=yes receive-enabled=yes secret=0000 port=lte1; -:put "Changing the sim slot to 'b'." -/system routerboard modem set sim-slot=b +# Logging +:local logTopics {"info"; "error"; "warning"; "critical"; "gsm"; "read"; "write"; "lte,!raw,!packet,!async,!debug"} +:foreach topic in=$logTopics do={ :system logging add topics=$topic action=disk } + +# Useful when more than a SIM slot is present and the default SIM is in the other slot. +# :put "Changing the sim slot to 'b'." +# /system routerboard modem set sim-slot=b # Change subnet #change static DNS entry for router.lan @@ -80,6 +95,3 @@ /ip dhcp-server network remove [find gateway=192.168.88.1]; /ip address remove [find address="192.168.88.1/24"] -# Logging -:local logTopics {"info"; "error"; "warning"; "critical"; "gsm"; "read"; "write"; "lte,!raw,!packet,!async,!debug"} -:foreach topic in=$logTopics do={ :system logging add topics=$topic action=disk }