Community discussions

MikroTik App
 
lodilodilodi
newbie
Topic Author
Posts: 31
Joined: Thu Feb 01, 2018 10:24 pm

traffic monitoring

Wed May 04, 2022 1:18 am

is there any simple way to monitor wan traffic on mikrotik and se daily report , for example

public ip 208.65.1.1
i want to know how many mbps was one ip i chose to monitor all day long ...

Note : i dont want for lan ip , i want to monitor e public ip my users connect to that ip.
 
holvoetn
Forum Guru
Forum Guru
Posts: 5325
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: traffic monitoring

Wed May 04, 2022 1:31 pm

Look for user jotne, he has a complete solution to track whatever you want using Splunk.
 
fragtion
Member Candidate
Member Candidate
Posts: 257
Joined: Fri Nov 13, 2009 10:08 pm
Location: Johannesburg, South Africa

Re: traffic monitoring

Wed May 04, 2022 1:38 pm

Have a look at kid control, it can probably do what you're asking for quite elegantly

Another option is to create a firewall passthrough rule in the forward chain with that public IP as the dst-address, and then you can just monitor the counters for that rule, and reset the counters daily if you want..
/ip/firewall/mangle/add chain=forward in-interface-list=LAN out-interface-list=WAN dst-address=208.65.1.1 action=passthrough comment="traffic counter for public ip 208.65.1.1"
/system/scheduler/add name="reset-traffic-counters" interval=1d start-date=may/04/2022 start-time=00:00:00 on-event="/ip/firewall/mangle/reset-counters [find where comment~\"^traffic counter for public ip*\"]"

Of course you could also be more specific and only monitor traffic between that public IP and a single host in your LAN (eg 192.168.0.123), as follows:
/ip/firewall/mangle/add chain=forward in-interface-list=LAN out-interface-list=WAN src-address=192.168.0.123 dst-address=208.65.1.1 action=passthrough comment="traffic counter for public ip 208.65.1.1"

You could also modify the scheduler script to send a daily report of the traffic via E-mail before resetting it, something as follows:
/system/scheduler/add name="reset-traffic-counters" interval=1d start-date=may/04/2022 start-time=00:00:00 on-event="\
:local bytes [/ip/firewall/mangle/get [find where comment=\"traffic counter for public ip 208.65.1.1\"] bytes]\r\n\
/tool/e-mail/send to=email@address.com subject=\"Traffic report for public IP 208.65.1.1\" from=username@domain.com server=imap.domain.com port=587 tls=no user=username@domain.com password=\"123456\" body=\"Daily traffic for 208.65.1.1: \$bytes bytes\"\r\n\
/ip/firewall/mangle/reset-counters [find where comment~\"^traffic counter for public ip*\"]"
 
lodilodilodi
newbie
Topic Author
Posts: 31
Joined: Thu Feb 01, 2018 10:24 pm

Re: traffic monitoring

Thu May 05, 2022 1:27 am

/ip/firewall/mangle/add chain=forward in-interface-list=LAN out-interface-list=WAN dst-address=208.65.1.1 action=passthrough comment="traffic counter for public ip 208.65.1.1"
/system/scheduler/add name="reset-traffic-counters" interval=1d start-date=may/04/2022 start-time=00:00:00 on-event="/ip/firewall/mangle/reset-counters [find where comment~\"^traffic counter for public ip*\"]"
i have done this but wont show me real time traffic i can view in torch right now it says +200mbps that ip , when i check to mangle i cant real time traffic .

How can it be done with kid control ?
 
User avatar
k6ccc
Forum Guru
Forum Guru
Posts: 1490
Joined: Fri May 13, 2016 12:01 am
Location: Glendora, CA, USA (near Los Angeles)
Contact:

Re: traffic monitoring

Thu May 05, 2022 2:35 am

You can also set up a passthough firewall rule that's only purpose is to count packets. May not give exactly what you are looking for, but at least some idea how much traffic is going to of from a particular IP. I do this from time to time - mostly as a troubleshooting took. For example, am I receiving any tcp traffic from 1.2.3.4 that is destined to port 12345.
 
lodilodilodi
newbie
Topic Author
Posts: 31
Joined: Thu Feb 01, 2018 10:24 pm

Re: traffic monitoring

Thu May 05, 2022 6:51 pm

You can also set up a passthough firewall rule that's only purpose is to count packets. May not give exactly what you are looking for, but at least some idea how much traffic is going to of from a particular IP. I do this from time to time - mostly as a troubleshooting took. For example, am I receiving any tcp traffic from 1.2.3.4 that is destined to port 12345.
thats the problem i want the exact traffic i am getting from that ip , because i am paying to access that ip . they are charging me alot because i dont have graph to know exactly how much i am using :) . no problem thanks all maybe isnt possible ...
 
User avatar
chechito
Forum Guru
Forum Guru
Posts: 2989
Joined: Sun Aug 24, 2014 3:14 am
Location: Bogota Colombia
Contact:

Re: traffic monitoring

Thu May 05, 2022 7:05 pm

you can create a simple queue for that particular source-destination traffic with a very high limit to avoid limiting

then you enable graphing for that simple queue, in that way you can get a simple historical graph

if you need create some kind of log you can configure disk logging and use a simple script to save queue stats using log entryes or a firewall rule counting for that traffic
 
lodilodilodi
newbie
Topic Author
Posts: 31
Joined: Thu Feb 01, 2018 10:24 pm

Re: traffic monitoring

Fri May 06, 2022 9:10 am

How to do that , can you guide me ?
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: traffic monitoring

Fri May 06, 2022 9:56 am

 
holvoetn
Forum Guru
Forum Guru
Posts: 5325
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: traffic monitoring

Fri May 06, 2022 10:04 am

Which was what I already suggested in post #2 :lol:

Who is online

Users browsing this forum: Bing [Bot], miks, rplant, Semrush [Bot], Victoravv and 76 guests