Packet Flow Monitoring Overview
The policy log rule provides a way to monitor a packet flow by capturing a sample of the packets that satisfy the classification of the rule in the system log. See the JUNOSe System Event Logging Reference Guide for information about logging.
To capture the interface, protocol, source address, destination address, source port, and destination port, set the policyMgrPacketLog event category to log at severity info and at low verbosity. To capture the version, ToS, len ID, flags, time to live (TTL), protocol, and checksum in addition to the information captured at low verbosity, set the verbosity to medium or high.
When the policy is configured, all packets are examined and the matching packets are placed in the log. No more than 512 packets are logged every 3 seconds. The router maintains a count of the total number of matching packets. This count is incremental even if the packet cannot be stored in the log (for example, because the count exceeds the 512-packet threshold).
This example shows how you might use classification to specify the ingress packets that are logged on an interface.
host1(config)#ip policy-list testPolicyhost1(config-policy-list)#classifier-group logAhost1(config-policy-list-classifier-group)#loghost1(config-policy-list-classifier-group)#exithost1(config-policy-list)#exithost1(config)#interface atm 0/0.0host1(config-subif)#ip policy input testPolicy statistics enabledhost1(config-subif)#exithost1(config)#log destination console severity infohost1(config)#log severity info policyMgrPacketLoghost1(config)#log verbosity low policyMgrPacketLoghost1(config)#log hereThis example provides a more detailed procedure that an ISP might use to log information during a ping attack on the network. The procedure includes the creation of the classifier and policy lists to specify the desired packet flow to monitor, the logging of the output of the classification operation, and the output of the show command.
In this example, a customer has reported to their ISP that an attack is occurring on their internal servers. The attack is a simple ping flood.
- The ISP creates a classifier list to define an ICMP echo request packet flow.
host1:vr2(config)#ip classifier-list icmpEchoReq icmp any any 8 0host1:vr2(config)#ip policy-list pingAttackhost1:vr2(config-policy-list)#classifier-group icmpEchoReqhost1:vr2(config-policy-list-classifier-group)#loghost1:vr2(config-policy-list-classifier-group)#exithost1:vr2(config-policy-list)#exithost1:vr2(config)#interface gigabitEthernet 2/0host1:vr2(config-if)#ip address 10.10.10.2 255.255.255.0host1:vr2(config-if)#exithost1:vr2(config)#virtual-router vr1host1:vr1(config)#interface gigabitEthernet 0/0host1:vr1(config-if)#ip address 10.10.10.1 255.255.255.0host1:vr1(config-if)#ip policy input pingAttack statistics enabledhost1:vr1(config-if)#exithost1:vr1(config)#exit- The ISP configures standard logging on the E-series router.
host1(config)#log destination console severity infohost1(config)#log severity info policyMgrPacketLoghost1(config)#log hereINFO 12/16/2003 12:59:47 policyMgrPacketLog ():icmpEchoReq icmp GigabitEthernet0/0 10.10.10.2 10.10.10.1 forwardedINFO 12/16/2003 12:59:47 policyMgrPacketLog ():icmpEchoReq GigabitEthernet0/0 number of hits = 21551INFO 12/16/2003 12:59:50 policyMgrPacketLog ():icmpEchoReq icmp GigabitEthernet0/0 10.10.10.2 10.10.10.1 forwardedINFO 12/16/2003 12:59:50 policyMgrPacketLog ():icmpEchoReq GigabitEthernet0/0 number of hits = 21851INFO 12/16/2003 12:59:53 policyMgrPacketLog ():icmpEchoReq icmp GigabitEthernet0/0 10.10.10.2 10.10.10.1 forwardedINFO 12/16/2003 12:59:53 policyMgrPacketLog ():icmpEchoReq GigabitEthernet0/0 number of hits = 22151- The ISP displays statistics for the interface.
host1:vr1#show ip interface gigabitEthernet 0/0GigabitEthernet0/0 line protocol Ethernet is up, ip is upNetwork Protocols: IPInternet address is 10.10.10.1/255.255.255.0Broadcast address is 255.255.255.255Operational MTU = 1500 Administrative MTU = 0Operational speed = 1000000000 Administrative speed = 0Discontinuity Time = 1092358Router advertisement = disabledProxy Arp = enabledNetwork Address Translation is disabledAdministrative debounce-time = disabledOperational debounce-time = disabledAccess routing = disabledMultipath mode = hashedAuto Configure = disabledAuto Detect = disabledInactivity Timer = disabledIn Received Packets 488421, Bytes 62517888Unicast Packets 488421, Bytes 62517888Multicast Packets 0, Bytes 0In Policed Packets 0, Bytes 0In Error Packets 0In Invalid Source Address Packets 0In Discarded Packets 0Out Forwarded Packets 486152, Bytes 62232048Unicast Packets 486152, Bytes 62232048Multicast Routed Packets 0, Bytes 0Out Scheduler Dropped Packets 0, Bytes 0Out Policed Packets 0, Bytes 0Out Discarded Packets 2269IP policy input pingAttackclassifier-group icmpEchoReq entry 1488421 packets, 69355782 byteslogqueue 0: traffic class best-effort, bound to ip GigabitEthernet0/0Queue length 0 bytesForwarded packets 485988, bytes 70954248Dropped committed packets 0, bytes 0Dropped conformed packets 0, bytes 0Dropped exceeded packets 0, bytes 0