{"id":54,"date":"2007-08-01T00:00:00","date_gmt":"2007-08-01T00:00:00","guid":{"rendered":"http:\/\/netexpertise\/en\/?p=54"},"modified":"2021-10-17T08:55:31","modified_gmt":"2021-10-17T06:55:31","slug":"gigawords-support","status":"publish","type":"post","link":"http:\/\/www.netexpertise.eu\/en\/networking\/freeradius\/gigawords-support.html","title":{"rendered":"Gigawords Support in Freeradius"},"content":{"rendered":"\n<p>Some people using Radius for accounting don&#8217;t know there are counters limits. Values defined in the protocol are stored in 32 bit fields meaning you will never go any higher than 4294967296 bits, that is fairly more than 4GB. If a session stays up for days, there are good chances that the counter resets to 0 and some traffic will go missing. Yet, some extensions have been added to the protocol to support bigger amount of traffic. Since Freeradius 1.1.7, Gigawords with a Mysql backend are supported by default. It is highly recommended to upgrade to the last version. While upgrading, do not forget to update your database schema as in <a href=\"\/common\/mysql.sql\">mysql.sql<\/a> changing AcctInputOctets and AcctOutputOctets from 32 to 64 bits. This article deals with those having Freeradius prior to 1.1.7.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><br>Before You Start<\/h3>\n\n\n\n<p>We assume you have a working Freeradius setup with <a href=\"\/en\/category\/database\/mysql\">Mysql<\/a> to store your data. We also assume that your Network Access Server (NAS) supports gigawords as defined in <a href=\"https:\/\/datatracker.ietf.org\/doc\/html\/rfc2869\" target=\"_blank\" rel=\"noreferrer noopener\">RFC2869<\/a>. It is usually the case for Cisco routers but check the manual of your NAS to know how to activate it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><br>Enabling Gigawords on NAS<\/h3>\n\n\n\n<p>Again, this section relates to <a href=\"\/en\/category\/networking\/cisco\">Cisco<\/a> but a similar set of commands is usually available on most devices. Gigawords option is enable by default on Cisco gear hence it doesn&#8217;t appear in the configuration. If it does, simply run this command to activate it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">   aaa accounting gigawords<\/code><\/pre>\n\n\n\n<p><br>You will be asked to reload the router to apply the new settings. This will activate Acct-Input-Gigawords and Acct-Output-Gigawords attributes which tell how many times the counters reset. Knowing this, we can then calculate the real values. Next step is to create extra column in the database.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><br>Mysql Table Modification<\/h3>\n\n\n\n<p>AcctInputOctet and AcctOutputOctet fields need to be changed from 32 to 64 bits. You can make the change with any Mysql client or <a href=\"http:\/\/www.phpmyadmin.net\" target=\"_blank\" rel=\"noreferrer noopener\">PhpMyAdmin<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">   ALTER TABLE radacct CHANGE AcctInputOctets AcctInputOctets BIGINT(20) UNSIGNED;\n   ALTER TABLE radacct CHQNGE AcctOutputOctets AcctOutputOctets BIGINT(20) UNSIGNED;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><br>Freeradius Update<\/h3>\n\n\n\n<p>The SQL code in <i>sql.conf<\/i> needs to be change for stop and update queries to log the new values into the database. Here&#8217;s what they look like after modification:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">   accounting_update_query = \"\n     UPDATE ${acct_table1}\n     SET AcctInputOctets = '%{Acct-Input-Gigawords:-0}' &lt;&lt; 32 | '%{Acct-Input-Octets:-0}',\n       AcctOutputOctets = '%{Acct-Output-Gigawords:-0}' &lt;&lt; 32 | '%{Acct-Output-Octets:-0}',\n       FramedIPAddress = '%{Framed-IP-Address}'\n     WHERE AcctSessionId = '%{Acct-Session-Id}'\n       AND UserName = '%{SQL-User-Name}'\n       AND NASIPAddress= '%{NAS-IP-Address}'\n       AND NASIPAddress= '%{NAS-IP-Address}'\n       AND AcctStopTime = 0\"\n\n   accounting_stop_query =\"\n     UPDATE ${acct_table2}\n    SET AcctStopTime = '%S',\n       AcctSessionTime = '%{Acct-Session-Time}',\n       AcctInputOctets = '%{Acct-Input-Gigawords:-0}' &lt;&lt; 32 | '%{Acct-Input-Octets:-0}',\n       AcctOutputOctets = '%{Acct-Output-Gigawords:-0}' &lt;&lt; 32 | '%{Acct-Output-Octets:-0}',\n       AcctTerminateCause = '%{Acct-Terminate-Cause}',\n       AcctStopDelay = '%{Acct-Delay-Time}',\n       ConnectInfo_stop = '%{Connect-Info}'\n     WHERE AcctSessionId = '%{Acct-Session-Id}'\n       AND UserName = '%{SQL-User-Name}'\n       AND NASIPAddress = '%{NAS-IP-Address}'\n       AND AcctStopTime =0\"\n<\/code><\/pre>\n\n\n\n<p><br>Restart Radius service, you&#8217;re done!<\/p>\n\n\n\n<p>This concatenates the Gigawords and Octets values adding 32 null bits to the first and doing a logical OR on them.<br>If you have any comment or want to share some suggestions you may have, feel free to contact us.<\/p>\n\n\n\n<p>This solution was provided on the Freeradius FAQ available at <a href=\"http:\/\/wiki.freeradius.org\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/wiki.freeradius.org<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some people using Radius for accounting don&#8217;t know there are counters limits. Values defined in the protocol are stored in 32 bit fields meaning you will never go any higher than 4294967296 bits, that is fairly more than 4GB. If a session stays up for days, there are good chances that the counter resets to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[21,3],"tags":[12,388,5,384,386,385,10],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Netexpertise - Gigawords Support in Freeradius<\/title>\n<meta name=\"description\" content=\"Enable Gigawords support in Freeradius\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.netexpertise.eu\/en\/networking\/freeradius\/gigawords-support.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Netexpertise - Gigawords Support in Freeradius\" \/>\n<meta property=\"og:description\" content=\"Enable Gigawords support in Freeradius\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.netexpertise.eu\/en\/networking\/freeradius\/gigawords-support.html\" \/>\n<meta property=\"og:site_name\" content=\"Netexpertise\" \/>\n<meta property=\"article:published_time\" content=\"2007-08-01T00:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-10-17T06:55:31+00:00\" \/>\n<meta name=\"author\" content=\"dave\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@netexpertise\" \/>\n<meta name=\"twitter:site\" content=\"@netexpertise\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/networking\/freeradius\/gigawords-support.html\",\"url\":\"http:\/\/www.netexpertise.eu\/en\/networking\/freeradius\/gigawords-support.html\",\"name\":\"Netexpertise - Gigawords Support in Freeradius\",\"isPartOf\":{\"@id\":\"https:\/\/www.netexpertise.eu\/en\/#website\"},\"datePublished\":\"2007-08-01T00:00:00+00:00\",\"dateModified\":\"2021-10-17T06:55:31+00:00\",\"author\":{\"@id\":\"https:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa\"},\"description\":\"Enable Gigawords support in Freeradius\",\"breadcrumb\":{\"@id\":\"http:\/\/www.netexpertise.eu\/en\/networking\/freeradius\/gigawords-support.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.netexpertise.eu\/en\/networking\/freeradius\/gigawords-support.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/networking\/freeradius\/gigawords-support.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.netexpertise.eu\/en\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Gigawords Support in Freeradius\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.netexpertise.eu\/en\/#website\",\"url\":\"https:\/\/www.netexpertise.eu\/en\/\",\"name\":\"Netexpertise\",\"description\":\"Systems \/ Networks \/ DevOps\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.netexpertise.eu\/en\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa\",\"name\":\"dave\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g\",\"caption\":\"dave\"},\"sameAs\":[\"http:\/\/www.netexpertise.eu\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Netexpertise - Gigawords Support in Freeradius","description":"Enable Gigawords support in Freeradius","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.netexpertise.eu\/en\/networking\/freeradius\/gigawords-support.html","og_locale":"en_US","og_type":"article","og_title":"Netexpertise - Gigawords Support in Freeradius","og_description":"Enable Gigawords support in Freeradius","og_url":"http:\/\/www.netexpertise.eu\/en\/networking\/freeradius\/gigawords-support.html","og_site_name":"Netexpertise","article_published_time":"2007-08-01T00:00:00+00:00","article_modified_time":"2021-10-17T06:55:31+00:00","author":"dave","twitter_card":"summary_large_image","twitter_creator":"@netexpertise","twitter_site":"@netexpertise","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/www.netexpertise.eu\/en\/networking\/freeradius\/gigawords-support.html","url":"http:\/\/www.netexpertise.eu\/en\/networking\/freeradius\/gigawords-support.html","name":"Netexpertise - Gigawords Support in Freeradius","isPartOf":{"@id":"https:\/\/www.netexpertise.eu\/en\/#website"},"datePublished":"2007-08-01T00:00:00+00:00","dateModified":"2021-10-17T06:55:31+00:00","author":{"@id":"https:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa"},"description":"Enable Gigawords support in Freeradius","breadcrumb":{"@id":"http:\/\/www.netexpertise.eu\/en\/networking\/freeradius\/gigawords-support.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.netexpertise.eu\/en\/networking\/freeradius\/gigawords-support.html"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.netexpertise.eu\/en\/networking\/freeradius\/gigawords-support.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.netexpertise.eu\/en"},{"@type":"ListItem","position":2,"name":"Gigawords Support in Freeradius"}]},{"@type":"WebSite","@id":"https:\/\/www.netexpertise.eu\/en\/#website","url":"https:\/\/www.netexpertise.eu\/en\/","name":"Netexpertise","description":"Systems \/ Networks \/ DevOps","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.netexpertise.eu\/en\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa","name":"dave","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/image\/","url":"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g","contentUrl":"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g","caption":"dave"},"sameAs":["http:\/\/www.netexpertise.eu"]}]}},"_links":{"self":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/posts\/54"}],"collection":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/comments?post=54"}],"version-history":[{"count":0,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/posts\/54\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/media?parent=54"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/categories?post=54"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/tags?post=54"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}