[j-nsp] re-write rules - query

masood at nexlinx.net.pk masood at nexlinx.net.pk
Fri Jul 31 09:28:44 EDT 2009




Yes, you can re-write MPLS packets using rewrite and same goes for
regular IP packets. 
 Let me put this another way; rewrite rules can
be configured that rewrite the DSCP, IP precedence, MPLS EXP, or IEEE
802.1p bits of a packet before it is transmitted.If no rewrite rules are
configured, the outgoing packet is marked according to the forwarding
class and PLP assigned by the classifier.

As I am sitting
right next to the router, here is a sample template... 


jahil at Voyager> show
configuration class-of-service rewrite-rules 
dscp dscp-rewrite {
    forwarding-class NC {
        loss-priority high code-point
111000;
        loss-priority low
code-point 110000;
    }
   
forwarding-class EF {
       
loss-priority low code-point 101110;
    }
    forwarding-class AF {
        loss-priority high code-point
001100;
        loss-priority low
code-point 001010;
    }
   
forwarding-class BE {
       
loss-priority high code-point dscp-BE;
        loss-priority low code-point
dscp-BE1;
    }
}
exp exp-rewrite {
    forwarding-class NC {
        loss-priority high code-point
111;
        loss-priority low
code-point 110;
    }
   
forwarding-class EF {
       
loss-priority low code-point 101;
    }
    forwarding-class AF {
        loss-priority high code-point
011;
        loss-priority low
code-point 100;
    }
   
forwarding-class BE {
       
loss-priority high code-point 001;
        loss-priority low code-point
000;
    }
}

{master}
jahil at Voyager> 

jahil at Voyager> show configuration
class-of-service interfaces 
ge-2/0/0 {
    
unit * {
         
rewrite-rules {
            dscp
dscp-rewrite;
            exp
exp-rewrite;
        }
    }
}

Regards,
Masood
Blog:
http://weblogs.com.pk/jahil/

> Dmitry, Thanks for the
clarification. In a specific example, on an 
> interface 
> can I have both exp and dscp rewrite rules, so that 
> 
> (i) I can re-write MPLS packets using exp rewrite and 
>
(ii) for ip packets (not using mpls) to re-write dscp using dscp re-write

> rules. 
> 
> I have seen errors in log messages
when I use dscp re-write rule in the 
> above scenario, saying
'invalid rewrite table type 1'. This was in J 
> series 
>
using Junos 8.4. 
> 
> Cheers 
> Shiva 
>
On Thu, Jul 30, 2009 at 6:25 PM, Dmitry Perelman 
>
<dmitrynyc at gmail.com>wrote: 
> 
>> 1. You can
rewrite DSCP (all 6 bits) for IPv4 packets only. The 
>>
restriction 
>> that is referenced (3-bit TOS) in your example
exists when the rewrite 
>> is 
>> done on the IPv4
payload ingress to an LSP. 
>> 
>> 2. The link below
covers how to modify the EXP and TOS bits at LSP 
>> ingress.

>> To sum it up: You are able to rewrite the EXP bits along
with the TOS 
>> bits 
>> only at LSP ingress (via
exp rewrite rule) which makes sense because of 
>> IPv4 
>> payload visibility. Since you have no visibility into the IPv4
payload 
>> on 
>> transit nodes you only have the
option to rewrite the EXP bits. You do 
>> then 
>>
have the ability to rewrite the full DSCP field on the egress PE 
>> interface. 
>> 
>> 
>>
http://www.juniper.net/techpubs/en_US/junos9.5/information-products/topic-collections/config-guide-cos/cos-rewriting-mpls-and-ipv4-packet-headers.html#id-11667692

>> 
>> 
>> 
>> On Thu, Jul
30, 2009 at 11:13 AM, Shiva Shankar 
>>
<shankarks at gmail.com>wrote: 
>> 
>>> Gents,
Try to understand in depth re-write rules in M/J series...From 
>>> JUNOS 
>>> 9.5 notes I found the following:

>>> 
>>> *For every incoming packet, the
ingress classifier decodes the ingress 
>>> CoS 
>>> bits into a forwarding class and packet loss priority (PLP)

>>> combination. 
>>> The 
>>>
egress CoS information depends on which type of rewrite marker is 
>>> active, 
>>> as 
>>> follows: *

>>> 
>>> - *For Multiprotocol Label Switching
(MPLS) EXP and IEEE 802.1 
>>> rewrite 
>>>
markers, values are derived from the forwarding class and PLP values 
>>> in 
>>> rewrite rules. MPLS EXP and IEEE
802.1 markers are not preserved 
>>> because 
>>> they are part of the Layer 2 encapsulation. * 
>>> - *For IP precedence and DiffServ code point (DSCP) rewrite
markers, 
>>> the 
>>> marker alters the first
three bits on the type-of-service (ToS) byte 
>>> while 
>>> leaving the last three bits unchanged. * 
>>>

>>> *Questions: 
>>> * 
>>> *1.
Does it mean that on Juniper M series routers, I can never chnage 
>>> the 
>>> last 3 bits of the TOS
byte...meaning never use the full potential of 
>>> the 
>>> DSCP (6 bits)? 
>>> * 
>>> *2.
So, can't I use dscp and exp re-write rules for a MPLS packet 
>>> entering 
>>> a 
>>> LSP on a
specific interface..? It means that again I can't use DSCP in 
>>> MPLS 
>>> evnvironment? 
>>>

>>> *Cheers 
>>>
_______________________________________________ 
>>>
juniper-nsp mailing list juniper-nsp at puck.nether.net 
>>>
https://puck.nether.net/mailman/listinfo/juniper-nsp 
>>>

>> 
>> 
>
_______________________________________________ 
> juniper-nsp
mailing list juniper-nsp at puck.nether.net 
>
https://puck.nether.net/mailman/listinfo/juniper-nsp 
> 



More information about the juniper-nsp mailing list