Vyatta Suite200 1301ShorewayRoad Belmont,CA94002 vyatta.com 6504137200 1888VYATTA1(USandCanada) VYATTA,INC. | VyattaSystem ConnectionManagement REFERENCEGUIDE ConnectionTracking FlowAccounting COPYRIGHT Copyright©2005–2012Vyatta,Inc.Allrightsreserved. Vyattareservestherighttomakechangestosoftware,hardware,anddocumentationwithoutnotice.Forthemostrecentversionof documentation,visittheVyattawebsiteatvyatta.com. PROPRIETARYNOTICES VyattaisaregisteredtrademarkofVyatta,Inc. Hyper‐VisaregisteredtrademarkofMicrosoftCorporation. VMware,VMwareESX,andVMwareserveraretrademarksofVMware,Inc. XenServer,andXenCenteraretrademarksofCitrixSystems,Inc. Allothertrademarksarethepropertyoftheirrespectiveowners. RELEASEDATE:October2012 DOCUMENTREVISION.6.5R1 v01 RELEASEDWITH:6.5.0R1 PARTNO.A0‐0245‐10‐0004 iii ConnectionManagement 6.5R1v01 Vyatta Contents QuickListofCommands......................................................... v ListofExamples ............................................................... vii Preface. ....................................................................viii IntendedAudience ............... ................................................................ix OrganizationofThisGuide ................. .................................... ................. .. .ix DocumentConventions .......................................... .................................ix VyattaPublicati ons............... ............... ................... ...............................x Chapter1ConnectionTracking................................................... 1 ConnectionTrackingOverview............................. .........................................2 Logging............................ ................................. .................... ....2 ConnectionTrackingTableComponents ........................................ ............... ...3 TheConnectionTrackingTable ..................... ........ .................................3 TheConnectionTrackingHashTable............ ............... ................... ...........3 TheConnectionTrackingExpectTable. ............... ........................................3 TheConnectionTrackingExpectHashTable................................... ..... ...........4 TuningConnectionTracking... ................... .............. ................................4 SettingTime‐OutsforConnections .. ........... ................................. ................5 Connection TrackingCommands.............................. ......................................6 deleteconntracktable............................ ............... ................... ...........8 resetconntrack ... ............... ................... ................. .......................11 showconntracktable ........................ ................................. ...............12 systemconntrack expect‐table‐size<size>....................................... ................15 systemconntrackhash‐size<size> ................................. .... ............... ..........17 systemconntracklogicmp..................... ............... ................... .............19 systemconntracklog other....................................... .. ................. ..........21 systemconntracklogtcp.............................. ................................. .......23 systemconntracklogudp ....... ................................. .............................26 systemconntrackmodulesftp.. ................................ ............... ................28 systemconntrackmodulesgre................ ............... ................... ...............29 system conntrackmodulesh323.......................... .....................................31 systemconntrackmodulesnfs ................................ ................................. 33 systemconntrackmodulespptp ....... ...... ..................................................35 systemconntrackmodulessip...... ................... ................... .. ...................37 systemconntrackmodulessqlnet ................... ........ ...................................39 iv ConnectionManagement 6.5R1v01 Vyatta systemconntrackmodulestftp ................................................................41 systemconntracktable‐size<size> ........... ................. ................................. 43 systemconntracktcploose<state>............. ................................. ...............45 systemconntrack timeoutcustom ........... ................... ................................47 systemconntracktimeouticmp .................................. ............... ...............51 systemconntracktimeoutother ................ ............... ................... .............53 systemconntracktimeout tcp .................................... .............................55 systemconntracktimeoutudp............ .................... ................................. 57 Chapter2FlowAccounting ..................................................... 59 FlowAccountingConfiguration .................... ................... .............................60 FlowAccountingOverview........................... ................................. ........60 ConfiguringanInterfaceforFlowAccounting.... ................................. ................60 Displaying FlowAccountingInformation .........................................................61 ExportingFlowAccountinginformation ......................... ............ ............... .....62 FlowAccountingCommands .............. ............. ...........................................63 clearflow‐accountingcounters ... ................................ .. ................. ..........65 restartflow‐accounting ...................................... ................................. 66 showflow‐accounting.............. ..........................................................67 showflow‐accountinginterface<interface>...................................... ................68 systemflow‐accountinginterface<interface> ............................. ............... ........69 systemflow‐accountingnetflowengine‐id<id> ..................... ............... ...............71 systemflow‐accountingnetflowsampling‐rate<rate> ............. ................................72 systemflow‐accountingnetflowserver<ipv4>............. ............... ................... .....74 systemflow‐accountingnetflowtimeoutexpiry‐interval<interval> ... ............... ................76 systemflow‐accountingnetflowtimeoutflow‐generic<timeout> ............ ........................78 systemflow‐accountingnetflowtimeouticmp<timeout> .. ................. ............... ........80 systemflow‐accountingnetflowtimeoutmax‐active‐life<life> ......... .......... ...................82 systemflow‐accountingnetflowtimeouttcp‐fin<timeout> .................... .... ............... ..84 systemflow‐accountingnetflowtimeouttcp‐generic<timeout> .................. ........ ...........86 systemflow‐accountingnetflowtimeouttcp‐rst<timeout> ................................ .........88 systemflow‐accountingnetflowtimeoutudp<timeout>.................................. .........90 systemflow‐accountingnetflowversion<version>. .................................. .............92 systemflow‐accountingsflowagent‐address<addr> ......................... ..... ................94 systemflow‐accountingsflowsampling‐rate<rate> ........................... ............... .....96 systemflow‐accountingsflowserver<ipv4>......................... .............................98 systemflow‐accountingsyslog‐facility<facility> ............... ..................................100 GlossaryofAcronyms......................................................... 102 v ConnectionManagement 6.5R1v01 Vyatta QuickListofCommands Use this list to help you quickly locate commands. clearflow‐accountingcounters............................. .................... ................ ...65 deleteconntracktable .......................... ................................. .................8 resetconntrack.......................... .. .................... ............... ..................11 restartflow‐accounting.... ........... ............... ................... ..........................66 showconntracktable...................................... ......................................12 showflow‐accountinginterface<interface> ....... ..................................................68 showflow‐accounting............. ................................... ............... .............67 systemconntrackexpect‐table‐size<size> ................. ............... ................... ........15 systemconntrackhash‐size<size> ... ............... ...............................................17 systemconntracklogicmp ................. .. ................. ................................. ...19 systemconntracklogother .......... .............................................................21 systemconntracklogtcp ................................... ............... .......................23 systemconntracklogudp......... ................................................................26 systemconntrackmodulesftp .................................. ...................................28 systemconntrackmodulesgre ........... ................................. ........................29 systemconntrackmodulesh323 ...................... .................. ...........................31 systemconntrackmodulesnfs.................... ............... ................... ...............33 system conntrackmodulespptp ...... ................... ..........................................35 systemconntrackmodulessip ............................ ................................. ........37 systemconntrackmodulessqlnet..... .............................................................39 systemconntrackmodulestftp.......................... .. ....... ............... ..................41 systemconntracktable‐size<size>............ ................................ .. ................. ..43 systemconntracktcploose<state>.......................... .................. .....................45 systemconntracktimeoutcustom ......................... ................................. .......47 systemconntracktimeouticmp....... .............................................................51 systemconntracktimeoutother......... .......................... ................................53 systemconntracktimeouttcp.............. ............... ................... .....................55 systemconntracktimeoutudp ................................. ......... ..........................57 systemflow‐accountinginterface<interface>................... .....................................69 systemflow‐accountingnetflowengine‐id<id>....... ................................. ...............71 systemflow ‐accountingnetflowsampling‐rate<rate>................. ................................72 systemflow‐accountingnetflowserver<ipv4> ........................................ ............... 74 vi ConnectionManagement 6.5R1v01 Vyatta systemflow‐accountingnetflowtimeoutexpiry‐interval<interval>.................................... ..76 systemflow‐accountingnetflow timeoutflow‐generic<timeout>........ ................................78 systemflow‐accountingnetflowtimeouticmp<timeout> ............... ...............................80 systemflow‐accountingnetflow timeoutmax‐active‐life<life> ............................. .............82 systemflow‐accountingnetflow timeouttcp‐fin<timeout>........................... ..................84 systemflow‐ accountingnetflowtimeouttcp‐generic<timeout>.......................... ...............86 systemflow‐accountingnetflow timeouttcp‐rst<timeout>.................................. ...........88 systemflow‐ accountingnetflowtimeoutudp<timeout> ...............................................90 systemflow‐accountingnetflowversion<version> ............................................. .......92 systemflow‐accountingsflowagent‐address<addr> .................................... ..............94 systemflow‐accountingsflowsampling‐rate<rate>............................. ......................96 systemflow‐accountingsflowserver<ipv4> .................. .... ................................. ..98 systemflow‐accountingsyslog‐facility<facility> ... ...... ............................................100 vii ConnectionManagement 6.5R1v01 Vyatta ListofExamples Use this list to help you locate examples you’d like to look at or try. Example1‐1“deleteconntracktableipv4”sampleoutput....... .. ....................................10 Example1‐2“showconntracktableipv4”sampleoutput... ................... ................... .....13 Example1‐4SampleconntracklogmessagesfortheICMPprotocol....................... ............. .20 Example1‐5Sampleconntracklogmessagesforotherprotocols.................... ................... .22 Example 1‐6SampleconntracklogmessagesfortheICMPprotocol.... ................... ..............25 Example1‐7Sampleconntracklog messagesfortheICMPprotocol.....................................27 viii ConnectionManagement 6.5R1v01 Vyatta Preface This document describes the various deployment, installation, and upgrade options for Vyatta software. This preface provides information about using this guide. The following topics are presented: • Intended Audience • Organization of This Guide • Document Conventions • Vyatta Publications IntendedAudience ix ConnectionManagement 6.5R1v01 Vyatta IntendedAudience This guide is intended for experienced system and network administrators. Depending on the functionality to be used, readers should have specific knowledge in the following areas: • Networking and data communications • TCP/IP protocols • General router configuration • Routing protocols • Network administration • Network security • IP services OrganizationofThisGuide This guide has the following aid to help you find the information you are looking for: • Quick List of Commands Use this list to help you quickly locate commands. • List of Examples Use this list to help you locate examples you’d like to try or look at. This guide has the following chapters: DocumentConventions This guide uses the following advisory paragraphs, as follows. Chapter Description Page Chapter 1:ConnectionTracking Thischapterexplainsconnectiontrackingin theVyattasystem. 1 Chapter 2:FlowAccounting Thischapterexplainshowtoconfigureflow accountingusingtheVyattasystem. 59 GlossaryofAcronyms 102 VyattaPublications x ConnectionManagement 6.5R1v01 Vyatta NOTENotesprovideinformationyoumightneedtoavoidproblemsorconfigurationerrors. This document uses the following typographic conventions. VyattaPublications Full product documentation is provided in the Vyatta technical library. To see what documentation is available for your release, see the Guide to Vyatta Documentation. This guide is posted with every release of Vyatta software and provides a great starting point for finding the information you need. Additional information is available on www.vyatta.com and www.vyatta.org. WARNINGWarningsalertyoutosituationsthatmayposeathreattopersonalsafety. CAUTIONCautionsalertyoutosituationsthatmightcauseharmtoyoursystemordamageto equipment,orthatmayaffectservice. Monospace Examples, command-line output, and representations of configuration nodes. boldMonospace Your input: something you type at a command line. bold Commands, keywords, and file names, when mentioned inline. Objects in the user interface, such as tabs, buttons, screens, and panes. italics An argument or variable where you supply a value. <key> A key on your keyboard, such as <Enter>. Combinations of keys are joined by plus signs (“+”), as in <Ctrl>+c. [ key1 | key2] Enumerated options for completing a syntax. An example is [enable | disable]. num1–numN A inclusive range of numbers. An example is 1–65535, which means 1 through 65535, inclusive. arg1 argN A range of enumerated values. An example is eth0 eth3, which means eth0, eth1, eth2, or eth3. arg[ arg ] arg[,arg ] A value that can optionally represent a list of elements (a space-separated list and a comma-separated list, respectively). [...]... Example 1‐3 “show conntrack table ipv6” sample output vyatta@ vyatta:~$ show conntrack table ipv6 source 0:0:0:0:0:0:0:0 destination [0:0:0:0:0:0:0:0]:22 CONN ID Source Destination Protocol 381 862 6200 [10FB:0:0:0:C:ABC:1F0C:44DA]:1140 [10FB:0:0:0:C:ABC:1F0C:45AD]:22 tcp [6] 381 867 2537 [10FB:0:0:0:C:ABC:1F0C:55CB]:2020 [2001:cdba:0:0:0:0:3257: 965 2]:22 tcp [6] Connection Management 6. 5R1 v01 Vyatta Chapter 1: Connection Tracking ... Dec 21 22:25:31 vyatta log‐conntrack: [NEW] gre 47 30 src=192. 169 .100.75 dst=192. 168 .100.75 srckey=0x0 dstkey=0x0 [UNREPLIED] src=192. 168 .100.75 dst=192. 169 .100.75 srckey=0x0 dstkey=0x0 id=3998350488 Dec 21 22:38: 06 vyatta log‐conntrack: [UPDATE] gre 47 179 src=192. 169 .100.1 dst=192. 168 .100.1 srckey=0x0 dstkey=0x0 src=192. 168 .100.1 dst=192. 169 .100.1 srckey=0x0 dstkey=0x0 [ASSURED] id=39985783 76 Dec 21 22:39:50 vyatta log‐conntrack: [DESTROY] gre 47 src=192. 169 .100.17 ... Example 1‐2 “show conntrack table ipv4” sample output vyatta@ vyatta:~$ show conntrack table ipv4 source 0.0.0.0 destination 0.0.0.0:22 TCP state codes: SS ‐ SYN SENT, SR ‐ SYN RECEIVED, ES ‐ ESTABLISHED, FW ‐ FIN WAIT, CW‐ CLOSE WAIT, LA ‐ LAST ACK, TW ‐ TIME WAIT, CLOSE ‐ CL, LISTEN ‐ LI CONN ID Source 381 862 6200 192. 168 .74.1:1140 381 862 5704 192. 168 .74.1:1145 Connection Management 6. 5R1 v01 Destination 192. 168 .74.128:22... Connection Management Vyatta Publications xi 6. 5R1 v01 Vyatta 1 Chapter 1: Connection Tracking This chapter explains connection tracking in the Vyatta system This chapter presents the following topics: • Connection Tracking Overview • Connection Tracking Commands Connection Management 6. 5R1 v01 Vyatta Chapter 1: Connection Tracking Connection Tracking Overview... Example 1‐1 “delete conntrack table ipv4” sample output vyatta@ vyatta:~$ delete conntrack table ipv4 source 192. 168 .1.21 Deleting the following conntrack table entries: CONN ID Source Destination Protocol 3427 168 752 192. 168 .1.21:52250 192. 168 .1.81:22 tcp [6] Connection Management 6. 5R1 v01 Vyatta Chapter 1: Connection Tracking Connection Tracking Commands 11 reset conntrack Completely... two tables closer than 1:1 (for example, if the connection tracking table is set to 65 ,5 36 then the maximum hash table size should not be greater than 65 ,5 36 as well) Connection Management 6. 5R1 v01 Vyatta Chapter 1: Connection Tracking • Connection Tracking Overview 5 The maximum advisable table size is 2^20 (10485 76) entries The memory is allocated from the kernel memory space, which will not exceed... src=192. 168 .100.1 dst=192. 169 .100.1 srckey=0x0 dstkey=0x0 [ASSURED] id=39985783 76 Dec 21 22:39:50 vyatta log‐conntrack: [DESTROY] gre 47 src=192. 169 .100.17 dst=192. 168 .100.17 srckey=0x0 dstkey=0x0 src=192. 168 .100.17 dst=192. 169 .100.17 srckey=0x0 dstkey=0x0 [ASSURED] id=4080054272 Connection Management 6. 5R1 v01 Vyatta Chapter 1: Connection Tracking Connection Tracking Commands 23 system conntrack log tcp ... Oct 20 17:49:04 Test5 log‐conntrack: [UPDATE] tcp 6 120 TIME_WAIT src=192. 168 .249.10 dst=74.125.224.151 sport=39082 dport=80 src=74.125.224.151 dst=10.3.0.183 sport=80 dport=39082 [ASSURED] id=397384 263 2 Oct 20 17:51:04 Test5 log‐conntrack: [DESTROY] tcp 6 src=192. 168 .249.10 dst=74.125.224.151 sport=39082 dport=80 src=74.125.224.151 dst=10.3.0.183 sport=80 dport=39082 [ASSURED] id=397384 263 2 Connection Management 6. 5R1 v01 Vyatta ... Connection Management 6. 5R1 v01 Vyatta Chapter 1: Connection Tracking Connection Tracking Commands 8 delete conntrack table Deletes connection tracking table entries Syntax delete conntrack table {ipv4 | ipv6} [source src-addr [destination dst-addr]] [quiet] Command Mode Operational mode Parameters ipv4 Delete IPv4 conntrack table entries Either ipv4 or ipv6 must be specified ipv6 Delete IPv6 conntrack table... 192. 168 .74.1:1145 Connection Management 6. 5R1 v01 Destination 192. 168 .74.128:22 192. 168 .74.200:22 Protocol tcp [6] ES tcp [6] ES TIMEOUT 429809 431878 Vyatta Chapter 1: Connection Tracking Connection Tracking Commands 14 381 862 42 16 10.3.0.182:1151 10.3.0.15:22 tcp [6] TW 90 Example 1-3 shows the output of the show conntrack table ipv6 command In this case the command displays all connections where the destination . VyattaSystem ConnectionManagement REFERENCEGUIDE ConnectionTracking FlowAccounting COPYRIGHT Copyright©2005–2012Vyatta,Inc.Allrightsreserved. Vyattareservestherighttomakechangestosoftware,hardware,anddocumentationwithoutnotice.Forthemostrecentversionof documentation,visittheVyattawebsiteatvyatta.com. PROPRIETARYNOTICES VyattaisaregisteredtrademarkofVyatta,Inc. Hyper‐VisaregisteredtrademarkofMicrosoftCorporation. VMware,VMwareESX,andVMwareserveraretrademarksofVMware,Inc. XenServer,andXenCenteraretrademarksofCitrixSystems,Inc. Allothertrademarksarethepropertyoftheirrespectiveowners. RELEASEDATE:October2012 DOCUMENTREVISION. 6. 5R1 v01 RELEASEDWITH: 6. 5.0R1 PARTNO.A0‐0245‐10‐0004 iii ConnectionManagement 6. 5R1 v01 Vyatta Contents QuickListofCommands........................................................ set to 65 ,5 36 then the maximum hash table size should not be greater than 65 ,5 36 as well). Chapter1:ConnectionTracking ConnectionTrackingOverview 5 ConnectionManagement 6. 5R1 v01 Vyatta •. comma-separated list, respectively). VyattaPublications xi ConnectionManagement 6. 5R1 v01 Vyatta 1 ConnectionManagement 6. 5R1 v01 Vyatta Chapter1:ConnectionTracking This chapter explains connection