This parameter is available in v6.39rc33+ These are available variables that are accessible for the event script:
bound - 1 - lease is added/changed; 0 - lease is removed
server-address - server address
# Get the network interfaces | |
$interfaces = Get-NetIPInterface | Where-Object {$_.InterfaceAlias -match "Wi-Fi" -or $_.InterfaceAlias -match "vEthernet" -or $_.InterfaceAlias -match "Ethernet"} | |
# Set a higher metric value for the Ethernet interface | |
foreach ($interface in $interfaces) { | |
Write-Host $interface.InterfaceAlias | |
if ($interface.InterfaceAlias -match "Ethernet") { | |
Write-Host "Ethernet Interface" | |
Set-NetIPInterface -InterfaceAlias $interface.InterfaceAlias -InterfaceMetric 100 |
# Variables | |
$ipStringPrefix = "192.20.20." # Replace with the desired IP address prefix | |
$newIpAddress = "192.20.20.150" # Replace with the desired new static IP address | |
$newPrefixLength = 24 # Replace with the desired subnet mask length | |
# Find the interface by CIDR | |
$interfaces = Get-NetIPAddress | Where-Object { | |
$_.IPAddress.StartsWith($ipStringPrefix) | |
} |
# 1970-01-02 00:02:40 by RouterOS 7.15 | |
# software id = 8A8H-8IIG | |
# | |
script: #| Welcome to RouterOS! | |
#| 1) Set a strong router password in the System > Users menu | |
#| 2) Upgrade the software in the System > Packages menu | |
#| 3) Enable firewall on untrusted networks | |
#| 4) Set your country name to observe wireless regulations | |
#| ----------------------------------------------------------------------------- | |
#| RouterMode: |
{ | |
:do { | |
:log info ("ppp on-up script for interface id: " . $interface . " Started" ); | |
:local interfaceName [/interface/get $interface name]; | |
:log info ("ppp on-up script for interface name: " . $interfaceName . " Started" ); | |
:local routingTable "WAN1"; | |
:local routingTable "WAN2"; |
This parameter is available in v6.39rc33+ These are available variables that are accessible for the event script:
bound - 1 - lease is added/changed; 0 - lease is removed
server-address - server address
#!/usr/bin/env ruby | |
def filter_text_file(input_file) | |
# Read the input file content | |
content = File.read(input_file) | |
# Split the content into lines | |
lines = content.split("\n") | |
# Initialize a variable to track if we are inside a block to remove |
{ | |
:do { | |
:local debug 1; | |
:local flagInterface ""; | |
:local srcInterface ""; | |
:local srcAddress ""; | |
:set srcInterface "###INTERFACE_NAME###"; | |
:set flagInterface "###FLAG_INTERFACE_NAME###"; |
{ | |
:do { | |
:local srcInterface1 "ether1-WAN1"; | |
:local srcInterface2 "ether2-WAN2"; | |
:local srcInterface3 "ether3-LTE"; | |
:local srcInterface4 "pppoe-WAN1"; | |
:local srcInterface5 "pppoe-WAN2"; | |
:local srcInterface6 "pppoe-LTE1"; | |
:local flagInterface ""; | |
{ | |
:do { | |
:log info "STARTING BACKUP process"; | |
:local customerNumber "Ac3_Cust.no_1"; | |
:local boardSerial [/system/routerboard/get serial-number]; | |
:local sendMail true; | |
:local uploadFile false; | |
:local mailServer "smtp.gmail.com"; |
:local endpoint www.example.com; | |
:local wireguardInterface wireguard3; | |
:local wireguardInterfacePort [/interface/wireguard/get $wireguardInterface listen-port]; | |
:foreach i in=[/interface/wireguard/peers/find where disabled=no endpoint-address=$endpoint] do={ | |
:local LastHandshake [/interface/wireguard/peers/get $i last-handshake]; | |
:if (([:tostr $LastHandshake] = "") or ($LastHandshake > [:totime "5m"])) do={ | |
/interface/wireguard/set 0 listen-port=$wireguardInterfacePort name=$wireguardInterface; | |
:log warning "fixed wireguard"; |