05-15-2018 10:45 AM - edited 03-08-2019 03:01 PM
It is quiet simple question, but I am sure would be real helpful, so I have a bgp neighbors with this prefix x.x.x.*
I am trying to do this, so that I get current status of all neighbors, but * or [] does not work. Anyone who can help here.
sh ip bgp neighbors X.X.X.* | in Des|state
% Invalid input detected at '^' marker.
or
sh bgp neighbors X.X.X.* | in Des|state
--
Sal
Solved! Go to Solution.
05-15-2018 12:11 PM
Hello,
sh ip bgp neighbors | include BGP neighbor is 192.168.1[0-9]| BGP state =
05-15-2018 11:28 AM
Hello,
which output are you after, what do you mean by 'status' ?
sh ip bgp neighbors | include BGP neighbor is | BGP state =
results in
BGP neighbor is 192.168.12.2, remote AS 2, external link
BGP state = Established, up for 00:05:25
BGP neighbor is 192.168.13.3, remote AS 3, external link
BGP state = Established, up for 00:03:49
05-15-2018 11:33 AM
So I want to look at all BGP neighbors in that prefix, say I have multiple neighbors in this prefix 192.168.1.x and I would like to check if they are all established or active. I want to know if we can use regex or something similar like this below?
sh ip bgp neighbors 192.168.1.* | in Des|state
Which should show me all neighbors in that IP range and there current BGP state
05-15-2018 12:11 PM
Hello,
sh ip bgp neighbors | include BGP neighbor is 192.168.1[0-9]| BGP state =
05-16-2018 10:48 AM
05-16-2018 10:55 AM
Not perfect as you have seen, since all the BGP state = lines are listed even when the IP address doesn't match. I haven't figured out how to filter those out...
05-16-2018 11:00 AM
Yes I have noticed it, it shows states for non-matching results as well. but pretty close to what I wanted to see, Let me know if you were able to refine it more :)
regex is quiet handy once you get good grip of it. So I am trying to learn and slowly apply.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide