/ip route print detail where dst-address =x.x.x.x/xx FAIL!

This is really doing my head in.

I need to find the as-path for x.x.x.x/xx so i run:-

/ip route print detail where dst-address =x.x.x.x/xx

and get:-

/ip route print detail where dst-address =x.x.x.x/xx
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
 0 ADb  dst-address=x.x.x.x/x gateway=x.x.x.x
        gateway-status=x.x.x.x reachable Inta distance=20

No as-path

But if I want to page thru 970k routes it will show!

/ip route print detail
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
 0 ADb  dst-address=x.x.x.x/x gateway=x.x.x.x
        gateway-status=x.x.x.x reachable Inta distance=20 scope=40
        target-scope=10 bgp-as-path="257,37,18,7" bgp-origin=igp
        bgp-communities=32:825,32:308,32:502
        received-from=BGProuter

GGrrr

It’s been like that forever. What I usually do is the following:
:put [ /ip route get [ /ip route find where dst-address=x.x.x.x/yy ] bgp-as-path ]

i had a similiar problem with firewall rules, maybe this helps?

print command in firewall does not show dynamic rules.
You have to write “print all where dynamic”

If you use the word ‘all’ does that help? dont have a box here to test with myself.

/ip route> print all where dynamic
expected end of command (line 1 column 7)

Thanks Eising,

Can I double check the syntax, I’m getting invalid internal item number most of the time

[admin@router] > :put [ /ip route get [ /ip route find where dst-address=1.0.0.0/8 ] bgp-as-path ]
3257,7018,237
[admin@router] > :put [ /ip route get [ /ip route find where dst-address=3.0.0.0/8 ] bgp-as-path ]
invalid internal item number

You must be absolutely certain that your find only returns one number.

in case of several returns you can try :foreach

Is this still the case? I’ve tried with RouterOS6 and RouterOS7 and still see the problem.

I need a reliable and fast way to say “/ip route print where dst-address contains 10.10.10.15”

/ip route print where 10.10.10.15 in dst-address