[mpls-linux-general] Re: MPLS-Diffserv Instructions + Counters
Status: Beta
Brought to you by:
jleu
From: ncc49a <nc...@si...> - 2002-02-26 19:19:01
|
Hi Stefano, Thanks for replying! Attached are some examples... > > 1) The exp->ds mapping is sometimes reflected incorrectly in the > > "/proc/mpls_*" files. > > Could you provide any example ? > > 2) To test the exp2ds function, I have set up a couple of MPLS routers > > in serial, with non-MPLS hosts/routers at each ends. I then ping an end > > host from the other end. The non-Mpls host/router which is the origin will > > mark a packet's DSCP. The edge MPLS router will mark the EXP bits based on > > the DSCP value. The edge MPLS router at the end will re-mark the DSCP of > > the incoming packet, based on its EXP. As the packet returns, it will mark > > the outgoing EXP bits based on the new DSCP. The origin MPLS edge router > > will then remark the DSCP (again) based on the incoming new EXP bits. > > > > I monitor at the origin MPLS router's interfaces. I find that the > > new EXP bits on the shim of the returned incoming ping packet is correct. > > However,the returning packet on the outgoing interface of the origin MPLS > > edge (connected to the origin non-MPLS host/router) has its DSCP bits > > marked wrongly. > > > > Anyone knows what could be a possible reason? > > > > It seems strange to me. Have you checked that /proc/net/mpls_* content reflects what you want to do ? > Anyway, you should provide more information (e.g. the commands you typed and what instead you obtain) to let someone help you. 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. 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... > > You could try this way: you use a tcindex filter (which classify packets based on skb->tc_index) to select a dsmark class which sets the desired DSCP value. > For example: > > mplsadm2 -v -A -I gen:199:0 > mplsadm2 -v -I gen:199:0 -i pop:exp2tc:2:184:peek > > tc qdisc add dev $ITF handle 1:0 root dsmark indices 64 > tc class change dev $ITF classid 1:1 dsmark mask 0x0 value 0xb8 > tc filter add dev $ITF parent 1:0 protocol ip prio 1 tcindex mask 0xff > tc filter add dev $ITF parent 1:0 protocol ip prio 1 handle 184 tcindex classid 1:1 > > Thus packets arriving with label 199 and Exp 2 will leave with DS field 0xb8 (DSCP 0x2e). > Let me know if this works. > Yup, the above worked! It is like a exp2ds function... thanks! Regards, Paul |