1 / 114

Flow-tools Tutorial

Flow-tools Tutorial. Mark Fullmer maf@oar.net. Agenda. Deployment motivation. Network flows. Cisco / Juniper implementation – NetFlow. Cisco / Juniper Configuration. flow-tools programs overview and examples from Abilene and Ohio-Gigapop. Motivations.

Download Presentation

Flow-tools Tutorial

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Flow-tools Tutorial Mark Fullmer maf@oar.net

  2. Agenda • Deployment motivation. • Network flows. • Cisco / Juniper implementation – NetFlow. • Cisco / Juniper Configuration. • flow-tools programs overview and examples from Abilene and Ohio-Gigapop.

  3. Motivations • Where your campus exchanges traffic with by IP address, IP Prefix, or ASN. • What type and how much traffic (SMTP, WEB, File Sharing, etc). • What services running on campus. • Department level traffic summaries. • Track network based viruses back to hosts.

  4. Motivations • Track DoS attacks to the source(s), ie the 100 Solaris servers flooding whitehouse.gov that have been 0wn3d. • Find busy hosts on campus. • How many destinations each campus host exchanges traffic with. • Campus host counts by service, ie how many active web servers.

  5. Network Flows • Packets or frames that have a common attribute. • Creation and expiration policy – what conditions start and stop a flow. • Counters – packets,bytes,time. • Routing information – AS, network mask, interfaces.

  6. Network Flows • Unidirectional or bidirectional. • Bidirectional flows can contain other information such as round trip time, TCP behavior. • Application flows look past the headers to classify packets by their contents. • Aggregated flows – flows of flows.

  7. ssh session faith.splintered:~% ssh eng4.oar.net w 10:12PM up 476 days, 21:06, 7 users, load averages: 0.00, 0.00, 0.00 USER TTY FROM LOGIN@ IDLE WHAT maf p0 dhcp9578217.colu 30Sep02 2days ssh maf p1 dhcp9578217.colu Wed12AM 12 -zsh (zsh) maf p2 dhcp9578217.colu Wed07AM 3:03 -zsh (zsh) maf p7 login.enss.net 22Mar02 199days - maf p8 login.enss.net 12Apr02 47days - maf p9 login.enss.net 24Jul02 75days - maf pa login.enss.net 25Jul02 47days -

  8. ssh session faith.splintered:/usr/home/maf# tcpdump -q -i sis0 -n ip and host eng4.oar.net tcpdump: listening on sis0 22:27:46.565664 24.95.78.217.1065 > 192.148.244.24.22: tcp 0 (DF) 22:27:46.603058 192.148.244.24.22 > 24.95.78.217.1065: tcp 0 (DF) 22:27:46.603523 24.95.78.217.1065 > 192.148.244.24.22: tcp 0 (DF) 22:27:46.717333 192.148.244.24.22 > 24.95.78.217.1065: tcp 15 (DF) [tos 0x10] 22:27:46.717706 24.95.78.217.1065 > 192.148.244.24.22: tcp 20 (DF) 22:27:46.830214 192.148.244.24.22 > 24.95.78.217.1065: tcp 276 (DF) [tos 0x10] 22:27:46.846743 24.95.78.217.1065 > 192.148.244.24.22: tcp 156 (DF) 22:27:46.967105 192.148.244.24.22 > 24.95.78.217.1065: tcp 12 (DF) [tos 0x10] 22:27:46.967292 24.95.78.217.1065 > 192.148.244.24.22: tcp 20 (DF) 22:27:47.062173 192.148.244.24.22 > 24.95.78.217.1065: tcp 60 (DF) [tos 0x10] 22:27:47.062239 192.148.244.24.22 > 24.95.78.217.1065: tcp 12 (DF) [tos 0x10] 22:27:47.062433 24.95.78.217.1065 > 192.148.244.24.22: tcp 0 (DF) 22:27:47.062636 24.95.78.217.1065 > 192.148.244.24.22: tcp 140 (DF) 22:27:47.196829 192.148.244.24.22 > 24.95.78.217.1065: tcp 140 (DF) [tos 0x10] 22:27:47.204546 24.95.78.217.1065 > 192.148.244.24.22: tcp 28 (DF) 28 packets, 728 byte + IP/TCP overhead.

  9. Unidirectional Flow with Source/Destination IP Key % ssh 10.0.0.2 w reply 10.0.0.1 10.0.0.2 Active Flows Flow Source IP Destination IP • 10.0.0.1 10.0.0.2 • 10.0.0.2 10.0.0.1

  10. Unidirectional Flow with Source/Destination IP Key % telnet 10.0.0.2 % ping 10.0.0.2 login: 10.0.0.1 10.0.0.2 ICMP echo reply Active Flows Flow Source IP Destination IP • 10.0.0.1 10.0.0.2 • 10.0.0.2 10.0.0.1

  11. Unidirectional Flow with IP, Port,Protocol Key % telnet 10.0.0.2 % ping 10.0.0.2 login: 10.0.0.1 10.0.0.2 ICMP echo reply Active Flows Flow Source IP Destination IP prot srcPort dstPort • 10.0.0.1 10.0.0.2 TCP 32000 23 • 10.0.0.2 10.0.0.1 TCP 23 32000 • 10.0.0.1 10.0.0.2 ICMP 0 0 • 10.0.0.2 10.0.0.1 ICMP 0 0

  12. Bidirectional Flow with IP, Port,Protocol Key % telnet 10.0.0.2 % ping 10.0.0.2 login: 10.0.0.1 10.0.0.2 ICMP echo reply Active Flows Flow Source IP Destination IP prot srcPort dstPort • 10.0.0.1 10.0.0.2 TCP 32000 23 • 10.0.0.1 10.0.0.2 ICMP 0 0

  13. Application Flow Web server on Port 9090 % netscape http://10.0.0.2/9090 10.0.0.1 10.0.0.2 Content-type: Active Flows Flow Source IP Destination IP Application • 10.0.0.1 10.0.0.2 HTTP

  14. Aggregated Flow Main Active flow table Flow Source IP Destination IP prot srcPort dstPort • 10.0.0.1 10.0.0.2 TCP 32000 23 • 10.0.0.2 10.0.0.1 TCP 23 32000 • 10.0.0.1 10.0.0.2 ICMP 0 0 • 10.0.0.2 10.0.0.1 ICMP 0 0 Source/Destination IP Aggregate Flow Source IP Destination IP • 10.0.0.1 10.0.0.2 • 10.0.0.2 10.0.0.1

  15. NetFlow data reduction Look at 1 day of flows exports from krc4: Flows 111182160 Octets 2450050798277 Packets 4057574675 Flow size 48 bytes Flows/packet 30 (typical) Packet overhead 24 bytes Octets in a flow 1464 bytes

  16. NetFlow data reduction Look at 1 day of flows exports from krc4: Packets/Flow 37 Octets/Flow 22036 Octets/Packet 603 Packets/Flow export 1095 Octets/Flow export 661092 Octets/Octets in a flow export 452

  17. Packets/Flow distribution

  18. Octets/Flow distribution

  19. Flow Descriptors • A Key with more elements will generate more flows. • Greater number of flows leads to more post processing time to generate reports, more memory and CPU requirements for device generating flows. • Depends on application. Traffic engineering vs. intrusion detection.

  20. Flow Accounting • Accounting information accumulated with flows. • Packets, Bytes, Start Time, End Time. • Network routing information – masks and autonomous system number.

  21. Flow Collection • Passive monitor. • Router. • Other existing network device.

  22. Campus Passive Monitor Collection Workstation A Workstation B Flow probe connected to switch port in “ traffic mirror” mode

  23. LAN LAN LAN LAN Internet Router Collection Flow collector stores exported flows from router.

  24. Passive Monitor • Directly connected to a LAN segment via a switch/router port in “mirror” mode, optical splitter, or repeated segment. • Generate flows for all local LAN traffic. • Must have an interface or monitor deployed on each LAN segment. • Support for more detailed flows – bidirectional and application (external probe has more resources).

  25. Router Collection • Router will generate flows for traffic that traverses the router. • Flows are not generated for local LAN traffic (not a sniffer). • Limited to “simple” flow criteria (packet headers). • Generally easier to deploy – no new equipment.

  26. Cisco NetFlow • Unidirectional flows. • IPv4 unicast and multicast. • Aggregated (v8) and unaggregated (v1,5,6,7). • Flows exported via UDP. • Supported on IOS and CatIOS platforms. • Catalyst NetFlow is different implementation.

  27. Cisco NetFlow Versions • 4 Unaggregated types (1,5,6,7). • 14 Aggregated types (8.x). • Each version has its own packet format. • Version 1 does not have sequence numbers – no way to detect lost flows. • The “version” defines what type of data is in the flow. • Some versions specific to Catalyst platform.

  28. Cisco NetFlow Versions • v9 in development. More flexible packet format so new fields can be added without creating yet another version while still maintaining compact encoding.

  29. NetFlow v1 • Key fields: Source/Destination IP, Source/Destination Port, IP Protocol, ToS, Input interface. • Accounting: Packets, Octets, Start/End time, Output interface. • Other: Bitwise OR of TCP flags. • Historical – don’t use. No sequence #’s.

  30. NetFlow v5 • Key fields: Source/Destination IP, Source/Destination Port, IP Protocol, ToS, Input interface. • Accounting: Packets, Octets, Start/End time, Output interface. • Other: Bitwise OR of TCP flags, Source/Destination AS and IP Mask. • Packet format adds sequence numbers for detecting lost exports.

  31. NetFlow v8 • Aggregated v5 flows. • 3 Catalyst 65xx specific that correspond to the configurable flow mask. • Much less data to post process, but lose fine granularity of v5 – no IP addresses.

  32. NetFlow v8 • AS • Protocol/Port • Source Prefix • Destination Prefix • Prefix • Destination (Catalyst 65xx) • Source/Destination (Catalyst 65xx) • Full Flow (Catalyst 65xx)

  33. NetFlow v8 • ToS/AS • ToS/Protocol/Port • ToS/Source Prefix • ToS/Destination Prefix • Tos/Source/Destination Prefix • ToS/Prefix/Port

  34. NetFlow Packet Format • Common header among export versions. • All but v1 have a sequence number. • Version specific data field where N records of data type are exported. • N is determined by the size of the flow definition. Packet size is kept under ~1480 bytes. No fragmentation on Ethernet. No PMTU detection.

  35. NetFlow v5 Packet Example IP/UDP packet NetFlow v5 header v5 record … … v5 record

  36. NetFlow v5 Packet (Header) struct ftpdu_v5 { /* 24 byte header */ u_int16 version; /* 5 */ u_int16 count; /* The number of records in the PDU */ u_int32 sysUpTime; /* Current time in millisecs since router booted */ u_int32 unix_secs; /* Current seconds since 0000 UTC 1970 */ u_int32 unix_nsecs; /* Residual nanoseconds since 0000 UTC 1970 */ u_int32 flow_sequence;/* Seq counter of total flows seen */ u_int8 engine_type; /* Type of flow switching engine (RP,VIP,etc.) */ u_int8 engine_id; /* Slot number of the flow switching engine */ u_int16 reserved;

  37. NetFlow v5 Packet (Records) /* 48 byte payload */ struct ftrec_v5 { u_int32 srcaddr; /* Source IP Address */ u_int32 dstaddr; /* Destination IP Address */ u_int32 nexthop; /* Next hop router's IP Address */ u_int16 input; /* Input interface index */ u_int16 output; /* Output interface index */ u_int32 dPkts; /* Packets sent in Duration */ u_int32 dOctets; /* Octets sent in Duration. */ u_int32 First; /* SysUptime at start of flow */ u_int32 Last; /* and of last packet of flow */ u_int16 srcport; /* TCP/UDP source port number or equivalent */ u_int16 dstport; /* TCP/UDP destination port number or equiv */ u_int8 pad; u_int8 tcp_flags; /* Cumulative OR of tcp flags */ u_int8 prot; /* IP protocol, e.g., 6=TCP, 17=UDP, ... */ u_int8 tos; /* IP Type-of-Service */ u_int16 src_as; /* originating AS of source address */ u_int16 dst_as; /* originating AS of destination address */ u_int8 src_mask; /* source address prefix mask bits */ u_int8 dst_mask; /* destination address prefix mask bits */ u_int16 drops; } records[FT_PDU_V5_MAXFLOWS]; };

  38. NetFlow v8 Packet Example(AS Aggregation) IP/UDP packet NetFlow v8 header v8 record … … v8 record

  39. NetFlow v8 AS agg. Packet struct ftpdu_v8_1 { /* 28 byte header */ u_int16 version; /* 8 */ u_int16 count; /* The number of records in the PDU */ u_int32 sysUpTime; /* Current time in millisecs since router booted */ u_int32 unix_secs; /* Current seconds since 0000 UTC 1970 */ u_int32 unix_nsecs; /* Residual nanoseconds since 0000 UTC 1970 */ u_int32 flow_sequence; /* Seq counter of total flows seen */ u_int8 engine_type; /* Type of flow switching engine (RP,VIP,etc.) */ u_int8 engine_id; /* Slot number of the flow switching engine */ u_int8 aggregation; /* Aggregation method being used */ u_int8 agg_version; /* Version of the aggregation export */ u_int32 reserved; /* 28 byte payload */ struct ftrec_v8_1 { u_int32 dFlows; /* Number of flows */ u_int32 dPkts; /* Packets sent in duration */ u_int32 dOctets; /* Octets sent in duration */ u_int32 First; /* SysUpTime at start of flow */ u_int32 Last; /* and of last packet of flow */ u_int16 src_as; /* originating AS of source address */ u_int16 dst_as; /* originating AS of destination address */ u_int16 input; /* input interface index */ u_int16 output; /* output interface index */ } records[FT_PDU_V8_1_MAXFLOWS]; };

  40. Cisco IOS Configuration • Configured on each input interface. • Define the version. • Define the IP address of the collector (where to send the flows). • Optionally enable aggregation tables. • Optionally configure flow timeout and main (v5) flow table size. • Optionally configure sample rate.

  41. Cisco IOS Configuration interface FastEthernet0/0/0 ip address 10.0.0.1 255.255.255.0 no ip directed-broadcast ip route-cache flow interface ATM1/0/0 no ip address no ip directed-broadcast ip route-cache flow interface Loopback0 ip address 10.10.10.10 255.255.255.255 no ip directed-broadcast ip flow-export version 5 origin-as ip flow-export destination 10.0.0.10 5004 ip flow-export source loopback 0 ip flow-aggregation cache prefix export destination 10.0.0.10 5555 enabled

  42. Cisco IOS Configuration krc4#sh ip flow export Flow export is enabled Exporting flows to 10.0.0.10 (5004) Exporting using source IP address 10.10.10.10 Version 5 flow records, origin-as Cache for prefix aggregation: Exporting flows to 10.0.0.10 (5555) Exporting using source IP address 10.10.10.10 3176848179 flows exported in 105898459 udp datagrams 0 flows failed due to lack of export packet 45 export packets were sent up to process level 0 export packets were punted to the RP 5 export packets were dropped due to no fib 31 export packets were dropped due to adjacency issues 0 export packets were dropped due to fragmentation failures 0 export packets were dropped due to encapsulation fixup failures 0 export packets were dropped enqueuing for the RP 0 export packets were dropped due to IPC rate limiting 0 export packets were dropped due to output drops

  43. Cisco IOS Configuration krc4#sho ip ca fl IP packet size distribution (106519M total packets): 1-32 64 96 128 160 192 224 256 288 320 352 384 416 448 480 .002 .405 .076 .017 .011 .010 .007 .005 .004 .005 .004 .004 .003 .002 .002 512 544 576 1024 1536 2048 2560 3072 3584 4096 4608 .002 .006 .024 .032 .368 .000 .000 .000 .000 .000 .000 IP Flow Switching Cache, 4456704 bytes 36418 active, 29118 inactive, 3141073565 added 3132256745 ager polls, 0 flow alloc failures Active flows timeout in 30 minutes Inactive flows timeout in 15 seconds last clearing of statistics never Protocol Total Flows Packets Bytes Packets Active(Sec) Idle(Sec) -------- Flows /Sec /Flow /Pkt /Sec /Flow /Flow TCP-Telnet 2951815 0.6 61 216 42.2 26.6 21.4 TCP-FTP 24128311 5.6 71 748 402.3 15.0 26.3 TCP-FTPD 2865416 0.6 916 843 611.6 34.7 19.8 TCP-WWW 467748914 108.9 15 566 1675.8 4.9 21.6 TCP-SMTP 46697428 10.8 14 370 159.6 4.0 20.1 TCP-X 521071 0.1 203 608 24.7 24.5 24.2 TCP-BGP 2835505 0.6 5 94 3.3 16.2 20.7

  44. Cisco IOS Configuration krc4#sho ip ca fl TCP-other 1620253066 377.2 47 631 18001.6 27.3 23.4 UDP-DNS 125622144 29.2 2 78 82.5 4.6 24.7 UDP-NTP 67332976 15.6 1 76 22.0 2.7 23.4 UDP-TFTP 37173 0.0 2 76 0.0 4.1 24.6 UDP-Frag 68421 0.0 474 900 7.5 111.7 21.6 UDP-other 493337764 114.8 17 479 1990.3 3.8 20.2 ICMP 243659509 56.7 3 166 179.7 3.3 23.3 IGMP 18601 0.0 96 35 0.4 941.4 8.1 IPINIP 12246 0.0 69 52 0.1 548.4 15.2 GRE 125763 0.0 235 156 6.9 50.3 21.1 IP-other 75976755 17.6 2 78 45.4 3.9 22.8 Total: 3176854246 739.6 33 619 24797.4 16.2 22.6 SrcIf SrcIPaddress DstIf DstIPaddress Pr SrcP DstP Pkts AT5/0/0.4 206.21.162.150 AT1/0/0.1 141.219.73.45 06 0E4B A029 507 AT4/0/0.10 132.235.174.9 AT1/0/0.1 137.99.166.126 06 04BE 074C 3 AT4/0/0.12 131.123.59.33 AT1/0/0.1 137.229.58.168 06 04BE 09BB 646 AT1/0/0.1 137.99.166.126 AT4/0/0.10 132.235.174.9 06 074C 04BE 3

  45. Cisco CatIOS Configuration set mls flow full set mls nde version 7 set mls nde 10.0.0.10 9110 set mls agingtime 32

  46. Cisco CatIOS Configuration swlap1> sh mls Total packets switched = 5116997156 Total bytes switched = 2289120109999 Total routes = 2283 IP statistics flows aging time = 32 seconds IP statistics flows fast aging time = 0 seconds, packet threshold = 0 IP Current flow mask is Full flow Netflow Data Export version: 8 Netflow Data Export disabled Netflow Data Export configured for port 9110 on host 10.0.0.10 Total packets exported = 6545 IPX statistics flows aging time = 256 seconds IPX flow mask is Destination flow IPX max hop is 255 Module 15: Physical MAC-Address 00-04-9b-78-bb-fc

  47. Cisco CatIOS Configuration swlap1> sh mls stat entry Last Used Destination IP Source IP Prot DstPrt SrcPrt Stat-Pkts Stat-Bytes ---------------- --------------- ----- ------ ------ ---------- --------- 64.219.177.137 206.21.217.6 TCP 2206 WWW 4 1113 207.254.193.44 198.30.37.194 TCP 56403 WWW 9 10567 198.30.37.19 66.183.100.164 TCP WWW 1604 4 731 192.88.193.144 199.218.4.130 UDP DNS 61449 1 71 192.88.193.144 199.218.5.131 TCP DNS 2157 5 235 199.218.4.3 208.249.92.145 TCP WWW 37519 6 506 12.42.50.51 198.30.37.19 TCP 11200 WWW 5 494 199.218.5.130 142.22.16.54 TCP WWW 54658 6 745 207.254.193.44 198.30.37.194 TCP 56391 WWW 40 50762 206.21.0.139 24.178.12.64 TCP 110 1085 8 484 217.10.162.50 199.218.5.130 TCP 46983 WWW 53 73775 65.224.146.242 198.30.37.19 TCP 2282 WWW 4 390 199.218.4.135 65.31.16.245 TCP WWW 1196 6 650 24.150.19.19 205.133.123.10 TCP 58043 WWW 4 176

  48. Cisco Catalyst Native IOS Configuration mls flow ip destination-source mls nde flow include mls nde src_address 10.0.0.9 version 7 ip flow-export source Loopback0 ip flow-export version 5 peer-as ip flow-export destination 10.0.0.5 5555

  49. Cisco Issues • Cat 65K Sup2/MSFC2 NetFlow implementation does not fill in important fields like input/output interface. Resolved? Bug Id : CSCdt21216 Headline Netflow records source / dst interface index missing Product cat6000 Model x6k-sup2 Component earl Duplicate of Severity 3 Status C Version Found 6.1(1) Fixed-in Version 6.2(1) 6.1(3) 6.3(1)PAN Release Notes On Sup2, the destination and source Interface indices would be reported as zero in netflow exports. This is a hardware limitation.

  50. Juniper Configration • Sample packets with firewall filter and forward to routing engine. • Sampling rate is limited to 7000pps (addressed with future PIC). • Fine for traffic engineering, but restrictive for DoS and intrusion detection. • Juniper calls NetFlow cflowd.

More Related