Junos OS

last person joined: 7 days ago 

Ask questions and share experiences about Junos OS.
  • 1.  Cli Regex

    Posted 08-11-2014 06:49
    How to match against "All INTERFACE (not interested in anything else) IP addresses in the configuration with masks: '/128|/126|/32|/31/30' Any ideas?!


  • 2.  RE: Cli Regex
    Best Answer

    Posted 08-11-2014 09:52

    Hello,

    Please see below:

    ## 1st, showing all IPv4/IPv6 addresses configured on fe-0/3/3 and lo0
    aarseniev@m7i> show interfaces fe-0/3/3 terse
    Aug 11 18:50:45
    Interface Admin Link Proto Local Remote
    fe-0/3/3 up up
    fe-0/3/3.0 up up inet 198.18.1.0/31
    198.18.2.1/30
    198.18.3.1/25
    inet6 bcde::1/126
    cdef::1/96
    fe80::21b:c0ff:fed8:9060/64

    aarseniev@m7i> show interfaces lo0 terse
    Aug 11 18:50:47
    Interface Admin Link Proto Local Remote
    lo0 up up
    lo0.0 up up inet 7.0.0.7 --> 0/0
    iso 49.0001.0070.0000.0007
    inet6 abcd::
    fe80::2a0:a50f:fc5e:6e3f
    lo0.16384 up up inet 127.0.0.1 --> 0/0
    lo0.16385 up up inet
    ## 2nd, filtering only interested subnet lengths aarseniev@m7i> show route protocol direct terse | match "/32|/30|/31|/126|/128" Aug 11 18:51:57 * ? 7.0.0.7/32 D 0 >lo0.0 * ? 198.18.1.0/31 D 0 >fe-0/3/3.0 * ? 198.18.2.0/30 D 0 >fe-0/3/3.0 * ? abcd::/128 D 0 >lo0.0 * ? bcde::/126 D 0 >fe-0/3/3.0 fe80::2a0:a50f:fc5e:6e3f/128

    HTH

    Thanks

    Alex 



  • 3.  RE: Cli Regex

    Posted 08-18-2014 01:55
    Not quite what I had in mind but looking at the direct routes is equally good. Thank you


  • 4.  RE: Cli Regex

    Posted 08-18-2014 03:40

    If you are looking for ip addresses configured on the interface itself, I usually use the following:

     

    root@srx100> show interfaces terse | match inet 
    fe-0/0/0.0              up    up   inet     1.1.1.1/24      
    sp-0/0/0.0              up    up   inet    
    sp-0/0/0.16383          up    up   inet     10.0.0.1            --> 10.0.0.16
    fe-0/0/7.0              up    down inet     192.168.3.1/24  
    lo0.0                   up    up   inet     127.0.0.1           --> 0/0
    lo0.16384               up    up   inet     127.0.0.1           --> 0/0
    lo0.16385               up    up   inet     10.0.0.1            --> 0/0
    st0.0                   up    up   inet     10.0.0.1/24     
    vlan.0                  up    down inet     10.0.1.1/24