Overblog Suivre ce blog
Editer l'article Administration Créer mon blog
24 août 2012 5 24 /08 /août /2012 16:28

Troubleshooting Load-balancing is quite complex. Working on an operational team, I often need to know on which interface a given stream (IP or MPLS) will get out...


Cisco IOX provides several cli commands to quickly compute and display the result of a hash of a given stream and finally gives us the forwarding next-hop (the outgoing Interface). Juniper doesn't provide these types of command. I recently wrote an ER to have these one, but I don't know, if and when, these will be implemented.


Nevertheless, on Junos we can play with PFE related commands (Remember: those commands are not supported by Jtac). After a long time in lab I found, one year ago, how to find the outgoing interface for a given stream but only for DPC cards. For MPC the lookup is totally distributed on the LU chip (PPE). I'm going on to find it but It's not easy, I'm pretty sure I will need the help of a Juniper SE... :) 


Anyway, below I explain my tip to find the outgoing Interface taken by a given stream when the Ingress card is an DPC. 


The exemple refers to this diagram: 




In this example I sent a simple stream (ping) from Patrick ( to CARLOS ( I want to know of which physical interface BOB will send out the traffic.


On BOB :


Step 1: Connect to the Ingress Card


sponge@bob> start shell pfe network fpc0


Step 2: Reset the jsim (I guess it means Jtree simulation ???) lookup engine


ADPC0(bob vty)# jsim reset


Step 3: Find the interface index of the ae41.0 (the incoming interface).


 ADPC0(bob vty)# sho ifl brief
Index  Name                 Type           Encapsulation   Flags
-----  -------------------- -------------  --------------  ------

  331  ae41.0               Ethernet       Ethernet        0x000000000400c000


Step 4: Configure the key buffer with the parameters of your stream. I meaned, with the value of the fields used by the load balancing algorithm. In my configuration, I use the default hash-key config. Therefore, for IPv4 traffic, the keys are : Incoming interface Index + @IP Src + @IP Dst + IP-Proto.


 ADPC0(bob vty)# set jsim iif 331


ADPC0(bob vty)# set jsim ipsrc


ADPC0(bob vty)# set jsim ipdst


ADPC0(bob vty)# set jsim ip-protocol 1 (ICMP PING)


Step 5: Check the key buffer


ADPC0(bob vty)# sho jsim keyb
Ucode protocol: 0 (IPv4)
Source port: wan
Key Buffer:
    rewrite0: 0x00
    rewrite1: 0x00
    rewrite2: 0x00
    rewrite3: 0x00
    pktlen: 0
    sample mask: 0x00
      l3rw: 0x00, l3n: 0
      Qn: 0x00, dp: 0x0
      PolRes: 0x00
    iif: 0x00014b
    token: 0x000000
    ip_proto: 1
    src_port: 0
    dst_port: 0
    tos: 0x00
    fragment: 0x0000
    tcp_flags: 0x00



Step 6: Now, let's start the lookup (the lout_key at the bottom it what we look for)

ADPC0(bob vty)# jsim lookup
Step Kp Address     Data     Description
---- -- ----------- -------- -----------
[ 1] 16 reg  000000 0000a679 nh: TID itable tid=10 offset=-7
        itid 00000a 0c240800 itable address (seg 0)
                    04000010 itable descriptor addr=0x030902 size=65536 idx_bits=16 bit_offset=0
[ 2]  9 sram 030a4f 14e09578 nh: itable offset=-8 addr=0x053824
        sram 053824 00001002 itable descriptor addr=0x053824 size=4 idx_bits=2 bit_offset=0
[ 3]  1 sram 053826 a2a75728 nh: extended buff-modify intermediate-nh addr=0x28a9d4
        sram 28a9d4 d840f2ab Buffer Translate: write kb(8), off 42, bits 12, data 0xffff040
[ 4]  1 sram 28a9d5 40000689 nh: TID Null tid=0 offset=9(abs)

STACK PUSH (0): key-ptr  1, addr 0028a9d6, seg 0, se 0,

STACK POP (0) Context: Extended_NH
 [ 5]  9 sram 28a9d6 a22c8728 nh: extended buff-modify intermediate-nh addr=0x288b20
        sram 288b20 02006200 Buffer write: write kb(0), off 32, bits 8, data 0x2
[ 6]  9 sram 288b21 00000e07 nh: TID jtree tid=0 offset=7
[ 7] 16 tid  000000 154b8608 jtree_ptr four-way btt=8 addr=0x0552e0
        jtab 000051 041c3200 initial jtree stack: jtree_ptr attached btt=0 addr=0x01070c
[ 8] 16 sram 0552e3 7b25d60a jtree_ptr four-way btt=10 addr=0x1ec974
[ 9] 16 sram 1ec977 347be60c jtree_ptr four-way btt=12 addr=0x0d1ef8
[10] 16 sram 0d1efb 1573900e jtree_ptr two-way btt=14 addr=0x055ce4
[11] 16 sram 055ce4 251d400f jtree_ptr two-way btt=15 addr=0x094750
[12] 16 sram 094751 61975610 jtree_ptr four-way btt=16 addr=0x1865d4
[13] 16 sram 1865d7 15bc0812 jtree_ptr two-way btt=18 addr=0x056f02
[14] 16 sram 056f02 25207013 jtree_ptr two-way btt=19 addr=0x09481c
[15] 16 sram 09481c 264c6014 jtree_ptr two-way btt=20 addr=0x099318
[16] 16 sram 099318 701b5217 jtree_ptr attached btt=23 addr=0x1c06d4
[17] 16 sram 1c06d4 68eee818 jtree_ptr two-way btt=24 addr=0x1a3bba
[18] 16 sram 1a3bba 0000d019 jtree_ptr two-way btt=25 addr=0x000034
[19] 16 sram 000034 155ea01a jtree_ptr two-way btt=26 addr=0x0557a8
[20] 16 sram 0557a8 a2cbf81b jtree_ptr two-way btt=27 addr=0x28b2fe
[21] 16 sram 28b2fe a2b6c61c jtree_ptr four-way btt=28 addr=0x28adb0
[22] 16 sram 28adb1 a2b6b61e jtree_ptr four-way btt=30 addr=0x28adac
[23] 16 sram 28adad a2c4dc20 jtree_ptr child plen=32 addr=0x28b136
[24] 16 sram 28b136 5ad13b02 nh: multiple bal-hash hops=2 addr=0x16b44e
[25] 16 sram 16b44e 54f4bf0a nh: extended final buff-modify addr=0x153d2e
        sram 153d2e 0025f04d modified final nh: final: sid=77 nh_index=0x0004be
        sram 153d2f d8400ecb Buffer Translate: write kb(8), off 44, bits 3, data 0x7fff8

Lookup terminated normally:
    forward to sid 77,     lout_key=0x000004be (Fabric) proto 0
dp=3 qn=7 sample=0x02


Step 7: The Lout_Key is actually the NH ID. So now, we need to resolv the NH ID by using the nhdb command


ADPC0(bob vty)# show nhdb id 0x000004be
   ID      Type      Interface    Next Hop Addr    Protocol       Encap     MTU       Flags  PFE internal Flags
-----  --------  -------------  ---------------  ----------  ------------  ----  ----------  --------------------
 1214   Unicast  xe-3/1/1.0           IPv4      Ethernet     0  0x00000000 0x00000000


Wow We found the outgoing interface (xe-3/1/1.0) of my stream.... :)


Watch this on these 2 small videos (if needed:):


Video 1 then Video 2 




Partager cet article

Repost 0
Published by junosandme - dans Posts
commenter cet article