{"id":486,"date":"2006-08-14T01:36:32","date_gmt":"2006-08-14T01:36:32","guid":{"rendered":"http:\/\/www.nargalzius.com\/blog2\/http:\/www.nargalzius.com\/blog2\/archives\/2006\/08\/2006_08_14_0936.php"},"modified":"2017-02-10T02:27:59","modified_gmt":"2017-02-10T02:27:59","slug":"wrt54g-p2p-problems","status":"publish","type":"post","link":"http:\/\/nargalzius.com\/blog\/archives\/2006\/08\/14\/wrt54g-p2p-problems","title":{"rendered":"WRT54G P2P problems?"},"content":{"rendered":"<p><a href=\"http:\/\/static.flickr.com\/64\/214690908_d1b40a77e4_o.jpg\" rel=\"lightbox\"><img decoding=\"async\" src=\"http:\/\/static.flickr.com\/64\/214690908_d1b40a77e4_t.jpg\" alt=\"\" align=\"left\" \/><\/a><\/p>\n<p>I noticed that I&#8217;ve been getting erratic behaviour with my router whenever I had bittorrent running. After a while it would always slow down to a crawl &#8211; where I had to reboot the router to get things back to normal. While rebooting the router manually (or via GUI, after much waiting) solves this. The problem always returned, which suggests that there&#8217;s something wrong with <em>how<\/em> the router handles P2P connections. I decided to look around for cases of the same problem.<\/p>\n<blockquote>\n<p>The default firmware for Linksys and most routers track old connections for <em>five<\/em> days, then start to clear dead connections &#8211; which causes the router to hang when using P2P apps, or any software that generates a lot of connections which the router can&#8217;t take. DHT only aggravates the situation because of the number of connections it generates.<\/p>\n<p>Linksys has yet to address this issue, but there is a fix. If you use alternative WRT54G firmware, you can put in a start-up script to fix this problem.<\/p>\n<\/blockquote>\n<p>I just applied the fix they mention down this post, only time will tell if it actually worked.<!--more-->It is worth mentioning, as the quote above stated, that you need 3rd party firmware for your router. Basically what you need is a Linux box which allows you to input custom commands\/scripts. Since the advent of the WRT54G hacking craze, all 3rd party firmware basically install Linux into your router, instead of the default Linksys firmware.<\/p>\n<p>I personally use DD-WRT on my WRT54G. No particular reason why I chose it &#8211; I just don&#8217;t have the patience to re-flash and test all available 3rd party firmware to find what&#8217;s best for me. Not to mention the constant risk of turning my router into a brick on every attempt &#8211; which I have already done before.<\/p>\n<ol>\n<li>Look for the part in your router GUI which lets you enter custom start-up commandline options\/scripts<\/li>\n<li>Cut any <strong>one<\/strong> script below and paste it into the command field (not sure which one works best but all of them are said to work)<\/li>\n<li>Save and reboot your router.<\/li>\n<\/ol>\n<p>Here are the choices of code:<\/p>\n<p>echo 1 > \/proc\/sys\/net\/ipv4\/icmp_echo_ignore_broadcasts<br \/>\necho 1 > \/proc\/sys\/net\/ipv4\/icmp_ignore_bogus_error_responses<br \/>\necho &#8216;600 1800 120 60 120 120 10 60 30 120&#8217; > \/proc\/sys\/net\/ipv4\/ip_conntrack_tcp_timeouts<\/p>\n<p>or<\/p>\n<p>echo 4096 > \/proc\/sys\/net\/ipv4\/ip_conntrack_max<br \/>\necho 1 > \/proc\/sys\/net\/ipv4\/icmp_echo_ignore_broadcasts<br \/>\necho 1 > \/proc\/sys\/net\/ipv4\/icmp_ignore_bogus_error_responses<br \/>\necho 512 > \/proc\/sys\/net\/ipv4\/neigh\/default\/gc_thresh1<br \/>\necho 2048 > \/proc\/sys\/net\/ipv4\/neigh\/default\/gc_thresh2<br \/>\necho 4096 > \/proc\/sys\/net\/ipv4\/neigh\/default\/gc_thresh3<br \/>\necho &#8220;600 1800 120 60 120 120 10 60 30 120&#8221; > \/proc\/sys\/net\/ipv4\/ip_conntrack_tcp_timeouts<\/p>\n<p>or<\/p>\n<p>echo 2048 > \/proc\/sys\/net\/ipv4\/ip_conntrack_max<br \/>\necho 2048 > \/proc\/sys\/net\/ipv4\/tcp_max_orphans<br \/>\necho 512 > \/proc\/sys\/kernel\/threads-max<br \/>\necho 0 > \/proc\/sys\/net\/ipv4\/tcp_orphan_retries<br \/>\necho 1 > \/proc\/sys\/net\/ipv4\/tcp_abort_on_overflow<br \/>\necho &#8220;60 180&#8221; > \/proc\/sys\/net\/ipv4\/ip_conntrack_udp_timeouts<br \/>\necho 1 > \/proc\/sys\/net\/ipv4\/icmp_echo_ignore_broadcasts<br \/>\necho 1 > \/proc\/sys\/net\/ipv4\/icmp_ignore_bogus_error_responses<br \/>\necho &#8220;300 1800 120 60 120 120 10 60 30 120&#8221; > \/proc\/sys\/net\/ipv4\/ip_conntrack_tcp_timeouts<\/p>\n<p>or<\/p>\n<p>echo 2048 > \/proc\/sys\/net\/ipv4\/ip_conntrack_max<br \/>\necho 2048 > \/proc\/sys\/net\/ipv4\/tcp_max_orphans<br \/>\necho 512 > \/proc\/sys\/kernel\/threads-max<br \/>\necho 4096 > \/proc\/sys\/fs\/file-max<br \/>\necho 0 > \/proc\/sys\/net\/ipv4\/tcp_orphan_retries<br \/>\necho 1 > \/proc\/sys\/net\/ipv4\/tcp_abort_on_overflow<br \/>\necho &#8220;60 180&#8221; > \/proc\/sys\/net\/ipv4\/ip_conntrack_udp_timeouts<br \/>\necho &#8220;300 2400 120 60 120 120 10 60 30 120&#8221; > \/proc\/sys\/net\/ipv4\/ip_conntrack_tcp_timeouts<br \/>\necho &#8220;50 500 0 0 200 1000 60 20 0&#8221; > \/proc\/sys\/vm\/bdflush<br \/>\necho &#8220;0 0&#8221; > \/proc\/sys\/vm\/pagetable_cache<\/p>\n<h2>UPDATE<\/h2>\n<p>A little bird told me that doing a paste on the web GUI startup textfield <em>may<\/em> truncate some characters, while this may or may not be an issue, it&#8217;s better to play it safe and enter these manually via <code>SSH<\/code><\/p>\n<p>This is [roughly] how your <code>SSH<\/code> session should go:<\/p>\n<p>~ # nvram set rc_startup=&#8221;<\/p>\n<blockquote>\n<p>echo 1 > \/proc\/sys\/net\/ipv4\/icmp_echo_ignore_broadcasts<br \/>\necho 1 > \/proc\/sys\/net\/ipv4\/icmp_ignore_bogus_error_responses<br \/>\necho &#8216;600 1800 120 60 120 120 10 60 30 120&#8217; > \/proc\/sys\/net\/ipv4\/ip_conntrack_tcp_timeouts<br \/>\n&#8220;<br \/>\n~ # nvram commit<br \/>\n~ # reboot  <\/p>\n<\/blockquote>\n<p>Also, it&#8217;s worth mentioning that you should set your &#8220;maximum ports&#8221; in the administration page to <em>4096<\/em> (default is 512 I believe)<\/p>","protected":false},"excerpt":{"rendered":"<p>I noticed that I&#8217;ve been getting erratic behaviour with my router whenever I had bittorrent running. After a while it would always slow down to a crawl &#8211; where I had to reboot the router to get things back to normal. While rebooting the router manually (or via GUI, after much waiting) solves this. The &hellip; <p class=\"link-more\"><a href=\"http:\/\/nargalzius.com\/blog\/archives\/2006\/08\/14\/wrt54g-p2p-problems\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;WRT54G P2P problems?&#8221;<\/span><\/a><\/p><\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[5,13],"tags":[159,517,595,698,699,867,1309],"class_list":["post-486","post","type-post","status-publish","format-standard","hentry","category-internet","category-technology","tag-bittorrent","tag-hack","tag-internet","tag-linksys","tag-linux","tag-p2p","tag-wrt54g"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"http:\/\/nargalzius.com\/blog\/wp-json\/wp\/v2\/posts\/486","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/nargalzius.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nargalzius.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nargalzius.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nargalzius.com\/blog\/wp-json\/wp\/v2\/comments?post=486"}],"version-history":[{"count":1,"href":"http:\/\/nargalzius.com\/blog\/wp-json\/wp\/v2\/posts\/486\/revisions"}],"predecessor-version":[{"id":1705,"href":"http:\/\/nargalzius.com\/blog\/wp-json\/wp\/v2\/posts\/486\/revisions\/1705"}],"wp:attachment":[{"href":"http:\/\/nargalzius.com\/blog\/wp-json\/wp\/v2\/media?parent=486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nargalzius.com\/blog\/wp-json\/wp\/v2\/categories?post=486"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nargalzius.com\/blog\/wp-json\/wp\/v2\/tags?post=486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}