[j-nsp] QOS rewrite-rule and classifier on MX

Ioan Branet ioan.branet at gmail.com
Thu Feb 4 07:02:44 EST 2010


Hello group,

I want to mark the packets on Juniper MX240 and to check on Cisco router how
the packets are received marked.

I use classifier and rewrite rules for this.

My understanding is that we can use classifier to mark packets on input
interface and rewrite-rule to remark packets as they leave the interface.

Also I want to find a good example of how can we forward packets on
different next-hop using Class based forwarding (I want to match by
source-class/destination class and to forward to different next-hop with
different IP precedence but i did not found any good examples until now.

My question is why I receive DSCP default packets when I ping from Logical
router to CIsco ME ?


I have the following setup on my lab:

noc at LAB> show interfaces descriptions | match ME
ge-2/1/0        up    up   Link To ME6524-GI1/29
ae0.4011        up    up   Link to ME6524
noc at LAB> show interfaces descriptions | match Jo
irb.111         up    up   Link to Logical-router-JOHN


Logical router John -interface ge-2/0/2.111 ------ int irb.111 ---Real
router John --interface ae0.4011 ----Cisco ME6524

noc at LAB> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
150.1.12.1       ae0.4011               Full      172.16.1.1         1     3
150.111.111.2    irb.111                Full      150.111.111.2    128    38

noc at LAB:John> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
150.111.111.1    ge-2/0/2.111           Full      172.25.231.176   128    39

noc at LAB> show configuration class-of-service
classifiers {
    inet-precedence JOHN {
        forwarding-class best-effort {
            loss-priority high code-points 000;
            loss-priority low code-points [ 010 001 ];
        }
        forwarding-class assured-forwarding {
            loss-priority low code-points 011;
            loss-priority high code-points 100;
        }
        forwarding-class expedited-forwarding {
            loss-priority high code-points 101;
        }
        forwarding-class network-control {
            loss-priority high code-points 111;
            loss-priority low code-points 110;
        }
    }
}
interfaces {
    ge-*/*/* {
        unit * {
            classifiers {
                inet-precedence JOHN;
            }
            rewrite-rules {
                inet-precedence JOHN;
            }
        }
    }
    ae0 {
        unit * {
            classifiers {
                inet-precedence JOHN;
            }
            rewrite-rules {
                inet-precedence JOHN;
            }
        }
    }
    irb {
        unit * {
            classifiers {
                inet-precedence JOHN;
            }
            rewrite-rules {
                inet-precedence JOHN;
            }
        }
    }
}
rewrite-rules {
    inet-precedence JOHN {
        forwarding-class best-effort {
            loss-priority low code-point 001;
            loss-priority high code-point 000;
        }
        forwarding-class assured-forwarding {
            loss-priority low code-point 011;
            loss-priority high code-point 100;
        }
        forwarding-class expedited-forwarding {
            loss-priority low code-point 101;
            loss-priority high code-point 101;
        }
        forwarding-class network-control {
            loss-priority low code-point 110;
            loss-priority high code-point 111;
        }
    }
}


ME6524-Laborator#show ip ospf neighbor  vlan 4011

Neighbor ID     Pri   State           Dead Time   Address         Interface
172.25.231.176  128   FULL/BDR        00:00:03    150.1.12.2      Vlan4011




E6524-Laborator#show running-config interface gi1/29
Building configuration...

Current configuration : 284 bytes
!
interface GigabitEthernet1/29
 description link to Juniper-port 1
 switchport
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 4011,4013
 switchport mode trunk
 mtu 9216
 no ip address
 mls qos vlan-based
 channel-protocol lacp
 channel-group 1 mode active
end


ME6524-Laborator#show running-config interface vlan 4011
Building configuration...

Current configuration : 214 bytes
!
interface Vlan4011
 mtu 9000
 ip address 150.1.12.1 255.255.255.0
 ip ospf hello-interval 1
 ip ospf mtu-ignore
 tag-switching ip
 bfd interval 500 min_rx 500 multiplier 3
 service-policy input FROM_JUNIPER
end

class-map match-any EF
  match ip precedence 5
  match  dscp ef
  match mpls experimental topmost 5
class-map match-any BE
  match  dscp default
  match ip precedence 0
  match mpls experimental topmost 0

When I ping from logical-router to ME6524 the traffic is matched by
policy-map FROM_JUNIPER as DSCP default like you can see:

ME6524-Laborator#show policy-map int vlan 4011
 Vlan4011

  Service-policy input: FROM_JUNIPER

    Class-map: EF (match-any)
      0 packets, 0 bytes
      5 minute offered rate 0 bps
      Match: ip precedence 5
        0 packets, 0 bytes
        5 minute rate 0 bps
      Match:  dscp ef
        0 packets, 0 bytes
        5 minute rate 0 bps
      Match: mpls experimental topmost 5
        0 packets, 0 bytes
        5 minute rate 0 bps

    Class-map: BE (match-any)
      2270 packets, 209008 bytes
      5 minute offered rate 0 bps
      Match:  dscp default
        2270 packets, 209008 bytes
        5 minute rate 0 bps
      Match: ip precedence 0
        0 packets, 0 bytes
        5 minute rate 0 bps
      Match: mpls experimental topmost 0
        0 packets, 0 bytes
        5 minute rate 0 bps

    Class-map: class-default (match-any)
      2 packets, 168 bytes
      5 minute offered rate 0 bps, drop rate 0 bps
      Match: any


noc at LAB:John> ping 172.16.1.1
PING 172.16.1.1 (172.16.1.1): 56 data bytes
64 bytes from 172.16.1.1: icmp_seq=0 ttl=254 time=0.672 ms
64 bytes from 172.16.1.1: icmp_seq=1 ttl=254 time=0.688 ms
64 bytes from 172.16.1.1: icmp_seq=2 ttl=254 time=0.638 ms
64 bytes from 172.16.1.1: icmp_seq=3 ttl=254 time=0.591 ms
^C
--- 172.16.1.1 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.591/0.647/0.688/0.037 ms

ME6524-Laborator# show running-config interface lo0
Building configuration...

Current configuration : 66 bytes
!
interface Loopback0
 ip address 172.16.1.1 255.255.255.255
end


Thank you,
John


More information about the juniper-nsp mailing list