I have two default routes one disabled and one enabled. I effectively want to switch them round.
I have :
// enable dsl backup and turn of main link
Mikrotik mk = new Mikrotik(“192.168.100.254”);
if (!mk.Login(“apiuser”, “password”))
{
Response.Write(“
if you are using id numbers to access configuration items in API then your syntax of ID number is incorrect.
Some samples .id=*a; .id=*A7E etc
format is star+HEX number.
for example you can add comment or use other fields to get the correct id. If route list is not large, you can get whole list by /ip/route/print command and then get correct ID number of it by filtering out unwanted routes.
Or you can use queries (see wiki documentation on how these are used)
This make’s no sense to me - so what would be a sample line where the it asks numbers on a terminal when doing disable id enter 0 or 1 so what do I need to send to simulate this (the routing table will only ever be two routes of which one enabled).
sometimes you can use other value than “star+HEX” format, for example, if item name is unique in the router, like interface names, ppp secret names etc. there are alot of other places where items do not have name associated with it, and thus, you will have to use .id value.
as an example, you can do this in CLI to see the .id values of ethernet interfaces that are on the rotuer:
:put [/interface ethernet find]
*5;*6;*7;*8;*9;*1;*a;*b;*c;*d;*2;*3;*4and note, that for static items .id value, the ID value does not change. Unless router is completely re-installed.