{"id":597,"date":"2014-01-12T14:12:00","date_gmt":"2014-01-12T06:12:00","guid":{"rendered":"http:\/\/note.systw.net\/note\/?p=597"},"modified":"2023-11-04T14:12:43","modified_gmt":"2023-11-04T06:12:43","slug":"mininet","status":"publish","type":"post","link":"https:\/\/systw.net\/note\/archives\/597","title":{"rendered":"mininet"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u4ee5vm\u5efa\u7f6e<br>http:\/\/mininet.org\/vm-setup-notes\/<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><br><strong>\u6e2c\u8a66<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u5efa\u7acb\u74b0\u5883<\/strong><br>#sudo mn<br>*** Creating network<br>*** Adding controller<br>*** Adding hosts:<br>h1 h2<br>*** Adding switches:<br>s1<br>*** Adding links:<br>(h1, s1) (h2, s1)<br>*** Configuring hosts<br>h1 h2<br>*** Starting controller<br>*** Starting 1 switches<br>s1<br>*** Starting CLI:<br>mininet&gt;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u95dc\u9589\u74b0\u5883<\/strong><br>mininet&gt; exit<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u5e38\u7528\u6307\u4ee4<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u986f\u793a\u8cc7\u8a0a<\/strong><br><strong>Display nodes<\/strong><br>mininet&gt; nodes<br><strong>Display links<\/strong><br>mininet&gt; net<br><strong>Dump information about all nodes<\/strong><br>mininet&gt; dump<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u7db2\u8def\u6307\u4ee4<\/strong><br><strong>\u986f\u793a\u8a2d\u5099\u8cc7\u8a0a<\/strong><br>mininet&gt; h1 ps -a<br>mininet&gt; s1 ifconfig -a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u7db2\u8def\u6e2c\u8a66<\/strong><br><strong>ping from host 0 to host 1:<\/strong><br>mininet&gt; h1 ping -c 1 h2<br><strong>ping\u5168\u90e8<\/strong><br>mininet&gt; pingall<br><strong>\u5efa\u7acbweb\u4e26\u6e2c\u8a66\u662f\u5426\u80fd\u8b80\u53d6web<\/strong><br>mininet&gt; h1 python -m SimpleHTTPServer 80 &amp;<br>mininet&gt; h2 wget h1<br>ps:<br>mininet&gt; h1 kill %python<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ps:<br>\u67e5\u770bswitch\u4e0a\u7684flow entry<br>dpctl dump-flows<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><br>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><br><strong>\u5efa\u7acbopenflow\u74b0\u5883<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u76f8\u95dc\u53c3\u6578<br>&#8211;controller=remote,ip=&lt; ip&gt; \u6307\u5b9acontroller\u548cip<br>&#8211;topo tree,3 \u5efa\u7acb\u4e09\u5c64\u67b6\u69cb<br>&#8211;topo linear,4 \u5efa\u7acb\u56db\u53f0switch\u4e26\u9023\u6210\u4e00\u689d\u7dda,\u6bcf\u500bswitch\u5404\u9023\u4e00\u53f0\u4e3b\u6a5f<br>&#8211;topo single,3 \u5efa\u7acb\u4e09\u53f0\u4e3b\u6a5f\u9023\u63a5\u5230switch<br>&#8211;switch ovsk \u6307\u5b9a\u4f7f\u7528ovsk(open vswitch)\u7684switch<br>ex:<br>#sudo mn &#8211;topo single,3 &#8211;switch ovsk &#8211;controller=remote,ip=10.1.2.151<br>*** Creating network<br>*** Adding controller<br>*** Adding hosts:<br>h1 h2 h3<br>*** Adding switches:<br>s1<br>*** Adding links:<br>(h1, s1) (h2, s1) (h3, s1)<br>*** Configuring hosts<br>h1 h2 h3<br>*** Starting controller<br>*** Starting 1 switches<br>s1<br>*** Starting CLI:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8230;&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><br><strong>\u5728flooding\u4e0b<\/strong><br>mininet&gt;&nbsp;<strong>h1 ping h2<\/strong><br>PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.<br>64 bytes from 10.0.0.2: icmp_req=1 ttl=64 time=2.27 ms<br>64 bytes from 10.0.0.2: icmp_req=2 ttl=64 time=0.054 ms<br>ps:<br>\u56e0\u70bafloodlight\u5728\u555f\u52d5\u6642\u81ea\u52d5\u8f09\u5165\u6a21\u7d44net.floodlightcontroller.forwarding.Forwarding\uff0c\u6240\u4ee5\u9810\u543a\u6703\u4e92\u901a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8230;&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u5728opendaylight\u4e0b<\/strong><br>\u6e2c\u8a661,\u6703\u51fa\u73fe\u5931\u6557\u8a0a\u606f<br>mininet&gt;<strong>&nbsp;h1 ping h2<\/strong><br>PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.<br>From 10.0.0.1 icmp_seq=1 Destination Host Unreachable<br>From 10.0.0.1 icmp_seq=2 Destination Host Unreachable<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u9700\u53e6\u5916\u589e\u52a0\u4ee5\u4e0b\u5169\u884c<br>#<strong>dpctl add-flow tcp:127.0.0.1:6634 in_port=1,idle_timeout=360,actions=output:2<\/strong><br>#<strong>dpctl add-flow tcp:127.0.0.1:6634 in_port=2,idle_timeout=360,actions=output:1<\/strong><br>\u78ba\u8a8dflow\u4ee5\u52a0\u5165openvswtich\u4e2d<br>#<strong>dpctl dump-flows tcp:127.0.0.1:6634<\/strong><br>stats_reply (xid=0x7383ebfc): flags=none type=1(flow)<br>cookie=0, duration_sec=82s, duration_nsec=22000000s, table_id=0, priority=32768, n_packets=9, n_bytes=770, idle_timeout=360,hard_timeout=0,in_port=1,actions=output:2<br>cookie=0, duration_sec=77s, duration_nsec=67000000s, table_id=0, priority=32768, n_packets=9, n_bytes=770, idle_timeout=360,hard_timeout=0,in_port=2,actions=output:1<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6e2c\u8a662,\u56e0\u70ba\u6709\u7b26\u5408\u7684flow,\u6240\u4ee5\u53ef\u4ee5\u5230\u9054\u53e6\u4e00\u908a<br>mininet&gt;&nbsp;<strong>h1 ping h2<\/strong><br>PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.<br>64 bytes from 10.0.0.2: icmp_req=1 ttl=64 time=2.27 ms<br>64 bytes from 10.0.0.2: icmp_req=2 ttl=64 time=0.054 ms<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5vm\u5efa\u7f6ehttp:\/\/mininet.org\/vm-set &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","_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","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[17],"tags":[],"class_list":["post-597","post","type-post","status-publish","format-standard","hentry","category-systemtool"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1858,"url":"https:\/\/systw.net\/note\/archives\/1858","url_meta":{"origin":597,"position":0},"title":"testbed and shooting range","author":"raymond","date":"2023 \u5e74 6 \u6708 7 \u65e5","format":false,"excerpt":"\u5728\u7db2\u8def\u5b89\u5168\u9818\u57df\uff0cshooting range\uff08\u9776\u5834\uff09\u662f\u4e00\u500b\u5c08\u9580\u8a2d\u8a08\u7684\u74b0\u5883\uff0c\u7528\u65bc\u6a21\u64ec\u771f\u5be6\u7684\u7db2\u8def\u653b\u64ca\u548c\u9632\u2026","rel":"","context":"\u5728\u300c\u5b89\u5168\u89e3\u6c7a\u65b9\u6848\u300d\u4e2d","block_context":{"text":"\u5b89\u5168\u89e3\u6c7a\u65b9\u6848","link":"https:\/\/systw.net\/note\/archives\/category\/securitysloution"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2542,"url":"https:\/\/systw.net\/note\/archives\/2542","url_meta":{"origin":597,"position":1},"title":"Solidity and Remix","author":"raymond","date":"2024 \u5e74 8 \u6708 10 \u65e5","format":false,"excerpt":"Solidity \u7684\u904b\u4f5c\u65b9\u5f0f\u53ef\u4ee5\u5206\u89e3\u70ba\u4e09\u500b\u4e3b\u8981\u6b65\u9a5f\uff1a\u7de8\u5beb\u3001\u7de8\u8b6f \u548c \u57f7\u884c\u3002\u958b\u767c\u8005\u80fd\u7528\u4eba\u985e\u80fd\u61c2\u7684\u8a9e\u8a00\u5beb\u2026","rel":"","context":"\u5728\u300cSmart Contract\u300d\u4e2d","block_context":{"text":"Smart Contract","link":"https:\/\/systw.net\/note\/archives\/category\/%e5%8d%80%e5%a1%8a%e9%8f%88\/smart-contract-develop"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":734,"url":"https:\/\/systw.net\/note\/archives\/734","url_meta":{"origin":597,"position":2},"title":"\u8a18\u61b6\u9ad4\u7cfb\u7d71","author":"raymond","date":"2009 \u5e74 10 \u6708 27 \u65e5","format":false,"excerpt":"\u5177\u5132\u5b58\u529f\u80fd\u7684\u8a2d\u5099\u4e2d,\u53ea\u6709\u4e3b\u8a18\u61b6\u9ad4\u55ae\u5143\u662f\u4e0d\u53ef\u6216\u7f3a\u7684\u5167\u5132\u7a0b\u5f0f\u7684\u63a7\u5236\u65b9\u5f0f1\u7a0b\u5f0f\u8207\u8cc7\u6599\u5728\u57f7\u884c\u524d\u5fc5\u9808\u5148\u8f09\u5165\u4e3b\u8a18\u2026","rel":"","context":"\u5728\u300c\u8a08\u7b97\u6a5f\u7d44\u7e54\u8207\u7d50\u69cb\u300d\u4e2d","block_context":{"text":"\u8a08\u7b97\u6a5f\u7d44\u7e54\u8207\u7d50\u69cb","link":"https:\/\/systw.net\/note\/archives\/category\/system\/computerarchitecture"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":641,"url":"https:\/\/systw.net\/note\/archives\/641","url_meta":{"origin":597,"position":3},"title":"Win2000\u74b0\u5883\u8b8a\u6578","author":"raymond","date":"2010 \u5e74 3 \u6708 11 \u65e5","format":false,"excerpt":"\u74b0\u5883\u8b8a\u6578\u662f\u5132\u5b58\u8207\u7cfb\u7d71\u76f8\u95dc\u7684\u8cc7\u8a0a\u7cfb\u7d71\u5728\u958b\u6a5f\u4e4b\u5f8c\uff0c\u6703\u81ea\u884c\u8a2d\u5b9a\u82e5\u5e72\u74b0\u5883\u8b8a\u6578\uff0c\u4ee5\u4f5c\u70ba\u7cfb\u7d71\u904b\u4f5c\u4e4b\u7528\uff0c\u74b0\u5883\u8b8a\u6578\u7684\u2026","rel":"","context":"\u5728\u300cWindows\u7cfb\u7d71\u300d\u4e2d","block_context":{"text":"Windows\u7cfb\u7d71","link":"https:\/\/systw.net\/note\/archives\/category\/system\/windows"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":847,"url":"https:\/\/systw.net\/note\/archives\/847","url_meta":{"origin":597,"position":4},"title":"Openflow","author":"raymond","date":"2014 \u5e74 1 \u6708 6 \u65e5","format":false,"excerpt":"openflow 1.0\u88ab\u5c01\u88dd\u5728TCP\u4e2d, Protocols in frame: eth:ip:t\u2026","rel":"","context":"\u5728\u300cOSI Layer7\u300d\u4e2d","block_context":{"text":"OSI Layer7","link":"https:\/\/systw.net\/note\/archives\/category\/network\/osi-layer7"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1250,"url":"https:\/\/systw.net\/note\/archives\/1250","url_meta":{"origin":597,"position":5},"title":"DOM XSS in third-party","author":"raymond","date":"2023 \u5e74 2 \u6708 18 \u65e5","format":false,"excerpt":"\u73fe\u4ee3 Web \u61c9\u7528\u7a0b\u5f0f\u901a\u5e38\u662f\u4f7f\u7528\u8a31\u591a\u7b2c\u4e09\u65b9\u7a0b\u5f0f\u5eab\u548c\u6846\u67b6\u5efa\u7acb\u7684\uff0c\u9019\u4e9b\u7a0b\u5f0f\u5eab\u548c\u6846\u67b6\u901a\u5e38\u70ba\u958b\u767c\u4eba\u54e1\u63d0\u4f9b\u9644\u52a0\u2026","rel":"","context":"\u5728\u300cClientSide\u300d\u4e2d","block_context":{"text":"ClientSide","link":"https:\/\/systw.net\/note\/archives\/category\/hackerthreat\/clientside"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/597","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/comments?post=597"}],"version-history":[{"count":0,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/597\/revisions"}],"wp:attachment":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/media?parent=597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/categories?post=597"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/tags?post=597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}