Can somebody explain scope and target scope?

Hi everybody,

I need help understanding scope and target scope in mikrotik. How can I use this values?

I have to gateways. One is the main gateway and the second is a backup gateway.

How to configure scope and target scope for both gateways?

Thanks in advance

bye

http://wiki.mikrotik.com/wiki/Manual:Using_scope_and_target-scope_attributes

yes I have read this manual but I still don’t understand.

I want it in simple words, or which values are most suitables for scope and target scope.

Thanks

‘scope’ and ‘target-scope’ are for recursive routes. you don’t need them until you know what they are for

for main/backup gateways you just need different ‘distance’ value

Exactly how to use for recursive routes… I am guessing that the standard is scope30 target scope 10 but why?
I have no clue what they are doing, I would even prefer plain russian to english MT wiki = greek to me.

Scope/target scope pairs define which routes can be used for recursive nexthop: the route will search for nexthop only among other routes, whose scope is not higher than it’s own target scope.

I think you have that mixed up. I have been using recursive routes for years now and the scope is 30, target scope 10 for all my routes and it works fine???
Or it just confirms I have no clue when it comes to routes. I still scratch my head when someone puts in table main routes …sigh

Not me, man. Not me. :laughing:

So in a typical double recursive setup…
This should be the setup…
where the default setting for IP routes seems to be scope=30 targetscope=10

Primary ISP
First external check
1 - add check-gateway=ping distance=3 gateway=1.0.0.1 (cloudfare) scope=30 targetscope=10
2 - add distance=3 dst-address=1.0.0.1/32 gateway=ISP_Primary scope=10 targetscope=10
Second exernal check
(L2) add check-gateway=ping distance=4 gateway=208.67.220.220 (opendns) scope=30 targetscope=10
(L4) add distance=4 dst-address=208.67.220.220/32 gateway=ISP_Primary scope=10 targetscope=10

Secondary ISP
(L5) add distance=10 gateway=ISP_Secondary scope=30 target scope=10

Something like that.

So it sounds like you have no idea what the purpose of scope is, the purpose of target scope, only that one has to be equal or lower than the other for recursive setups to work.
Haha, then its true you do write WIKIs LOL.

I just explained you the purpose of both scope and target scope few comments above, then you wrote a config that should work, and now you state, that you haven’t understood a word, that I said?
How are you doing it? :laughing:

Once again, step by step:

  1. A route 1 in your config needs a nexthop.
  2. It has target-scope=10
  3. It then searches the nexthop among the routes that has their scope<=10
  4. It finds route 2 that has needed dst-address and scope=10
  5. scope=10 (of route 2) <= target-scope=10 (of route 1) —> route 2 can be used as nexthop for route 1
  6. Done!

Thanks much! Its getting clearer.
The numbers are meaningless in that I could be using 100 and 50 or 3 and 7. There is no scale.
What is important solely is the relationship between the target scope in one route rule and the scope in an associated route rule.
What is the hierarchy of searches and routing Distance then scope or scope then distance??
Is this scope and target scope used only in recursive routing?

Exactly!

There is no relation between distance and scope/target-scope: one is used for route selection, another for nexthop selection.

Okay so they are independednt in that target scope is only used for next hop routing rules and scope is used in general for all route rules.
But what does scope do?

How does scope relate to distance?

You are joking, right?

Have a look here too: https://wiki.mikrotik.com/wiki/Manual:IP/Route#Nexthop_lookup

Scope is linked to routing configuration: 10 for local, 30 for static, …
Target scope is that as well, and by specifying target one can define how next hop can be looked up.

Haven’t you met anav before? :smiley: But I’m with him. Other options are easy to understand.

Imagine you’re in a room and you’re deciding where to go. Doors (gateway) have labels saying where they lead to (dst-address). There are multiple doors leading to same destination, so they also list how long the way is (distance). You want to save your feet, so lower is better. Before trying to open some door, you should either knock or look through if they’re glass ones (check-gateway). And it’s very big room with many doors and many people, so you can have a ticket (routing-mark) and ask at the desk what doors are you allowed to use. Some doors may be locked or have broken handle (type).

See? Everything is obvious, child would get it. But what do you do with scopes?

Sure I have!
I’m the one who welcomed him in the world of VLANs!
…The deed I will probably regret for the rest of my life… :laughing: