Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to ask that I have turned off fast traffic, but I still can’t record traffic #5

Open
wartw opened this issue May 10, 2021 · 9 comments

Comments

@wartw
Copy link

wartw commented May 10, 2021

I want to ask that I have turned off fast traffic, but I still can’t record traffic

@Nixellion
Copy link
Owner

I think you need to turn Accounting on as well

@wartw
Copy link
Author

wartw commented May 10, 2021

Python cannot parse and process normally, I am sure all ros have normal output

@Nixellion
Copy link
Owner

What do you mean "Python cannot parse and process normally"? Are there any errors in console?

I never said they have different output, but you do need to disable Fast Track, enable Accounting, enable Web Access to Accounting and type the IP of the PC where you run TrafficMonitor on, otherwise ROS will block it from access.

@wartw
Copy link
Author

wartw commented May 10, 2021

I will show you a screenshot later

@wartw
Copy link
Author

wartw commented May 10, 2021

未命名1

@Nixellion
Copy link
Owner

Sorry, not sure what's wrong?

It only shows local clients in LAN, which is what it's for.

@wartw
Copy link
Author

wartw commented May 11, 2021 via email

@Nixellion
Copy link
Owner

Well, in it's current state this project only supports single subnet based on router's IP. I developed it for simple use at home environment where it's unlikely you would have that many networks or extra NAT rules.

The key here is that the data mask of Mirkotik's accounting is source ip, destination ip, x, x, x, x and it lists all connections as they were initiated or something like that, meaning that source ip is not necessarily your local one. So it has to be filtered.

You can see the relevant code in this file and try updating or changing it to adapt to your needs: https://github.com/Nixellion/MikrotikTrafficMonitor/blob/master/collector.py

All the code responsible for getting and parsing data from mirkotik's accounting table is in this file.

So instead of using these checks:

if src.startswith(self.local_network):  # upload
                k = src
elif dst.startswith(self.local_network):

You may replace it with:

if   ".".join(src.strip().split('.')[0:-1]) in self.local_networks:  # upload
                k = src
elif ".".join(dst.strip().split('.')[0:-1]) in self.local_networks:

And also on line 17 you'd need to replace or add below a new variable:

self.local_networks = ["192.168.1.", "192.168.2."]  # List any subnet parts you'd like to track

Something like that would work.

Sadly I don't have the time to actively maintain this project and implement these updates myself, it outlived it's usefulness for me, but that's why I made it open source, so anyone can pick it up and improve on it as needed.

@wartw
Copy link
Author

wartw commented May 11, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants