Community discussions

Search found 978 matches

  • 1
  • 2
  • 3
  • 4
  • 5
  • 20
by Jotne
Mon May 20, 2019 10:48 pm
Forum: Scripting
Topic: script export leases ,, help,,
Replies: 3
Views: 122

Re: script export leases ,, help,,

Not sure, seems to only save first line when I use file directly.
Maybe store all to array and then save to file.

Someone other care to help?
by Jotne
Mon May 20, 2019 3:31 pm
Forum: Scripting
Topic: How to get multiple data using "value-name"
Replies: 5
Views: 183

Re: How to get multiple data using "value-name"

Interesting and shorter.

Trying to understand how it works ;)

To make sure it works in all location i would have used full command like this:
:foreach i in=[ /ip dhcp-server lease print as-value ] do={
  :put (($i->"comment") . " " . ($i->"address") . " " . ($i->"host-name"));
}
by Jotne
Mon May 20, 2019 3:01 pm
Forum: Scripting
Topic: script export leases ,, help,,
Replies: 3
Views: 122

Re: script export leases ,, help,,

Cut and past this to your console:
[
/ip dhcp-server lease
:foreach i in=[find] do={
: put "$[get value-name=comment $i] $[get value-name=rate-limit $i] $[/system identity get name] $[/system clock get date]"
}
]
It will give you DHCP_comment, DHCP_rate-limit, Identity name and current date.
by Jotne
Mon May 20, 2019 1:31 pm
Forum: Scripting
Topic: Backup script
Replies: 5
Views: 206

Re: Backup script

I do use export as a normal backup since I can read the file, and adopt it to a new router if needed.
The backup function is more used for testing purpose. Having several version of a config.
by Jotne
Sun May 19, 2019 8:10 am
Forum: Scripting
Topic: How to get multiple data using "value-name"
Replies: 5
Views: 183

Re: How to get multiple data using "value-name"

This was even more code than what I have used. Gol was to do it more simple. (shorten)
by Jotne
Sat May 18, 2019 9:03 pm
Forum: RouterOS v6 RC and v7 BETA
Topic: Feature request: Add sorting
Replies: 5
Views: 1284

Re: Feature request: Add sorting

This I would like too.
by Jotne
Fri May 17, 2019 10:58 pm
Forum: Scripting
Topic: How to get multiple data using "value-name"
Replies: 5
Views: 183

How to get multiple data using "value-name"

This script does print comment , address and host-name from all dhcp lease /ip dhcp-server lease :foreach i in=[find] do={ : put "$[get value-name=comment $i] $[get value-name=address $i] $[get value-name=host-name $i]" } Can this be shorten in any way? I was looking for some like the example below ...
by Jotne
Wed May 15, 2019 11:56 am
Forum: Scripting
Topic: Knock secret daily changeable
Replies: 10
Views: 314

Re: Knock secret daily changeable

You should write some header, like this script is used to secure the switch access etc. Example, Why do we need it?
by Jotne
Wed May 15, 2019 11:14 am
Forum: Scripting
Topic: Need help for running a script
Replies: 1
Views: 64

Re: Need help for running a script

Can you run the scrip manually from cli by copy/past
by Jotne
Wed May 15, 2019 11:12 am
Forum: Scripting
Topic: Knock secret daily changeable
Replies: 10
Views: 314

Re: Knock secret daily changeable

Can you edit your post and add som information in the top on what this is and what its used for.
Also use the code tag button to add code tags around your script. Button look like this above the post </>
by Jotne
Tue May 14, 2019 9:07 pm
Forum: Scripting
Topic: limit number of mac address with bridge.
Replies: 4
Views: 181

Re: limit number of mac address with bridge.

Post your config. It may be other bride configuration.
by Jotne
Mon May 13, 2019 3:49 pm
Forum: Scripting
Topic: limit number of mac address with bridge.
Replies: 4
Views: 181

Re: limit number of mac address in the bridge.

