Is there anyway of getting mikrotik to tell my server what its IP is?
Exactly how are you asking it and where do you want to visualize/store the IP?
(there are a few number of ways, depending on the answers to the above)
I want to store the ip in a mysql database that cross referenced with the mikrotiks identity?
Thanks!
The problem here is somewhat circular. Whatever you do, you’ll need to have a list of your routers’ IPs. If you have that, you may as well write those IPs in the DB already. If you don’t, how do you figure those that are your routers form different IPs?
If you do know those IPs already, and the real issue is getting the associated identity, you can use the API for that. Just call “/system/identity/print” on each router’s IP and get the “name” property of the result.
If the problem is making later routers report back to the DB (since you won’t know them after they’re deployed), you can schedule the following script at each router before deploying it:
:local identity [/system identity get name]
/tool fetch url="http://example.com/index.php?identity=$identity"The PHP file can then get the IP with $_SERVER[‘REMOTE_ADDR’] and the associated identity via $_GET[‘identity’].
almost, this is currently just displaying the ip of my server?
any way to make it show the wan ip of the mikrotik?
Sorry! that totally works, thank you very much.