Re: [mpls-linux-general] Re: MPLS-Diffserv Instructions + Counters
Status: Beta
Brought to you by:
jleu
From: Stefano A. <avi...@li...> - 2002-02-27 17:46:17
|
Hi Paul > A1) Script for origin edge MPLS router. > > --------------SCRIPT STARTS----------------------------------------- > #!/bin/sh > # Mplsadm path > MPLSADM=/usr/src/SW/mpls-beta-1_128/mpls-linux-1128/utils/mplsadm2 > $MPLSADM -d > $MPLSADM -v -L eth0:0 > $MPLSADM -v -A -O gen:18:eth0:ipv4:192.168.0.161 > OUT_KEY_18=$(grep 'gen 18' /proc/net/mpls_out | cut -c3-10) > $MPLSADM -v -O key:$OUT_KEY_18 -o > ds2exp:0xf:46:6:push:gen:18:set:eth0:ipv4:192.168.0.161 > iptables -A OUTPUT -d 192.168.0.188/30 -j MPLS --set-key $OUT_KEY_18 > iptables -A FORWARD -d 192.168.0.188/30 -j MPLS --set-key $OUT_KEY_18 > $MPLSADM -v -A -I gen:199:0 > $MPLSADM -v -I gen:199:0 -i pop:exp2ds:2:26:peek > $MPLSADM -d > > --------------SCRIPT ENDS-------------------------------------------- > > The above sets outgoing packets with DSCP of 0x2e with EXP of 6. It marks > incoming packets with EXP 2 with DSCP of 0x1a. > > A2) "mpls_out" for origin edge MPLS router. > > --------------START----------------------------------------- > > 0x00000009 69/5796/0 2 DS2EXP( DS(0e)->EXP(06) ) PUSH(gen 18) > SET(eth0,192.168.0.161) > > --------------END-------------------------------------------- > > As you can see, the ds2exp mapping shown is 0xe->0x06, when it should be > 0x2e->0x06. However, the command seems to be executed corrected i.e a > packet with a DSCP of 0x2e is indeed marked with an EXP of 0x06. This is due to the value you assigned to the mask used by ds2exp (0xf). The role of the mask is the following: a 64-sized array is used to maintain ds-exp couples; the exp value is stored in the element of index ds & mask. When a packet must be sent, its DSCP is ANDed with mask and the result is the index of the element which contain the EXP to set. This means that in your examples also packets with DSCP of 0x1e, 0x3e, 0x4e... will be marked with an EXP of 0x06. If you don't want this, use a mask of 0x3f (the maximum allowed) > I think in my last mail, I mentioned this occurred with the exp2ds, my > mistake... it is for ds2exp as shown above. > > A3) "mpls_in" for origin edge MPLS router. > > --------------START----------------------------------------- > > 0x40031c00 70/6952/0 gen 199 0 1 POP EXP2DS( EXP(2)->DS(1a) ) PEEK > > --------------END-------------------------------------------- > > B1) Script for edge MPLS router at other end. > > --------------SCRIPT STARTS----------------------------------------- > > #!/bin/sh > # Mplsadm path > MPLSADM=/usr/src/SW/mpls-beta-1_128/mpls-linux-1128/utils/mplsadm2 > $MPLSADM -d > $MPLSADM -v -L eth1:0 > $MPLSADM -v -A -I gen:199:0 > $MPLSADM -v -A -O gen:19:eth1:ipv4:192.168.0.129 > OUT_KEY_19=$(grep 'gen 19' /proc/net/mpls_out | cut -c3-10) > $MPLSADM -v -O key:$OUT_KEY_19 -o > set_exp:2:push:gen:19:set:eth1:ipv4:192.168.0.129 > iptables -A OUTPUT -d 192.168.0.168/29 -j MPLS --set-key $OUT_KEY_19 > iptables -A FORWARD -d 192.168.0.168/29 -j MPLS --set-key $OUT_KEY_19 > $MPLSADM -d > > > --------------SCRIPT ENDS-------------------------------------------- > > The above marks outgoing packets with EXP of 2. > > Thus from the above script A1), the origin edge router when receiving a > incoming packet with EXP 2 from router which has ran script B1), it should > mark the DSCP of the packet to 0x1a before forwarding it, right? But, it > doesn't, it always marks it to a value of 0x3e, and I am unsure why... > Are you sure that at the origin edge router packets arrive with EXP 2 ? Since I have some doubt that set_exp works correctly, could you try an equivalent instruction (e.g. ds2exp) ? If this test works, problems are due to set_exp... Let me know, Stefano |