I did find this using google. Not testet, but may work: if ([:len [/ip arp find interface="Bridge1"]] > 2) do={ /interface bridge set "Bridge1" arp=disabled } else={ /interface bridge set "Bridge1" arp=enabled } If number of arp on bridge "Bridge1" is higher than 2, disable arp on bridge, else enabl...
by Jotne
Mon May 13, 2019 1:32 pm
Forum: Scripting
Topic: Script needed
Replies: 5
Views: 361

Re: Script needed

Have you seen many attempts to spoof the mac address?
As long as you get in a log, you can send it to external syslog server and graph it.

See my signature for example on monitoring MT using Splunk.
by Jotne
Sat May 11, 2019 11:29 am
Forum: Scripting
Topic: Black list for failed login to IPSec VPN
Replies: 1
Views: 143

Re: Black list for failed login to IPSec VPN

Here you go Create a script with name Find_IPSEC that is used to find all lines with negotiation failed last 5m, extract the IP and add it to a access list. Find_IPSEC :local loglist [:toarray [/log find time>([/system clock get time] - 5m) message~"negotiation failed"]] :foreach i in=$loglist do={ ...
by Jotne
Fri May 10, 2019 10:04 pm
Forum: Scripting
Topic: Routing exeptions for connections from the routers itself
Replies: 7
Views: 273

Re: Routing exeptions for connections from the routers itself

Well, I probably could, but I find a Telegram group more versatile and I already use it a lot to monitor Mikrotik routers. You can look at my Splunk project link in my signature. It's created to monitor many Router at the same time. All config on the Routers are equal so easy to add extra routers.
by Jotne
Wed May 08, 2019 8:51 am
Forum: General
Topic: Resetting admin access
Replies: 6
Views: 308

Re: Resetting admin access

If there’s factory reset, will configuration of all network components also experience a reset?
All config is gone after a reset.
by Jotne
Wed May 08, 2019 8:31 am
Forum: Scripting
Topic: Check if interface has no IP
Replies: 5
Views: 269

Re: Check if interface has no IP

Why can you not use the Cloud function on the router? IP->Clould Just enable it and then you get a free DNS name from Mikrotik, based on your serial number, some like this 5fa34452b.sn.mynetname.net It updates automatically all the time. Then you can just point your outer DNS service to it. myhost.d...
by Jotne
Wed May 01, 2019 10:40 am
Forum: Scripting
Topic: Power out notification
Replies: 11
Views: 603

Re: Power out notification

Should be doable. You get the voltage using /system health print For a test try this: :put ([/system health get voltage]/10) You can then store it to a global variable: :global oldvoltage ([/system health get voltage]/10) Use an IF test and see if its going down compare to previous reading. My volta...
by Jotne
Tue Apr 30, 2019 11:11 am
Forum: Beginner Basics
Topic: Unknown device in ARP list with IP and without MAC
Replies: 8
Views: 369

Re: Unknown device in ARP list with IP and without MAC

Does it show up in your DHCP-server?
/ip dhcp-server lease print
by Jotne
Mon Apr 29, 2019 1:14 pm
Forum: Useful user articles
Topic: Using Splunk to analyse MikroTik logs 2.6 (Graphing everything)
Replies: 150
Views: 34673

Re: Using Splunk to analyse MikroTik logs 2.6 (Graphing everything)

I am not sure what you mean. All MT send their IP when sending syslog, not the identity name. So if you select the host drop down in each view, it shows what IP logs comes from. If its data that are already been logged in splunk you like to remove, do a search for what to remove and then add delete....
by Jotne
Sun Apr 28, 2019 11:45 pm
Forum: General
Topic: mikrotik power on hours
Replies: 6
Views: 320

Re: mikrotik power on hours

I do use Splunk to graph the uptime. Se example in my singature.
by Jotne
Sun Apr 28, 2019 11:02 pm
Forum: Scripting
Topic: read file size [SOLVED]
Replies: 9
Views: 404

Re: read file size [SOLVED]

I have some routers without internet connection or syslog server on local network, and I need to have log about ups and downs of certain ip. So this i a 100% closed network for some system that are not near any form for internet connection? It may be a solution to setup a server with two network ca...
by Jotne
Sun Apr 28, 2019 8:22 pm
Forum: Scripting
Topic: Need to remove space..Help
Replies: 1
Views: 130

Re: Need to remove space..Help

This should remove all spaces from /queue tree names :foreach i in=[/queue tree find] do { :local name [/queue tree get number=$i name] :local newname :for j from=0 to=([:len $name]-1) do={ :local tmp [:pick $name $j] :if ($tmp !=" ") do={ :set newname "$newname$tmp" } } /queue tree set name=$newnam...
by Jotne
Sat Apr 27, 2019 11:16 am
Forum: Scripting
Topic: read file size [SOLVED]
Replies: 9
Views: 404

Re: read file size [SOLVED]

Do you need the log stored on the router?
You my copy it out now an then using SSH?

Or use an external monitor program like Splunk?
See my signature.
by Jotne
Fri Apr 26, 2019 7:50 am
Forum: Scripting
Topic: How to Scripting an backup route [SOLVED]
Replies: 1
Views: 126

Re: How to Scripting an backup route [SOLVED]

Lets say you have an IP route like this: /ip route export # apr/26/2019 06:42:39 by RouterOS 6.44.2 /ip route add distance=1 dst-address=1.1.1.1/32 gateway=192.168.1.2 Then you can disable it like this: /ip route set disabled=yes [/ip route find where dst-address=1.1.1.1/32] Or enable it like this: ...
by Jotne
Tue Apr 23, 2019 9:49 am
Forum: General
Topic: Port Knocking, avoid scan-caused false positives?
Replies: 17
Views: 652

Re: Port Knocking, avoid scan-caused false positives?

I du use a flowing combination. 1. Any who tries to use a non open port will be blocked for 24 hours. 2. Service that needs to be open, if you start 5 session within 5 min you get blocked. 3. Port knocking if needed. Its very strict, and yes I have blocked my self out. But since I have whitlisted my...
by Jotne
Tue Apr 23, 2019 8:19 am
Forum: Beginner Basics
Topic: 0.0.0.253 ip
Replies: 10
Views: 610

Re: 0.0.0.253 ip

Just some of what is wrong with the posted config. You should NOT add outside interface to inside bridge, even if disabled. Should be removed. add bridge=bridge comment=defconf disabled=yes interface=sfp1 Inside IP should be connected to inside bridge, same way as DHCP Server etc. /ip address add ad...
by Jotne
Mon Apr 22, 2019 9:47 am
Forum: Scripting
Topic: Reading POE status with script
Replies: 4
Views: 240

Re: Reading POE status with script

Try this:
[
:local variable ([/interface ethernet poe monitor]->"poe-out")
:put $variable 
]
by Jotne
Mon Apr 22, 2019 12:39 am
Forum: Scripting
Topic: DHCP Lease script - execution order wrong?
Replies: 7
Views: 357

Re: DHCP Lease script - execution order wrong?

Not a direct respond to your problem, but I du use Splunk to monitor this. To see If a device is online one of the Splunk view looks at the DNS request. Nearly all devices request many DNS every minute. So if a device as at least on request last 5 min I mark it as online. See more in link in my sign...
by Jotne
Sun Apr 21, 2019 11:32 am
Forum: Beginner Basics
Topic: Introduction to RouterOS documentation
Replies: 13
Views: 711

Re: Introduction to RouterOS documentation

@csaunders72
To get you startet, here are nearly 100 MikroTik videos all from same guy. Start with Video #1 and go from there :)
It will take you from a novice to a pro in no time.

https://www.youtube.com/user/rodrick4u/videos
by Jotne
Sun Apr 21, 2019 11:13 am
Forum: Beginner Basics
Topic: wyze cam port forwarding
Replies: 8
Views: 540

Re: wyze cam port forwarding

I do guess that wyze cam works as any other modern device. You connect it on your inside LAN. Camera then connect to a cloud server.¨ When you are on a public internet, you connect to the cloudserver and see your camera info. So no NAT, not port forwarding are needed. Just connect, register, sign in...
by Jotne
Sun Apr 21, 2019 11:07 am
Forum: Beginner Basics
Topic: 0.0.0.253 ip
Replies: 10
Views: 610

Re: 0.0.0.253 ip

the interface used as the external interface should never be on a bridge. It should always be a routed interface.
Why?

Lets say you hva 16 public IP and you would like to use a group of interface as a outside switch , to connect to other stuff, I would have used bridge.
by Jotne
Sun Apr 21, 2019 11:02 am
Forum: General
Topic: No way to change MAC of Bonded interface ?
Replies: 3
Views: 186

Re: No way to change MAC of Bonded interface ?

From the manual: forced-mac-address (MAC address; Default: none) By default, bonding interface will use MAC address of the first selected slave interface. This property allows to configure static MAC address for the bond interface (all zeros, broadcast or multicast addresses will not apply). RouterO...
by Jotne
Sun Apr 21, 2019 10:58 am
Forum: General
Topic: Graphical interface
Replies: 5
Views: 484

Re: Graphical interface

This is some I like too. I did use Visio to make som VLAN layout to get to understand how it works here: https://forum.mikrotik.com/viewtopic.php?t=138232 One thing I do see that there are endless of configuration possibilities, so to get all included in a graphical interface and to be understandabl...
by Jotne
Sat Apr 20, 2019 10:27 pm
Forum: Scripting
Topic: To retain variable's values after reboot
Replies: 7
Views: 2968

Re: To retain variable's values after reboot

Did not see that before.
Why in the earth does not the RuterOS retains the global variable after reboot.
This should be a simple ting for MT to implement???

So MT consider this as a request.
by Jotne
Fri Apr 19, 2019 10:52 pm
Forum: Scripting
Topic: Script to change pcq rates on certain time
Replies: 5
Views: 280

Re: Script to change pcq rates on certain time

You are welcome :) Did an update of the post above to shorten it more. Example test for all Queues with letter D [admin@test-router] > /queue type export # apr/19/2019 21:33:29 by RouterOS 6.44.2 # software id = xxxx # # # /queue type add kind=pcq name=Demo pcq-rate=400 add kind=pcq name=Data pcq-ra...
by Jotne
Fri Apr 19, 2019 10:40 pm
Forum: Scripting
Topic: Script to change pcq rates on certain time
Replies: 5
Views: 280

Re: Script to change pcq rates on certain time

This should do:
:foreach i in=[/queue type find where name~"MYPCQ"] do={
/queue type set pcq-rate=([/queue type get number=$i pcq-rate]*2) numbers=$i }
It will double all pcq-rate for all queues that do contains the text MYPCQ

You can use the same to divide it by later /2
by Jotne
Fri Apr 19, 2019 9:50 am
Forum: Scripting
Topic: Script to change pcq rates on certain time
Replies: 5
Views: 280

Re: Script to change pcq rates on certain time

You can create two script and schedule them as start and stop like this

Lower pcq-rate
/queue type set pcq-rate=50 [/queue type find where name=MYPCQ]
Increase pcq-rate
/queue type set pcq-rate=100 [/queue type find where name=MYPCQ]
by Jotne
Fri Apr 19, 2019 12:42 am
Forum: Scripting
Topic: DynDNS entries by PPP event scripts?
Replies: 1
Views: 137

Re: DynDNS entries by PPP event scripts?

Have you tried MT Cloud service? IP->Cloud.
It will make a name like this your_serial.sn.mynetname.net
Then point Strato.de to MT Cloud service DNS name your_serial.sn.mynetname.net
With this no script is needed and all DNS updates automatically.
by Jotne
Thu Apr 18, 2019 1:46 pm
Forum: Beginner Basics
Topic: System,error,critical login failure
Replies: 2
Views: 167

Re: System,error,critical login failure

It seems that you have SSH open to access the router from the outside. So anyone who tries port tcp/22 will be logged if they have wrong password. BUT this is some you should not do. Do not open your router Winbox/SSH/Telnet/Web for admin access on outside. If you need to use SSH from the outside yo...
by Jotne
Thu Apr 18, 2019 11:56 am
Forum: Scripting
Topic: macros bug
Replies: 6
Views: 377

Re: macros bug

if ( $test = yes) do={/log info yes} else={/log info no} Will not work, you need to double quote yes like this: if ( $test = "yes") do={/log info "yes"} else={/log info "no"} To test things out: :global test "yes" [ :global test if ( $test = "yes") do={:put "true"} else={:put "false"} ] prints true...
by Jotne
Thu Apr 18, 2019 10:19 am
Forum: Beginner Basics
Topic: Multiple VLANs with one Router as Default Gateway in each VLAN
Replies: 7
Views: 346

Re: Multiple VLANs with one Router as Default Gateway in each VLAN

Vlan on MT is some complicated. There are may post on the forum here with example. What you request can be done. Look at this Visio, it's some what you do request. https://forum.mikrotik.com/viewtopic.php?t=138232#p681516 Vlan 1 runs untaged in the bridge, and vlan 20 run tagged. Both with its on De...
by Jotne
Thu Apr 18, 2019 10:14 am
Forum: General
Topic: Attack on the router?
Replies: 1
Views: 198

Re: Attack on the router?

Have you ever opened for administration (using Winbox) from the internet?
If so it may be that you have been hacked.
Do a net install with latest fixed ros, and do a search for how to secure remote admin.
Example, use VPN etc.
by Jotne
Thu Apr 18, 2019 10:11 am
Forum: Useful user articles
Topic: USB Outdoor temperature sensor
Replies: 7
Views: 949

Re: USB Outdoor temperature sensor

Same can Splunk (full version) , see my signatur link for more info.

PS this Router is stored in a place where the sun heats its up in the day time :)
Temperature.jpg
by Jotne
Thu Apr 18, 2019 10:04 am
Forum: General
Topic: Logging prefix is a mess
Replies: 2
Views: 863

