Merging Policies Configuration
In the following example IP policy p1 and IP policy p2 are attached at interface atm5/0.1 as input attachments. Subsequently, policy p3 is attached at the same point. Then policies p1 and p2 are attached as output at atm 5/0.2.
- Create IP policy p1.
host1(config)#ip classifier-list C1 tcp host 1.1.1.1 any eq 80host1(config)#ip classifier-list C2 icmp any any 8 0host1(config)#ip policy-list p1host1(config-policy)#classifier-group C1 precedence 90host1(config-policy-classifier-group)#forward next-hop 10.1.1.1host1(config-policy-classifier-group)#exithost1(config-policy)#classifier-group C2 precedence 10host1(config-policy-classifier-group)#filterhost1(config-policy-classifier-group)#exit- Create IP policy p2.
host1(config)#ip classifier-list C1 tcp host 1.1.1.1 any eq 80host1(config)#ip classifier-list C3 ip any host 2.2.2.2host1(config)#ip policy-list p2host1(config-policy)#classifier-group C1 precedence 90host1(config-policy-classifier-group)#forward next-hop 20.1.1.1host1(config-policy-classifier-group)#exithost1(config-policy)#classifier-group C3 precedence 10host1(config-policy-classifier-group)#filterhost1(config-policy-classifier-group)#exithost1(config-policy)#classifier-group * precedence 1000host1(config-policy-classifier-group)#forwardhost1(config-policy-classifier-group)#exit- Attach IP policy p1 as input at interface atm5/0.1.
host1(config)#Interface atm 5/0.1host1(config-subif)#ip policy input p1 statistics enable mergehost1(config-subif)#exit- Attach IP policy p2 as input at interface atm 5/0.1. A merged policy is created.
host1(config)#Interface atm 5/0.1host1(config-subif)#ip policy input p2 statistics enable mergehost1(config-subif)#exit- Display the policy lists.
host1#show policy-listPolicy Table------ -----IP Policy p1Administrative state: enableReference count: 1Classifier control list: C2, precedence 10filterClassifier control list: C1, precedence 90forwardVirtual-router: defaultList:next-hop 10.1.1.1, order 100, rule 2 (active)Referenced by interfaces:NoneReferenced by profiles:NoneReferenced by merge policies:mpl_5IP Policy p2Administrative state: enableReference count: 1Classifier control list: C3, precedence 10filterClassifier control list: C1, precedence 90forwardVirtual-router: defaultList:next-hop 20.1.1.1, order 100, rule 3 (active)Classifier control list: *, precedence 1000forwardReferenced by interfaces:NoneReferenced by profiles:NoneReferenced by merge policies:mpl_5IP Policy mpl_5Administrative state: enableReference count: 1Classifier control list: C2, precedence 10filterClassifier control list: C3, precedence 10filterClassifier control list: C1, precedence 90forwardVirtual-router: defaultList:next-hop 10.1.1.1, order 100, rule 2 (active)next-hop 20.1.1.1, order 100, rule 3 (reachable)Classifier control list: *, precedence 1000forwardReferenced by interfaces:ATM5/0.1 input policy, statistics enabled, virtual-router defaultReferenced by profiles:NoneComponent policies:p1p2- Show configuration.
host1#show conf! Configuration script being generated on TUE APR 26 2005 17:33:01 UTC! Juniper Edge Routing Switch ERX-1440! Version: 9.9.9 development-4.0 (April 4, 2005 15:39)! Copyright (c) 1999-2005 Juniper Networks, Inc. All rights reserved.!! Commands displayed are limited to those available at privilege level 15!...interface atm 5/0.1ip policy input p1 statistics enabled mergeip policy input p2 statistics enabled mergeexit......ip policy-list p1classifier-group C2 precedence 10filterclassifier-group C1 precedence 90forward next-hop 10.1.1.1!ip policy-list p2classifier-group C3 precedence 10filterclassifier-group C1 precedence 90forward next-hop 20.1.1.1classifier-group * precedence 1000forward!......! End of generated configuration script.- Display interface statistics.
host1#show ip interface atm 5/0.1ATM5/0.1 line protocol Atm1483 is up, ip is upNetwork Protocols: IPInternet address is 99.99.99.2/255.255.255.0Broadcast address is 255.255.255.255Operational MTU = 9180 Administrative MTU = 0Operational speed = 155520000 Administrative speed = 0Discontinuity Time = 721112Router advertisement = disabledProxy Arp = disabledNetwork Address Translation is disabledTCP MSS Adjustment = disabledAdministrative debounce-time = disabledOperational debounce-time = disabledAccess routing = disabledMultipath mode = hashedAuto Configure = disabledAuto Detect = disabledInactivity Timer = disabledIn Received Packets 0, Bytes 0Unicast Packets 0, Bytes 0Multicast Packets 0, Bytes 0In Policed Packets 0, Bytes 0In Error Packets 0In Invalid Source Address Packets 0In Discarded Packets 0Out Forwarded Packets 0, Bytes 0Unicast Packets 0, Bytes 0Multicast Routed Packets 0, Bytes 0Out Scheduler Dropped Packets 0, Bytes 0Out Policed Packets 0, Bytes 0Out Discarded Packets 0IP policy input mpl_5classifier-group C2 entry 10 packets, 0 bytesfilterclassifier-group C3 entry 10 packets, 0 bytesfilterclassifier-group C1 entry 10 packets, 0 bytesforwardclassifier-group *0 packets, 0 bytesforwardqueue 0: traffic class best-effort, bound to ip ATM5/0.1Queue length 0 bytesForwarded packets 0, bytes 0Dropped committed packets 0, bytes 0Dropped conformed packets 0, bytes 0Dropped exceeded packets 0, bytes 0- Attach IP policy p1 at atm 5/0.2 as output.
host1(config)#interface atm 5/0.2host1(config-subif)#ip policy output p1 statistics enable mergehost1(config-subif)#exit- Attach IP policy p2 at atm 5/0.2 as output. Merge policy mpl_5 is now attached.
host1(config)#interface atm 5/0.2host1(config-subif)#ip policy output p2 mergehost1(config-subif)#exit- Display policies to verify that mpl_5 is created.
host1#show policy-listPolicy Table------ -----IP Policy p1Administrative state: enableReference count: 1Classifier control list: C2, precedence 10filterClassifier control list: C1, precedence 90forwardVirtual-router: defaultList:next-hop 10.1.1.1, order 100, rule 2 (active)Referenced by interfaces:NoneReferenced by profiles:NoneReferenced by merge policies:mpl_5IP Policy p2Administrative state: enableReference count: 1Classifier control list: C3, precedence 10filterClassifier control list: C1, precedence 90forwardVirtual-router: defaultList:next-hop 20.1.1.1, order 100, rule 3 (active)Classifier control list: *, precedence 1000forwardReferenced by interfaces:NoneReferenced by profiles:NoneReferenced by merge policies:mpl_5IP Policy mpl_5Administrative state: enableReference count: 2Classifier control list: C2, precedence 10filterClassifier control list: C3, precedence 10filterClassifier control list: C1, precedence 90forwardVirtual-router: defaultList:next-hop 10.1.1.1, order 100, rule 2 (active)next-hop 20.1.1.1, order 100, rule 3 (reachable)Classifier control list: *, precedence 1000forwardReferenced by interfaces:ATM5/0.1 input policy, statistics enabled, virtual-router defaultATM5/0.2 output policy, statistics enabled, virtual-router defaultReferenced by profiles:NoneComponent policies:p1p2- Create and attach IP policy p3 at atm 5/0.1. A new merge policy mpl_7 is created, which is a combination of p1, p2, and p3. The previous merge policy attachment is removed.
host1(config)#ip classifier-list C4 udp host 1.1.1.1 any eq 900host1(config)#ip policy-list p3host1(config-policy)#classifier-group C4 precedence 900host1(config-policy-classifier-group)#color redhost1(config-policy-classifier-group)#exithost1(config-policy)#classifier-group C1 precedence 80host1(config-policy-classifier-group)#color yellowhost1(config-policy-classifier-group)#exithost1(config-policy)#exithost1(config)#interface atm 5/0.1host1(config-subif)#ip policy input p3 statistics enable mergehost1(config-subif)#exit- Display policies to verify that mpl_5 and mpl_7 have been created.
host1#show policy-listPolicy Table------ -----IP Policy p1Administrative state: enableReference count: 2Classifier control list: C2, precedence 10filterClassifier control list: C1, precedence 90forwardVirtual-router: defaultList:next-hop 10.1.1.1, order 100, rule 2 (active)Referenced by interfaces:NoneReferenced by profiles:NoneReferenced by merge policies:mpl_5mpl_7IP Policy p2Administrative state: enableReference count: 2Classifier control list: C3, precedence 10filterClassifier control list: C1, precedence 90forwardVirtual-router: defaultList:next-hop 20.1.1.1, order 100, rule 3 (active)Classifier control list: *, precedence 1000forwardReferenced by interfaces:NoneReferenced by profiles:NoneReferenced by merge policies:mpl_5mpl_7IP Policy p3Administrative state: enableReference count: 1Classifier control list: C1, precedence 80color yellowClassifier control list: C4, precedence 900color redReferenced by interfaces:NoneReferenced by profiles:NoneReferenced by merge policies:mpl_7IP Policy mpl_5Administrative state: enableReference count: 1Classifier control list: C2, precedence 10filterClassifier control list: C3, precedence 10filterClassifier control list: C1, precedence 90forwardVirtual-router: defaultList:next-hop 10.1.1.1, order 100, rule 2 (active)next-hop 20.1.1.1, order 100, rule 3 (reachable)Classifier control list: *, precedence 1000forwardReferenced by interfaces:ATM5/0.2 output policy, statistics enabled, virtual-router defaultReferenced by profiles:NoneComponent policies:p1p2IP Policy mpl_7Administrative state: enableReference count: 1Classifier control list: C2, precedence 10filterClassifier control list: C3, precedence 10filterClassifier control list: C1, precedence 80forwardVirtual-router: defaultList:next-hop 10.1.1.1, order 100, rule 2 (active)next-hop 20.1.1.1, order 100, rule 3 (reachable)color yellowClassifier control list: C4, precedence 900color redClassifier control list: *, precedence 1000forwardReferenced by interfaces:ATM5/0.1 input policy, statistics enabled, virtual-router defaultReferenced by profiles:NoneComponent policies:p1p2p3- Detach p2 from atm 5/0.1. A new merge policy mpl_8 is created, which is a combination of p1 and p3. The previous merge policy mpl_7 is detached and, because this policy has no attachments, it is deleted.
host1(config)#interface atm 5/0.1host1(config-subif)#no ip policy input p2host1(config-subif)#exit- Display policies to verify that the mpl_7 is removed and the new merge policy mpl_8 is created.
host1#show policy-listPolicy Table------ -----IP Policy p1Administrative state: enableReference count: 2Classifier control list: C2, precedence 10filterClassifier control list: C1, precedence 90forwardVirtual-router: defaultList:next-hop 10.1.1.1, order 100, rule 2 (active)Referenced by interfaces:NoneReferenced by profiles:NoneReferenced by merge policies:mpl_5mpl_8IP Policy p2Administrative state: enableReference count: 1Classifier control list: C3, precedence 10filterClassifier control list: C1, precedence 90forwardVirtual-router: defaultList:next-hop 20.1.1.1, order 100, rule 3 (active)Classifier control list: *, precedence 1000forwardReferenced by interfaces:NoneReferenced by profiles:NoneReferenced by merge policies:mpl_5IP Policy p3Administrative state: enableReference count: 1Classifier control list: C1, precedence 80color yellowClassifier control list: C4, precedence 900color redReferenced by interfaces:NoneReferenced by profiles:NoneReferenced by merge policies:mpl_8IP Policy mpl_5Administrative state: enableReference count: 1Classifier control list: C2, precedence 10filterClassifier control list: C3, precedence 10filterClassifier control list: C1, precedence 90forwardVirtual-router: defaultList:next-hop 10.1.1.1, order 100, rule 2 (active)next-hop 20.1.1.1, order 100, rule 3 (reachable)Classifier control list: *, precedence 1000forwardReferenced by interfaces:ATM5/0.2 output policy, statistics enabled, virtual-router defaultReferenced by profiles:NoneComponent policies:p1p2IP Policy mpl_8Administrative state: enableReference count: 1Classifier control list: C2, precedence 10filterClassifier control list: C1, precedence 80forwardVirtual-router: defaultList:next-hop 10.1.1.1, order 100, rule 2 (active)next-hop 20.1.1.1, order 100, rule 3 (reachable)color yellowClassifier control list: C4, precedence 900color redReferenced by interfaces:ATM5/0.1 input policy, statistics enabled, virtual-router defaultReferenced by profiles:NoneComponent policies:p1p3- Detach p1 from atm 5/0.1. Merge policy mpl_8 is detached and deleted, and only p3 is attached to this interface.
host1(config)#interface atm 5/0.1host1(config-subif)#no ip policy input p1host1(config-subif)#exit- Display policies to verify that p3 is attached to atm 5/0.1 and mpl_8 is removed.
host1#show policy-listPolicy Table------ -----IP Policy p1Administrative state: enableReference count: 1Classifier control list: C2, precedence 10filterClassifier control list: C1, precedence 90forwardVirtual-router: defaultList:next-hop 10.1.1.1, order 100, rule 2 (active)Referenced by interfaces:NoneReferenced by profiles:NoneReferenced by merge policies:mpl_5IP Policy p2Administrative state: enableReference count: 1Classifier control list: C3, precedence 10filterClassifier control list: C1, precedence 90forwardVirtual-router: defaultList:next-hop 20.1.1.1, order 100, rule 3 (active)Classifier control list: *, precedence 1000forwardReferenced by interfaces:NoneReferenced by profiles:NoneReferenced by merge policies:mpl_5IP Policy p3Administrative state: enableReference count: 1Classifier control list: C1, precedence 80color yellowClassifier control list: C4, precedence 900color redReferenced by interfaces:ATM5/0.1 input policy, statistics disabled, virtual-router defaultReferenced by profiles:NoneReferenced by merge policies:NoneIP Policy mpl_5Administrative state: enableReference count: 1Classifier control list: C2, precedence 10filterClassifier control list: C3, precedence 10filterClassifier control list: C1, precedence 90forwardVirtual-router: defaultList:next-hop 10.1.1.1, order 100, rule 2 (active)next-hop 20.1.1.1, order 100, rule 3 (reachable)Classifier control list: *, precedence 1000forwardReferenced by interfaces:ATM5/0.2 output policy, statistics enabled, virtual-router defaultReferenced by profiles:NoneComponent policies:p1p2- Detach p3 from atm 5/0.1.
host1(config)#interface atm 5/0.1host1(config-subif)#no ip policy input p3host1(config-subif)#exit- Detach p1 from atm 5/0.2. Merge policy mpl_5 is detached and deleted and only p2 is now attached.
host1(config)#interface atm 5/0.2host1(config-subif)#no ip policy output p1host1(config-subif)#exit- Detach p2 from atm 5/0.2.
host1(config)#interface atm 5/0.2host1(config-subif)#no ip policy output p2host1(config-subif)#exit- Display policies to verify that no merge policies exist and that all other policies have a 0 reference count because they are not attached anywhere.
host1#show policy-listPolicy Table------ -----IP Policy p1Administrative state: enableReference count: 0Classifier control list: C2, precedence 10filterClassifier control list: C1, precedence 90forwardVirtual-router: defaultList:next-hop 10.1.1.1, order 100, rule 2 (active)IP Policy p2Administrative state: enableReference count: 0Classifier control list: C3, precedence 10filterClassifier control list: C1, precedence 90forwardVirtual-router: defaultList:next-hop 20.1.1.1, order 100, rule 3 (active)Classifier control list: *, precedence 1000forwardIP Policy p3Administrative state: enableReference count: 0Classifier control list: C1, precedence 80color yellowClassifier control list: C4, precedence 900color red