{"id":3749,"date":"2012-05-14T01:29:51","date_gmt":"2012-05-14T07:29:51","guid":{"rendered":"http:\/\/gregsowell.com\/?p=3749"},"modified":"2012-05-10T15:31:36","modified_gmt":"2012-05-10T21:31:36","slug":"simulate-wan-delay-loss-and-bandwidth","status":"publish","type":"post","link":"https:\/\/gregsowell.com\/?p=3749","title":{"rendered":"Simulate WAN Delay, Loss and Bandwidth"},"content":{"rendered":"<p>I recently had a question about how to simulate the delay presented by a point to point circuit so someone could test their application going from one facility to access a SQL DB in a backup colo.  I did a quick google and ended up with several great options.<\/p>\n<h2>Netem<\/h2>\n<p>One option I found, but didn&#8217;t test is <a href=\"http:\/\/www.linuxfoundation.org\/collaborate\/workgroups\/networking\/netem\">Netem<\/a>.  This is a command line linux app that allows you to introduce delay, loss, duplication and re-ordering.<\/p>\n<h2>WANbridge<\/h2>\n<p>I then found <a href=\"http:\/\/code.google.com\/p\/wanbridge\/\">WANbridge<\/a>.  I did test this one and it worked a treat.  It is a bootable ISO based on Knoppix.  It boots up and immedately bridges all interfaces together.  Through it&#8217;s simple menu system I was simulating delay in less than 2 minutes.  I also successfully tested bandwidth constraints.  It also offers the ability to simulate loss.  It has a great quick <a href=\"http:\/\/code.google.com\/p\/wanbridge\/downloads\/detail?name=Setting%20up%20WAN%20Emulation%20using%20WAN-Bridge%20Live-CD%20v1.10.pdf&#038;can=2&#038;q=\">start guide<\/a> that will have you up and working in no time fast.<br \/>\n<strong>Quick WANbridge video<\/strong><\/p>\n<div id=\"media\">\n            <object id=\"csSWF\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"640\" height=\"498\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=9,0,115,0\"><param name=\"src\" value=\"\/classes\/wanbridge\/wanbridge_controller.swf\"\/><param name=\"bgcolor\" value=\"#1a1a1a\"\/><param name=\"quality\" value=\"best\"\/><param name=\"allowScriptAccess\" value=\"always\"\/><param name=\"allowFullScreen\" value=\"true\"\/><param name=\"scale\" value=\"showall\"\/><param name=\"flashVars\" value=\"autostart=false\"\/><embed name=\"csSWF\" src=\"\/classes\/wanbridge\/wanbridge_controller.swf\" width=\"640\" height=\"498\" bgcolor=\"#1a1a1a\" quality=\"best\" allowScriptAccess=\"always\" allowFullScreen=\"true\" scale=\"showall\" flashVars=\"autostart=false&#038;thumb=FirstFrame.png&#038;thumbscale=45&#038;color=0x000000,0x000000\" pluginspage=\"http:\/\/www.macromedia.com\/shockwave\/download\/index.cgi?P1_Prod_Version=ShockwaveFlash\"><\/embed><\/object>\n        <\/div>\n<h2>WANem<\/h2>\n<p>Last I found <a href=\"http:\/\/wanem.sourceforge.net\/\">WANem<\/a>.  This is similar to wanbridge in that it is built off of a bootable Knoppix ISO, but by default it is configured to route.  I did find a <a href=\"http:\/\/ogris.de\/howtos\/wanem.html\">quick CLI guide<\/a> to setting it up for bridged, though.<\/p>\n<p><strong>Bridge setup<\/strong><br \/>\nEdit \/etc\/network\/interfaces and add the following lines:<\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">auto br0\r\niface br0 inet static\r\n        address 192.168.0.20\r\n        netmask 255.255.255.0\r\n        gateway 192.168.0.1\r\n        bridge_ports all\r\n        bridge_fd 0\r\n        bridge_stp off<\/code><\/pre>\n<p>What you gain with WANem is features.  First it has a web based GUI that will allow you to configure per interface configurations.  This means that you can have different settings for incoming on one interface and outgoing on the other.<\/p>\n<p>Options include bandwidth, delay, packet loss, duplication, packet reordering, corruption, random disconnects.  All of these options can also have IP source\/destination matchers.<\/p>\n<p><strong>Click image to enlarge.<\/strong><br \/>\n<figure id=\"attachment_3788\" aria-describedby=\"caption-attachment-3788\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/gregsowell.com\/wp-content\/uploads\/2012\/05\/wanem1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gregsowell.com\/wp-content\/uploads\/2012\/05\/wanem1-300x105.png\" alt=\"\" title=\"wanem1\" width=\"300\" height=\"105\" class=\"size-medium wp-image-3788\" srcset=\"https:\/\/gregsowell.com\/wp-content\/uploads\/2012\/05\/wanem1-300x105.png 300w, https:\/\/gregsowell.com\/wp-content\/uploads\/2012\/05\/wanem1-1024x360.png 1024w, https:\/\/gregsowell.com\/wp-content\/uploads\/2012\/05\/wanem1.png 1223w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-3788\" class=\"wp-caption-text\">Basic Mode<\/figcaption><\/figure><br \/>\n<strong>Click image to enlarge.<\/strong><br \/>\n<figure id=\"attachment_3791\" aria-describedby=\"caption-attachment-3791\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/gregsowell.com\/wp-content\/uploads\/2012\/05\/wanem2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gregsowell.com\/wp-content\/uploads\/2012\/05\/wanem2-300x135.png\" alt=\"\" title=\"wanem2\" width=\"300\" height=\"135\" class=\"size-medium wp-image-3791\" srcset=\"https:\/\/gregsowell.com\/wp-content\/uploads\/2012\/05\/wanem2-300x135.png 300w, https:\/\/gregsowell.com\/wp-content\/uploads\/2012\/05\/wanem2-1024x463.png 1024w, https:\/\/gregsowell.com\/wp-content\/uploads\/2012\/05\/wanem2.png 1272w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-3791\" class=\"wp-caption-text\">Advanced Mode...this is where you want to be!<\/figcaption><\/figure><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently had a question about how to simulate the delay presented by a point to point circuit so someone could test their application\u2026<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,8,13],"tags":[],"class_list":["post-3749","post","type-post","status-publish","format-standard","hentry","category-linux","category-networking","category-server"],"_links":{"self":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/3749","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3749"}],"version-history":[{"count":19,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/3749\/revisions"}],"predecessor-version":[{"id":3798,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/3749\/revisions\/3798"}],"wp:attachment":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3749"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3749"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3749"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}