Re: Logging prefix is a mess

I am still waiting for this to be fixed (cleaned up)
Should not be to hard??
If it can not be done whit 6.x, add it to the 7.x version of ros
by Jotne
Thu Apr 18, 2019 10:02 am
Forum: General
Topic: Request: Fixing missing DHCP ID on all packets
Replies: 0
Views: 93

Request: Fixing missing DHCP ID on all packets

I do use Splunk to graph DHCP request. To get all info I need I use Debug for DHCP packet. This gives me information that I need, but its hard to put it together. This is due to that there may be more than one request at nearly the same seconds. If this happens, may Splunk transaction may mix packet...
by Jotne
Thu Apr 18, 2019 9:12 am
Forum: Forwarding Protocols
Topic: VLAN - best practice?
Replies: 9
Views: 800

Re: VLAN - best practice?

We hva joined two company that did have more or less the same setup, but different VLAN, så it could be used there, but we did instead using cable from VLAN x on one port to VLAN y on another port to join the VLAN together. Works but not recommended. So later all the VLAN was harmonized.
by Jotne
Wed Apr 17, 2019 9:17 pm
Forum: Scripting
Topic: Fetch - How to access data variable?
Replies: 8
Views: 1572

Re: Fetch - How to access data variable?

Can even be shorten more.
This site is some better since it does not give an extra empty line.
:put ([/tool fetch url="https://api.ipify.org/" output=user as-value]->"data")
by Jotne
Fri Apr 12, 2019 8:05 pm
Forum: Scripting
Topic: Send email of my IP address
Replies: 1
Views: 186

Re: Send email of my IP address

Have you tried IP->Cloud? A free dynamic DNS from Mikrotik. Here is how to get public IP: :put [/ip address get [find interface=[/ip route get [find dst-address=0.0.0.0/0] vrf-interface]] address] To store it to an variable. :local pubIP [/ip address get [find interface=[/ip route get [find dst-addr...
  • 1
  • 2
  • 3
  • 4
  • 5
  • 20