Yes, the title says it all, i just had a crazy idea to try to solve my problem.
I own several Mikrotik devices that are part of a big hotspot network.
I’ve been on a really big quest to centralize everything (you can look up my other post to see what i’m talking about), and i just had an idea to solve the remote access issue.
Since i have numerous devices sharing almost the same number of internet lines that don’t have Fixed IP Address, i clearly have a big problem.
To have multiple Dynamic DNS accounts would also be a huge nightmare, even more with all the issues that i know (talking about DynDNS, No-IP, etc…).
My crazy idea would be to have each mikrotik device (one per internet access, in case there would be more that one device on that same access) to post it’s public address to some kind of database (MySQL would be great) that would allow me to develop a php script to display a table with all the the Device ID’s and the IP address associated with it.
In that table i can have filters (Geografic Location, domestical, commercial, etc…) and also have a search box.
That way i would use my website, or at least only be forced to have one Fixed IP Address Internet Access, wich would save me lot’s of €€€…
Any help would be really awsome.
You don’t even need a single device to be fixed IF you have just one DynDNS associated with it… but anyway… What part do you need help with? I mean, you probably already realize you can use “/tool fetch” to send a request to PHP, and let PHP figure out the IP with $_SERVER[‘REMOTE_ADDR’]… anything else?
To be able to access all my devices i would need to create the same amount of DynDNS names, and i would have to create scripts that would need to be changed according to the DynDNS provider’s changes, and ROS versions, wich won’t be that practical in my case.
For what i have seen and tested, i don’t think that the way the DynDNS and similar solutions works would be my best option. Of course i know that if i can’t get it to work my way i can always go back to it.
Imagine that you have over 500 devices that you need to access, i don’t think that using DynDNS would be the best solution.
About the use of “/tool fetch” to send a request to PHP and all that, i would really appreciate the help.
I would have a mysql table where all the devices would have a unique ID (the “id” collum). With that i would like to have a script on each device that would update it’s ID entry, therefore updating it’s current ip address.
Hope i could explain myself, if not let me know, and i will try my best to explain it.
Best regards.
About the use of “/tool fetch” to send a request to PHP and all that, i would really appreciate the help.
Um… I apologize if the following sounds condescending (it’s not meant to, but I can’t find a better way to put it)…
Do you know any PHP?.. At all?
I mean, on RouterOS’s side, it really is as trivial as running
/tool fetch url="http://server/script.php"
from a scheduler script. That is ALL you need to do there.
And on PHP’s side, the only thing you need to get the IP is $_SERVER[‘REMOTE_ADDR’].
If you’ve already worked with PHP and MySQL (at all… we’re not talking anything “advanced”), you already know the rest, i.e. how to create a database and a table, then enable the MySQLi or PDO extensions in PHP, then use either of them to connect to the DB and issue a query.
If not, then… download MySQL, follow the instructions, if necessary use a graphical tool like MySQL Workbench, then learn PHP, and in particular the part about installing the MySQLi extension and using it. All you need to know is already there. If you can’t understand what’s being said, ask.
You have to create a connection with PHP and MySQL database. To create the connection, first create your database, Create a Folder in htdocs, Create Database Connection File In PHP and test your connection from index.php file. This is how you can connect mysql database with php.