{"id":603,"date":"2011-09-27T05:19:05","date_gmt":"2011-09-27T09:19:05","guid":{"rendered":"http:\/\/www.xavignu.com\/?p=603"},"modified":"2011-09-28T05:15:07","modified_gmt":"2011-09-28T09:15:07","slug":"connecting-gns3-simulator-to-the-internet","status":"publish","type":"post","link":"https:\/\/www.xavignu.com\/?p=603","title":{"rendered":"Connecting GNS3 simulator to the Internet"},"content":{"rendered":"<p>I know it&#8217;s been a while. No, I haven&#8217;t been lost, in Guantanamo or similar. I was just too lazy\/busy to write a post. But luckily I&#8217;m back. \ud83d\ude42<\/p>\n<p>Today I&#8217;m going to write about how to connect <a href=\"http:\/\/www.gns3.net\/\" target=\"blank_\">GNS3<\/a> lab to the internet. For this we are going to have to create a tap interface on our <a href=\"http:\/\/www.debian.org\/\" target=\"blank_\">Debian<\/a> box. First thing would be to install the uml-utilities on your Debian box.<\/p>\n<p>[10:52:55] xavi@lstkco14073: ~ $ <b>sudo aptitude search uml-utilities<\/b><br \/>\ni   uml-utilities&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8211; User-mode Linux (utility programs)<br \/>\n[10:53:00] xavi@lstkco14073: ~ $ <\/p>\n<p>Now install with:<\/p>\n<p>[10:53:00] xavi@lstkco14073: ~ $ <b>sudo aptitude install uml-utilities<\/b><\/p>\n<p>Once uml-utilities is installed you can execute the following script to bring up a tap interface.<\/p>\n<p>[code lang=&#8221;bash&#8221;]<br \/>\n#!\/bin\/bash<br \/>\nsudo tunctl -t tap0 -u `whoami`<br \/>\nsudo ifconfig tap0 192.168.1.1 netmask 255.255.255.252 up<br \/>\n\/sbin\/ifconfig tap0<br \/>\n[\/code]<\/p>\n<p>[11:02:06] xavi@lstkco14073: ~ $ <b>sh tap0<\/b><br \/>\nSet &#8216;tap0&#8217; persistent and owned by uid 1000<br \/>\ntap0      Link encap:Ethernet  HWaddr 5e:3c:9d:d8:ff:9a<br \/>\n          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.252<br \/>\n          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br \/>\n          RX packets:0 errors:0 dropped:0 overruns:0 frame:0<br \/>\n          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0<br \/>\n          collisions:0 txqueuelen:500<br \/>\n          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)<\/p>\n<p>[11:02:17] xavi@lstkco14073: ~ $<\/p>\n<p>We would need to connect this tap interface to the GNS3 simulation. We also would need to configure iptables to allow routing on the <a href=\"http:\/\/www.debian.org\" target=\"blank_\">Debian<\/a> box. For that we need to execute the following script.<\/p>\n<p>[code lang=&#8221;bash&#8221;]<br \/>\n#!\/bin\/bash<br \/>\n# Script to enable IP packet forwarding and NAT<br \/>\n#<br \/>\n# eth0 is Internet connected interface<\/p>\n<p># Enable IP Forwarding<br \/>\necho 1 &gt; \/proc\/sys\/net\/ipv4\/ip_forward<\/p>\n<p># Clean up iptables<br \/>\niptables -F<br \/>\niptables -t nat -F<br \/>\niptables -X<\/p>\n<p># Enable IP MASQUERADING\/NAT<br \/>\niptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE<\/p>\n<p># Set firewall policies<br \/>\niptables -P FORWARD ACCEPT<br \/>\niptables -P OUTPUT ACCEPT<\/p>\n<p># Allow all connections not from wlan0<br \/>\niptables -A INPUT ! -i eth0 -j ACCEPT<\/p>\n<p># Allow all ICMP connections<br \/>\niptables -A INPUT -p ICMP -j ACCEPT<\/p>\n<p># Allow all already established connections<br \/>\niptables -A INPUT -m state &#8211;state ESTABLISHED,RELATED -j ACCEPT<br \/>\n[\/code]<\/p>\n<p>In our next post we would configure the GNS3 simulator. Comments are always welcome.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I know it&#8217;s been a while. No, I haven&#8217;t been lost, in Guantanamo or similar. I was just too lazy\/busy to write a post. But luckily I&#8217;m back. \ud83d\ude42 Today I&#8217;m going to write about how to connect GNS3 lab to the internet. For this we are going to have to create a tap interface [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[3],"tags":[30,56,22,6,23,70],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/pTQgt-9J","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.xavignu.com\/index.php?rest_route=\/wp\/v2\/posts\/603"}],"collection":[{"href":"https:\/\/www.xavignu.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xavignu.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xavignu.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xavignu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=603"}],"version-history":[{"count":21,"href":"https:\/\/www.xavignu.com\/index.php?rest_route=\/wp\/v2\/posts\/603\/revisions"}],"predecessor-version":[{"id":623,"href":"https:\/\/www.xavignu.com\/index.php?rest_route=\/wp\/v2\/posts\/603\/revisions\/623"}],"wp:attachment":[{"href":"https:\/\/www.xavignu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xavignu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xavignu.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}