{"id":1353,"date":"2023-01-09T22:16:06","date_gmt":"2023-01-09T14:16:06","guid":{"rendered":"https:\/\/www.myway5.com\/?p=1353"},"modified":"2023-07-05T09:58:57","modified_gmt":"2023-07-05T01:58:57","slug":"openflow-match-rule","status":"publish","type":"post","link":"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/","title":{"rendered":"OpenFlow \u7684\u6d41\u8868\u5339\u914d\u89c4\u5219"},"content":{"rendered":"<p>OpenFlow \u91cc\u6709\u4e00\u4e2a\u91cd\u8981\u7684\u6982\u5ff5\u2014\u6d41\u8868(FlowTable)\uff0c\u901a\u8fc7 Flow Table\uff0c\u6211\u4eec\u53ef\u4ee5\u5236\u5b9a\u4ea4\u6362\u673a\u5904\u7406\u6d41\u91cf\u7684\u884c\u4e3a\u3002\u56e0\u6b64\uff0c\u7406\u89e3\u6d41\u8868\u5339\u914d\u89c4\u5219\uff0c\u662f\u7406\u89e3 OpenFlow \u7684\u91cd\u8981\u4e00\u73af\u3002<\/p>\n<p>OpenvSwitch(\u4e0b\u6587\u79f0\u4e3aOVS) \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u8f6f\u4ef6\u4ea4\u6362\u673a\u7684\u5b9e\u73b0\uff0c\u540c\u65f6\u4e5f\u662f\u652f\u6301 OpenFlow \u7684\uff0c\u56e0\u6b64\u4e0b\u6587\u4e5f\u4f1a\u901a\u8fc7 OVS \u6765\u8bf4\u660e\u6d41\u8868\u662f\u5982\u4f55\u5339\u914d\u7684\u3002<\/p>\n<h2>\u6d41\u8868\u5339\u914d\u89c4\u5219<\/h2>\n<h3>\u6d41\u8868\u9879<\/h3>\n<p>\u5728\u4e00\u4e2a OpenFlow \u7684\u7f51\u7edc\u4e2d\uff0c\u6bcf\u4e00\u4e2a\u652f\u6301 OpenFlow \u7684\u4ea4\u6362\u673a\u90fd\u5fc5\u987b\u5305\u542b\u81f3\u5c11 1 \u4e2a\u6d41\u8868(table 0)\uff0c\u8fd9\u4e2a\u6d41\u8868\u91cc\u4f1a\u5305\u542b 0 \u6216\u591a\u4e2a\u6d41\u8868\u9879\u3002\u8fd9\u4e9b\u6d41\u8868\u9879\u63cf\u8ff0\u4e86\u6d41\u91cf\u7684\u5339\u914d\u89c4\u5219\uff0c\u8ba1\u6570\u5668\u4ee5\u53ca\u5982\u679c\u9488\u5bf9\u8fd9\u4e9b\u6d41\u91cf\u505a\u51fa\u52a8\u4f5c\u3002<\/p>\n<p>\u4e00\u4e2a\u6d41\u8868\u9879\u901a\u5e38\u7531\u4ee5\u4e0b\u5143\u7d20\u7ec4\u6210<\/p>\n<table>\n<thead>\n<tr>\n<th>\u5b57\u6bb5<\/th>\n<th>\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Match Fileds<\/td>\n<td>\u7528\u6765\u5339\u914d\u6570\u636e\u5305<\/td>\n<\/tr>\n<tr>\n<td>Priority<\/td>\n<td>\u5339\u914d\u6d41\u8868\u9879\u7684\u4f18\u5148\u7ea7\u3002\u5982\u679c\u4e00\u4e2a\u6570\u636e\u5305\u88ab\u591a\u4e2a\u6d41\u8868\u9879\u5339\u914d\u5230\uff0c\u5219\u4f1a\u6839\u636e\u4f18\u5148\u7ea7\u8fdb\u884c\u9009\u62e9<\/td>\n<\/tr>\n<tr>\n<td>Counters<\/td>\n<td>\u5f53\u6570\u636e\u5305\u88ab\u5339\u914d\u6210\u529f\u65f6\u4f1a\u66f4\u65b0\u8be5\u5b57\u6bb5\uff0c\u4e3b\u8981\u7528\u6765\u6d41\u91cf\u7edf\u8ba1<\/td>\n<\/tr>\n<tr>\n<td>Instructions<\/td>\n<td>\u7528\u6765\u4fee\u6539 Actions \u6216 \u6d41\u6c34\u7ebf\u5904\u7406<\/td>\n<\/tr>\n<tr>\n<td>Timeouts<\/td>\n<td>\u6d41\u8868\u9879\u7684\u8d85\u65f6\u65f6\u95f4<\/td>\n<\/tr>\n<tr>\n<td>Cookie<\/td>\n<td>\u4e00\u4e9b\u4e0d\u900f\u660e\u7684\u6570\u636e\u503c\u3002\u63a7\u5236\u5668\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u8fc7\u6ee4\u6d41\u91cf\u7edf\u8ba1\uff0c\u6d41\u91cf\u4fee\u6539\u548c\u6d41\u91cf\u5220\u9664\u3002\u5728\u5904\u7406\u6570\u636e\u5305\u65f6\u4e0d\u4f7f\u7528\u8fd9\u4e9b\u6570\u636e\u503c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u6d41\u6c34\u7ebf\u5904\u7406<\/h3>\n<p>\u6d41\u8868\u5728\u5904\u7406\u65f6\uff0c\u5c31\u50cf\u6d41\u6c34\u7ebf\u4e00\u4e0b\uff0c\u6bcf\u4e2a table \u90fd\u662f\u4e00\u4e2a\u5904\u7406\u9636\u6bb5\u3002\u5728\u6bcf\u4e00\u4e2a table \u91cc\uff0c\u6570\u636e\u5305\u90fd\u53ef\u80fd\u88ab\uff1a<\/p>\n<ul>\n<li>\u4e22\u5f03\u3002<\/li>\n<li>\u8f6c\u53d1\u7ed9\u4e0b\u4e00\u4e2a table<\/li>\n<li>\u53d1\u9001\u7ed9 controller<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/www.myway5.com\/wp-content\/uploads\/2023\/01\/openflow-flow.webp\" alt=\"https:\/\/www.myway5.com\/wp-content\/uploads\/2023\/01\/openflow-flow.webp\" \/><\/p>\n<p>\u5982\u4e0a\u56fe\u6240\u793a\uff0c\u6570\u636e\u5305\u901a\u8fc7 port \u8fdb\u5165\u4ea4\u6362\u673a\u540e\uff0c\u9996\u5148\u4f1a\u5339\u914d table 0 \u4e2d\u7684\u6d41\u8868\u9879\u3002\u5982\u679c\u6d41\u8868\u9879\u5339\u914d\u5230\u4e86\uff0c\u5219\u4f1a\u6839\u636e\u8be5\u6d41\u8868\u9879\u8bbe\u5b9a\u7684 actions \u8fdb\u884c\u64cd\u4f5c\u3002\u5982\u679c\u672a\u5339\u914d\u5230\uff0c\u5219\u4f1a\u88ab\u4e22\u5f03\u3002<\/p>\n<p>\u6570\u636e\u5305\u5728\u4e0d\u540c\u7684 table \u4e2d\u6d41\u8f6c\u65f6\uff0c\u53ea\u80fd\u6309\u7167\u5347\u5e8f\u8fdb\u884c\uff0c\u4e5f\u5c31\u662f\u8bf4\u53ef\u4ee5\u4ece table 0 \u2192 table10\uff0c\u4f46\u662f\u4e0d\u80fd\u4ece table10 \u2192 table0\u3002\u5e76\u4e14\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5728\u6d41\u8868\u4e4b\u95f4\u8df3\u8f6c\u9700\u8981\u4f7f\u7528 goto_table \u6216 resubmit \u8bed\u53e5\u6765\u5c06\u6570\u636e\u5305 copy \u4e00\u4efd\u8f6c\u53d1\u5230\u5176\u4ed6\u7684\u6d41\u8868\u4e2d\u5904\u7406\u3002\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u8df3\u8f6c\u52a8\u4f5c\uff0c\u662f\u4e0d\u4f1a\u7ee7\u7eed\u5728\u5176\u4ed6 table \u4e2d\u8fdb\u884c\u5339\u914d\u7684\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.myway5.com\/wp-content\/uploads\/2023\/01\/openflow-flow-det.webp\" alt=\"https:\/\/www.myway5.com\/wp-content\/uploads\/2023\/01\/openflow-flow-det.webp\" \/><\/p>\n<h2>OVS \u64cd\u4f5c\u6f14\u793a<\/h2>\n<p>\u4e3a\u4e86\u52a0\u6df1\u5bf9 OpenFlow \u7684\u7406\u89e3\uff0c\u53ef\u4ee5\u4f7f\u7528 OVS \u63d0\u4f9b\u7684\u4e00\u4e2a\u4f8b\u5b50\u8fdb\u884c\u7ec3\u4e60\u3002\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u4f7f\u7528 OVS \u7684\u6d41\u8868\u5b9e\u73b0\u4e86\u4ea4\u6362\u673a\u4e8c\u5c42 Mac \u5730\u5740\u7684\u5b66\u4e60\uff0c\u4ee5\u53ca VLAN \u7684\u652f\u6301\u3002<\/p>\n<h3>\u73af\u5883\u51c6\u5907<\/h3>\n<p>\u548c ovs \u5b98\u7f51\u4e0d\u540c\u7684\u662f\uff0c\u8fd9\u91cc\u6211\u4f7f\u7528 mininet \u5feb\u901f\u521b\u5efa\u4e00\u4e2a\u5b9e\u9a8c\u73af\u5883\u3002<\/p>\n<pre><code class=\"language-bash line-numbers\">sudo mn --topo=single,4 --mac --controller=none\n<\/code><\/pre>\n<p>\u8fd9\u91cc\u521b\u5efa\u4e86\u4e00\u4e2a\u540d\u4e3a s1 \u7684\u4ea4\u6362\u673a\u548c 4 \u53f0\u8fde\u63a5\u5230\u4ea4\u6362\u673a\u4e0a\u7684\u4e3b\u673a h1, h2, h3, h4\uff0c\u901a\u8fc7 port1, port2, port3, port4 \u8fde\u63a5\u3002port1 trunk \u6240\u6709\u7684 vlan\uff0cport2 access vlan 20, port3, port3 access vlan 30\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.myway5.com\/wp-content\/uploads\/2023\/01\/ovs.drawio-1.png\" alt=\"https:\/\/www.myway5.com\/wp-content\/uploads\/2023\/01\/ovs.drawio-1.png\" \/><\/p>\n<h3>table 0: \u51c6\u5165\u63a7\u5236<\/h3>\n<p>table 0 \u662f\u6570\u636e\u5305\u8fdb\u5165\u4ea4\u6362\u673a\u7684\u8d77\u59cb\u4f4d\u7f6e\u3002\u6211\u4eec\u5728\u8fd9\u4e00\u6b65\u53bb\u7981\u6b62\u67d0\u4e9b\u6570\u636e\u5305\u7684\u8fdb\u5165\u3002\u6bd4\u5982\uff1a\u4ee5\u591a\u64ad\u6e90\u5730\u5740\u7684\u6570\u636e\u5305\u662f\u975e\u6cd5\u7684\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u5728\u8fd9\u91cc\u4e22\u5f03\u6389\u3002<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-ofctl add-flow s1 \"table=0, dl_src=01:00:00:00:00:00\/01:00:00:00:00:00, actions=drop\"\n<\/code><\/pre>\n<p>\u4ea4\u6362\u673a\u4e5f\u4e0d\u5e94\u8be5\u8f6c\u53d1 IEEE 802.1D Spanning Tree Protocol(STP) \u6570\u636e\u5305\uff0c\u6240\u4ee5\u6211\u4eec\u5728\u53ef\u4ee5\u901a\u8fc7\u6d41\u8868\u9879\u6765\u4e22\u5f03\u6389\u3002<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-ofctl add-flow s1 \"table=0, dl_dst=01:80:c2:00:00:00\/ff:ff:ff:ff:ff:f0, actions=drop\"\n<\/code><\/pre>\n<p>\u5bf9\u4e8e\u5176\u4ed6\u5408\u6cd5\u7684\u6570\u636e\u5305\uff0c\u6211\u4eec\u90fd\u63d0\u4ea4\u5230\u6d41\u6c34\u7ebf\u7684\u4e0b\u4e00\u9636\u6bb5(table1) \u4e2d\u53bb\u5904\u7406\u3002\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528\u6700\u4f4e\u7684\u4f18\u5148\u7ea7\u6765\u505a\u515c\u5e95<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-ofctl add-flow s1 \"table=0, priority=0, actions=resubmit(,1)\"\n<\/code><\/pre>\n<h3>\u6d4b\u8bd5 table 0<\/h3>\n<p>\u8fd9\u91cc\u56e0\u4e3a\u6709\u4e00\u4e9b\u6570\u636e\u5305\u4e0d\u65b9\u4fbf\u6784\u9020\u53bb\u505a\u5b9e\u9645\u7684\u6d4b\u8bd5\uff0c\u6240\u4ee5\u4f7f\u7528 <code>ofproto\/trace<\/code> \u53bb\u6a21\u62df\u6570\u636e\u5e93\u7684\u5339\u914d\u3002<\/p>\n<p><strong>\u4f8b\u5b501<\/strong><\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-appctl ofproto\/trace s1 in_port=1,dl_dst=01:80:c2:00:00:05\n<\/code><\/pre>\n<p>\u4f1a\u51fa\u73b0\u4ee5\u4e0b\u8f93\u51fa<\/p>\n<pre><code class=\"language-bash line-numbers\">Flow: in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=01:80:c2:00:00:05,dl_type=0x0000\n\nbridge(\"s1\")\n------------\n 0. dl_dst=01:80:c2:00:00:00\/ff:ff:ff:ff:ff:f0, priority 32768\n    drop\n\nFinal flow: unchanged\nMegaflow: recirc_id=0,eth,in_port=1,dl_src=00:00:00:00:00:00\/01:00:00:00:00:00,dl_dst=01:80:c2:00:00:00\/ff:ff:ff:ff:ff:f0,dl_type=0x0000\nDatapath actions: drop\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\u4ee5\u4e0b\u5173\u952e\u4fe1\u606f\uff1a<\/p>\n<ol>\n<li>\u6570\u636e\u5305\u5339\u914d\u5230\u4e86 <code>dl_dst=01:80:c2:00:00:00\/ff:ff:ff:ff:ff:f0, priority 32768<\/code> ,\u6839\u636e action \u9700\u8981\u88ab drop \u6389<\/li>\n<li>Final flow \u4e3a unchanged \uff0c\u8bf4\u660e\u6570\u636e\u5305\u672c\u8eab\u6ca1\u6709\u88ab\u4fee\u6539\u3002<\/li>\n<\/ol>\n<p><strong>\u4f8b\u5b502<\/strong><\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-appctl ofproto\/trace s1 in_port=1,dl_dst=01:80:c2:00:00:10\n<\/code><\/pre>\n<p>\u51fa\u73b0\u4ee5\u4e0b\u8f93\u51fa<\/p>\n<pre><code class=\"language-bash line-numbers\">Flow: in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=01:80:c2:00:00:10,dl_type=0x0000\n\nbridge(\"s1\")\n------------\n 0. priority 0\n    resubmit(,1)\n 1. No match.\n    drop\n\nFinal flow: unchanged\nMegaflow: recirc_id=0,eth,in_port=1,dl_src=00:00:00:00:00:00\/01:00:00:00:00:00,dl_dst=01:80:c2:00:00:10\/ff:ff:ff:ff:ff:f0,dl_type=0x0000\nDatapath actions: drop\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u51fa\u6570\u636e\u5305\u88ab resubmit \u5230 table 1 \u4e86\uff0c\u4f46\u662f\u56e0\u4e3a table 1 \u4e2d\u6ca1\u6709\u4efb\u4f55\u6d41\u8868\u9879\uff0c\u6240\u4ee5\u88ab drop \u4e86\u3002<\/p>\n<h3>table 1: VLAN \u8fdb\u5165\u6570\u636e\u5305\u5904\u7406<\/h3>\n<p>\u8fdb\u5165 table 1 \u7684\u6570\u636e\u5305\uff0c\u90fd\u662f\u5728 table 0 \u4e2d\u88ab\u6821\u9a8c\u6709\u6548\u7684\u6570\u636e\u5305\u3002table 1 \u88ab\u8bbe\u8ba1\u7528\u6765\u6821\u9a8c\u6570\u636e\u5305\u7684 VLAN\uff0c\u8fd9\u4e2a\u6821\u9a8c\u662f\u57fa\u4e8e\u6570\u636e\u5305\u8fdb\u5165\u4ea4\u6362\u673a\u7ecf\u8fc7\u7684 Port \u914d\u7f6e\u3002\u540c\u65f6\u6211\u4eec\u4e5f\u4f1a\u5728\u8fd9\u4e9b\u8fdb\u5165 access port \u7684\u6570\u636e\u5305 header \u91cc\u6dfb\u52a0 VLAN tag\uff0c\u6765\u4fdd\u8bc1\u540e\u7eed\u7684\u5904\u7406\u90fd\u53ef\u4ee5\u57fa\u4e8e\u8fd9\u4e9b VLAN tag \u8fdb\u884c\u3002<\/p>\n<p>\u9996\u5148\u6211\u4eec\u6dfb\u52a0\u4e00\u4e2a\u9ed8\u8ba4 drop \u7684\u89c4\u5219<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-ofctl add-flow s1 \"table=1, priority=0, actions=drop\"\n<\/code><\/pre>\n<p>\u5bf9\u4e8e trunk port 1\uff0c\u53ef\u4ee5\u63a5\u6536\u4efb\u610f\u6570\u636e\u5305\uff0c\u65e0\u8bba\u6570\u636e\u5305\u662f\u5426\u6709 VLAN header \u6216\u8005\u8fd9\u4e2a VLAN tag \u662f\u591a\u5c11\u3002\u6240\u4ee5\u53ef\u4ee5\u6dfb\u52a0\u4e00\u4e2a\u6d41\u8868\u9879\uff0c\u5c06\u8fdb\u5165 port1 \u7684\u6240\u6709\u6570\u636e\u5305 resubmit \u5230 table 2 \u4e2d\u3002<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-ofctl add-flow s1 \"table=1, priority=99, in_port=1, actions=resubmit(,2)\"\n<\/code><\/pre>\n<p>\u5728 access port \u4e0a\uff0c\u53ea\u63a5\u6536\u6ca1\u6709 VLAN header \u7684\u6570\u636e\u5305\uff0c\u7136\u540e\u5bf9\u6570\u636e\u5305\u6253\u4e0a VLAN tag\uff0c\u7136\u540e\u518d\u63d0\u4ea4\u5230\u4e0b\u4e00\u9636\u6bb5(table2) \u53bb\u5904\u7406\u3002<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-ofctl add-flow s1 \"table=1, priority=99, in_port=2, vlan_tci=0, actions=mod_vlan_vid:20, resubmit(,2)\"\nsh ovs-ofctl add-flow s1 \"table=1, priority=99, in_port=3, vlan_tci=0, actions=mod_vlan_vid:30, resubmit(,2)\"\nsh ovs-ofctl add-flow s1 \"table=1, priority=99, in_port=4, vlan_tci=0, actions=mod_vlan_vid:30, resubmit(,2)\"\n<\/code><\/pre>\n<h3>\u6d4b\u8bd5 table 1<\/h3>\n<p><strong>\u4f8b\u5b501\uff1a\u6570\u636e\u5305\u8fdb\u5165 trunk port<\/strong><\/p>\n<p>\u6570\u636e\u5305\u8fdb\u5165 trunk port 1<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-appctl ofproto\/trace s1 in_port=1,vlan_tci=5\n<\/code><\/pre>\n<p>\u5f97\u5230\u4ee5\u4e0b\u8f93\u51fa\uff0c\u6570\u636e\u5305\u5728 table 0 \u4e2d resubmit \u5230 table 1\uff0c\u518d\u5230 table 2 \u540e\u6ca1\u6709\u89c4\u5219\uff0c\u88ab\u9ed8\u8ba4\u4e22\u5f03<\/p>\n<pre><code class=\"language-bash line-numbers\">Flow: in_port=1,vlan_tci=0x0005,vlan_tci1=0x0000,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,dl_type=0x0000\n\nbridge(\"s1\")\n------------\n 0. priority 0\n    resubmit(,1)\n 1. in_port=1, priority 99\n    resubmit(,2)\n 2. No match.\n    drop\n\nFinal flow: unchanged\nMegaflow: recirc_id=0,eth,in_port=1,dl_src=00:00:00:00:00:00\/01:00:00:00:00:00,dl_dst=00:00:00:00:00:00\/ff:ff:ff:ff:ff:f0,dl_type=0x0000\nDatapath actions: drop\n<\/code><\/pre>\n<p><strong>\u4f8b\u5b502\uff1a\u6709\u6548\u7684\u6570\u636e\u5305\u8fdb\u5165 access port<\/strong><\/p>\n<p>\u4e00\u4e2a\u6ca1\u6709 802.1Q header \u7684\u6570\u636e\u5305\u8fdb\u5165 port 2<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-appctl ofproto\/trace s1 in_port=2\n<\/code><\/pre>\n<p>\u5f97\u5230\u4ee5\u4e0b\u8f93\u51fa\uff0c\u6570\u636e\u5305\u5728 table 0 \u4e2d resubmit \u5230 table 1\uff0c\u518d\u5230 table 2 \u540e\u6ca1\u6709\u89c4\u5219\uff0c\u88ab\u9ed8\u8ba4\u4e22\u5f03i<\/p>\n<pre><code class=\"language-bash line-numbers\">Flow: in_port=2,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,dl_type=0x0000\n\nbridge(\"s1\")\n------------\n 0. priority 0\n    resubmit(,1)\n 1. in_port=2,vlan_tci=0x0000, priority 99\n    mod_vlan_vid:20\n    resubmit(,2)\n 2. No match.\n    drop\n\nFinal flow: in_port=2,dl_vlan=20,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,dl_type=0x0000\nMegaflow: recirc_id=0,eth,in_port=2,dl_src=00:00:00:00:00:00\/01:00:00:00:00:00,dl_dst=00:00:00:00:00:00\/ff:ff:ff:ff:ff:f0,dl_type=0x0000\nDatapath actions: drop\n<\/code><\/pre>\n<p><strong>\u4f8b\u5b503: \u65e0\u6548\u7684\u6570\u636e\u5305\u8fdb\u5165 access port<\/strong><\/p>\n<p>\u4e00\u4e2a\u6709 802.1Q header \u7684\u6570\u636e\u5305\u8fdb\u5165 port 2<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-appctl ofproto\/trace s1 in_port=2,vlan_tci=5\n<\/code><\/pre>\n<p>\u5f97\u5230\u4ee5\u4e0b\u8f93\u51fa\uff0c\u5728 table 1 \u4e2d\u88ab drop \u4e86\u3002<\/p>\n<pre><code class=\"language-bash line-numbers\">Flow: in_port=2,vlan_tci=0x0005,vlan_tci1=0x0000,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,dl_type=0x0000\n\nbridge(\"s1\")\n------------\n 0. priority 0\n    resubmit(,1)\n 1. priority 0\n    drop\n\nFinal flow: unchanged\nMegaflow: recirc_id=0,eth,in_port=2,vlan_tci=0x0005,dl_src=00:00:00:00:00:00\/01:00:00:00:00:00,dl_dst=00:00:00:00:00:00\/ff:ff:ff:ff:ff:f0,dl_type=0x0000\nDatapath actions: drop\n<\/code><\/pre>\n<h3>table 2: \u8fdb\u5165 port \u540e\u5b66\u4e60 MAC+VLAN<\/h3>\n<p>table 2\u5141\u8bb8\u6211\u4eec\u5b9e\u73b0\u7684\u4ea4\u6362\u673a\u5b66\u4e60\u6570\u636e\u5305\u7684 source mac\u3002\u53ea\u9700\u8981\u4e00\u4e2a\u6d41\u8868\u9879<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-ofctl add-flow s1 \"table=2 actions=learn(table=10, NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], load:NXM_OF_IN_PORT[]-&gt;NXM_NX_REG0[0..15]),resubmit(,3)\"\n<\/code><\/pre>\n<p>learn \u8fd9\u4e2a action \u4f1a\u57fa\u4e8e\u6b63\u5728\u5904\u7406\u7684\u6570\u636e\u5305\uff0c\u52a8\u6001\u7684\u4fee\u6539\u6d41\u8868\u3002\u5bf9\u4e8e learn \u7684\u51e0\u4e2a\u5b57\u6bb5\u8bf4\u660e\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\">table=10\n\n    Modify flow table 10.  This will be the MAC learning table.\n\nNXM_OF_VLAN_TCI[0..11]\n\n    Make the flow that we add to flow table 10 match the same VLAN\n    ID that the packet we're currently processing contains.  This\n    effectively scopes the MAC learning entry to a single VLAN,\n    which is the ordinary behavior for a VLAN-aware switch.\n\nNXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[]\n\n    Make the flow that we add to flow table 10 match, as Ethernet\n    destination, the Ethernet source address of the packet we're\n    currently processing.\n\nload:NXM_OF_IN_PORT[]-&gt;NXM_NX_REG0[0..15]\n\n    Whereas the preceding parts specify fields for the new flow to\n    match, this specifies an action for the flow to take when it\n    matches.  The action is for the flow to load the ingress port\n    number of the current packet into register 0 (a special field\n    that is an Open vSwitch extension to OpenFlow).\n<\/code><\/pre>\n<h3>\u6d4b\u8bd5 table 2<\/h3>\n<p><strong>\u4f8b\u5b501<\/strong><\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-appctl ofproto\/trace s1 in_port=1,vlan_tci=20,dl_src=50:00:00:00:00:01 -generate\n<\/code><\/pre>\n<p>\u5f97\u5230\u4ee5\u4e0b\u8f93\u51fa\u3002\u4e0a\u9762\u7684\u547d\u4ee4\u4e2d\u4f7f\u7528\u4e86 <code>-generate<\/code>\uff0c\u662f\u4e3a\u4e86\u8ba9\u6570\u636e\u5305\u771f\u5b9e\u7684\u5728 OVS \u4e2d\u751f\u6548\uff0c\u4e0d\u6307\u5b9a\u7684\u8bdd\uff0cOVS \u4e0d\u4f1a\u771f\u5b9e\u7684\u751f\u6210 table 10 \u4e2d\u7684\u6d41\u8868\u9879\u3002<\/p>\n<pre><code class=\"language-bash line-numbers\">Flow: in_port=1,vlan_tci=0x0014,vlan_tci1=0x0000,dl_src=50:00:00:00:00:01,dl_dst=00:00:00:00:00:00,dl_type=0x0000\n\nbridge(\"s1\")\n------------\n 0. priority 0\n    resubmit(,1)\n 1. in_port=1, priority 99\n    resubmit(,2)\n 2. priority 32768\n    learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]-&gt;NXM_NX_REG0[0..15])\n     -&gt; table=10 vlan_tci=0x0014\/0x0fff,dl_dst=50:00:00:00:00:01 priority=32768 actions=load:0x1-&gt;NXM_NX_REG0[0..15]\n    resubmit(,3)\n 3. No match.\n    drop\n\nFinal flow: unchanged\nMegaflow: recirc_id=0,eth,in_port=1,vlan_tci=0x0014\/0x1fff,dl_src=50:00:00:00:00:01,dl_dst=00:00:00:00:00:00\/ff:ff:ff:ff:ff:f0,dl_type=0x0000\nDatapath actions: drop\n<\/code><\/pre>\n<p>\u5728 table 10 \u4e2d\u786e\u8ba4\u662f\u5426\u6709\u65b0\u7684\u6d41\u8868\u9879\u751f\u6210<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-ofctl dump-flows s1 table=10\n\ncookie=0x0, duration=142.170s, table=10, n_packets=0, n_bytes=0, vlan_tci=0x0014\/0x0fff,dl_dst=50:00:00:00:00:01 actions=load:0x1-&gt;NXM_NX_REG0[0..15]\n<\/code><\/pre>\n<p><strong>\u4f8b\u5b502<\/strong><\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-appctl ofproto\/trace s1 in_port=2,dl_src=50:00:00:00:00:01 -generate\n\ncookie=0x0, duration=193.493s, table=10, n_packets=0, n_bytes=0, vlan_tci=0x0014\/0x0fff,dl_dst=50:00:00:00:00:01 actions=load:0x2-&gt;NXM_NX_REG0[0..15]\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u5728\u4f8b\u5b50 1 \u4e2d table 10 \u4e2d\uff0c\u5728 port 1 \u4e0a\u5b66\u4e60\u5230\u4e86 mac \u5730\u5740 <code>50:00:00:00:00:01<\/code>\uff0c\u73b0\u5728 port 2 \u4e2d\u4e5f\u51fa\u73b0\u4e86\u8be5 mac \u5730\u5740\uff0c\u6240\u4ee5\u8fd9\u4e2a mac \u5730\u5740\u66f4\u65b0\u5230\u4e86 port 2 \u4e0a\u3002<\/p>\n<h3>table 3: \u67e5\u627e\u76ee\u6807 Port<\/h3>\n<p>\u8fd9\u4e2a table \u5b9e\u73b0\u4e86\u5982\u4f55\u901a\u8fc7 MAC \u548c VLAN \u67e5\u627e\u5230\u76ee\u6807\u7684 output port\u3002\u901a\u8fc7\u4ee5\u4e0b\u6d41\u8868\u9879\u6765\u5b9e\u73b0\u67e5\u627e<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-ofctl add-flow s1 \"table=3 priority=50 actions=resubmit(,10), resubmit(,4)\"\n<\/code><\/pre>\n<p>\u8fd9\u4e2a\u6d41\u8868\u9879\u9996\u5148\u5c06\u6570\u636e\u5305\u63d0\u4ea4\u5230 table 10 \u4e2d\u3002table 10 \u4e2d\u5b58\u50a8\u4e86\u5b66\u4e60\u5230\u7684 mac \u5730\u5740\u3002\u5982\u679c\u8fd9\u4e2a mac \u5730\u5740\u6ca1\u6709\u88ab\u5b66\u4e60\u8fc7\uff0c\u5219 table 10 \u4e2d\u4e0d\u4f1a\u88ab\u5339\u914d\u3002\u90a3\u4e48\u5c31\u4f1a\u88ab resubmit \u5230 table 4 \u4e2d\u7ee7\u7eed\u5904\u7406\u3002<\/p>\n<h3>\u6d4b\u8bd5 table 3<\/h3>\n<p>\u4e0b\u9762\u7684\u547d\u4ee4\u4f1a\u8ba9 OVS \u5b66\u4e60\u5230 port 1\u4e0a VLAN 20 \u7684 mac \u5730\u5740 f0:00:00:00:00:01<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-appctl ofproto\/trace s1 in_port=1,dl_vlan=20,dl_src=f0:00:00:00:00:01,dl_dst=90:00:00:00:00:01 -generate\n<\/code><\/pre>\n<p>\u5f97\u5230\u4ee5\u4e0b\u8f93\u51fa\uff0c\u6570\u636e\u5305\u5728 table 10 \u4e2d\u6ca1\u6709\u5339\u914d\u5230\uff0c\u6240\u4ee5\u88ab resubmit \u5230 table 4.<\/p>\n<pre><code class=\"language-bash line-numbers\">Flow: in_port=1,dl_vlan=20,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=90:00:00:00:00:01,dl_type=0x0000\n\nbridge(\"s1\")\n------------\n 0. priority 0\n    resubmit(,1)\n 1. in_port=1, priority 99\n    resubmit(,2)\n 2. priority 32768\n    learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]-&gt;NXM_NX_REG0[0..15])\n     -&gt; table=10 vlan_tci=0x0014\/0x0fff,dl_dst=f0:00:00:00:00:01 priority=32768 actions=load:0x1-&gt;NXM_NX_REG0[0..15]\n    resubmit(,3)\n 3. priority 50\n    resubmit(,10)\n    10. No match.\n            drop\n    resubmit(,4)\n 4. No match.\n    drop\n\nFinal flow: unchanged\nMegaflow: recirc_id=0,eth,in_port=1,dl_vlan=20,dl_src=f0:00:00:00:00:01,dl_dst=90:00:00:00:00:01,dl_type=0x0000\nDatapath actions: drop\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u4e24\u79cd\u65b9\u5f0f\u9a8c\u8bc1 port 1 \u4e0a\u5b66\u4e60\u5230\u7684 mac \u5730\u5740\uff1a<\/p>\n<p>\u65b9\u6cd5\u4e00\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-ofctl dump-flows s1 table=10\n\ncookie=0x0, duration=107.451s, table=10, n_packets=0, n_bytes=0, vlan_tci=0x0014\/0x0fff,dl_dst=f0:00:00:00:00:01 actions=load:0x1-&gt;NXM_NX_REG0[0..15]\n<\/code><\/pre>\n<p>\u65b9\u6cd5\u4e8c\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-appctl ofproto\/trace s1 in_port=2,dl_src=90:00:00:00:00:01,dl_dst=f0:00:00:00:00:01 -generate\n\nFlow: in_port=2,vlan_tci=0x0000,dl_src=90:00:00:00:00:01,dl_dst=f0:00:00:00:00:01,dl_type=0x0000\n\nbridge(\"s1\")\n------------\n 0. priority 0\n    resubmit(,1)\n 1. in_port=2,vlan_tci=0x0000, priority 99\n    mod_vlan_vid:20\n    resubmit(,2)\n 2. priority 32768\n    learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]-&gt;NXM_NX_REG0[0..15])\n     -&gt; table=10 vlan_tci=0x0014\/0x0fff,dl_dst=90:00:00:00:00:01 priority=32768 actions=load:0x2-&gt;NXM_NX_REG0[0..15]\n    resubmit(,3)\n 3. priority 50\n    resubmit(,10)\n    10. vlan_tci=0x0014\/0x0fff,dl_dst=f0:00:00:00:00:01, priority 32768\n            load:0x1-&gt;NXM_NX_REG0[0..15]\n    resubmit(,4)\n 4. No match.\n    drop\n\nFinal flow: reg0=0x1,in_port=2,dl_vlan=20,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=90:00:00:00:00:01,dl_dst=f0:00:00:00:00:01,dl_type=0x0000\nMegaflow: recirc_id=0,eth,in_port=2,dl_src=90:00:00:00:00:01,dl_dst=f0:00:00:00:00:01,dl_type=0x0000\nDatapath actions: drop\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\u5728 table 10 \u4e2d\u5339\u914d\u5230\u4e86\u6d41\u8868\u9879\uff0c\u5b66\u4e60\u5230\u4e86 <code>load:0x1-&gt;NXM_NX_REG0[0..15]<\/code><\/p>\n<h3>table 4: \u6570\u636e\u5305\u8f93\u51fa\u5904\u7406<\/h3>\n<p>\u5728 table 4 \u4e2d\uff0c\u6211\u4eec\u77e5\u9053 register 0 \u5305\u542b\u4e86\u9700\u8981\u7684 output port\uff0c\u5982\u679c\u8be5 output port \u662f 0\uff0c\u5219\u8bf4\u660e\u9700\u8981\u5c06\u6570\u636e\u5305 flood\u3002\u6211\u4eec\u4e5f\u77e5\u9053\u6570\u636e\u5305\u7684 VLAN \u5728\u5b83\u7684 802.1Q header \u4e0a\u3002<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-ofctl add-flow s1 \"table=4 reg0=1 actions=1\"\n<\/code><\/pre>\n<p>\u5bf9\u4e8e\u8981 output \u7684 port\uff0c\u8fd8\u9700\u8981\u628a VLAN header \u79fb\u9664\u6389\u3002<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-ofctl add-flow s1 \"table=4 reg0=2 actions=strip_vlan,2\"\nsh ovs-ofctl add-flow s1 \"table=4 reg0=3 actions=strip_vlan,3\"\nsh ovs-ofctl add-flow s1 \"table=4 reg0=4 actions=strip_vlan,4\"\n<\/code><\/pre>\n<p>flood \u5e7f\u64ad\u6216\u591a\u64ad\u5305<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-ofctl add-flow s1 \"table=4 reg0=0 priority=99 dl_vlan=20 actions=1,strip_vlan,2\"\nsh ovs-ofctl add-flow s1 \"table=4 reg0=0 priority=99 dl_vlan=30 actions=1,strip_vlan,3,4\"\nsh ovs-ofctl add-flow s1 \"table=4 reg0=0 priority=50            actions=1\"\n<\/code><\/pre>\n<h3>\u6d4b\u8bd5 table 4<\/h3>\n<p><strong>\u4f8b\u5b501\uff1a\u5e7f\u64ad\uff0c\u591a\u64ad\u4ee5\u53ca\u672a\u77e5\u76ee\u7684\u5730\u5740<\/strong><\/p>\n<p>\u6d4b\u8bd5\u5728 port 1 \u4e0a\u8fdb\u5165\u5e7f\u64ad\u5305\uff0cVLAN \u662f 30<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-appctl ofproto\/trace s1 in_port=1,dl_dst=ff:ff:ff:ff:ff:ff,dl_vlan=30\n\nFlow: in_port=1,dl_vlan=30,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=00:00:00:00:00:00,dl_dst=ff:ff:ff:ff:ff:ff,dl_type=0x0000\n\nbridge(\"s1\")\n------------\n 0. priority 0\n    resubmit(,1)\n 1. in_port=1, priority 99\n    resubmit(,2)\n 2. priority 32768\n    learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]-&gt;NXM_NX_REG0[0..15])\n     &gt;&gt; suppressing side effects, so learn action ignored\n    resubmit(,3)\n 3. priority 50\n    resubmit(,10)\n    10. No match.\n            drop\n    resubmit(,4)\n 4. reg0=0,dl_vlan=30, priority 99\n    output:1\n     &gt;&gt; skipping output to input port\n    strip_vlan\n    output:3\n    output:4\n\nFinal flow: in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=ff:ff:ff:ff:ff:ff,dl_type=0x0000\nMegaflow: recirc_id=0,eth,in_port=1,dl_vlan=30,dl_vlan_pcp=0,dl_src=00:00:00:00:00:00,dl_dst=ff:ff:ff:ff:ff:ff,dl_type=0x0000\nDatapath actions: pop_vlan,4,3\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u5230 <code>Datapath actions: pop_vlan,4,3<\/code>\uff0c\u6700\u7ec8\u6570\u636e\u5305\u88ab\u79fb\u9664 vlan\uff0c\u4ece port3\uff0c4\u51fa\u53bb\u4e86\u3002<\/p>\n<p>\u800c\u4e0b\u9762\u7684\u5e7f\u64ad\u5305\u90fd\u4f1a\u88ab drop\uff0c\u56e0\u4e3a VLAN \u5fc5\u987b\u5c5e\u4e8e input port<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-appctl ofproto\/trace s1 in_port=1,dl_dst=ff:ff:ff:ff:ff:ff\nsh ovs-appctl ofproto\/trace s1 in_port=1,dl_dst=ff:ff:ff:ff:ff:ff,dl_vlan=55\n<\/code><\/pre>\n<p><strong>\u4f8b\u5b502\uff1a MAC \u5b66\u4e60<\/strong><\/p>\n<p>VLAN 30\uff0c port 1 \u5b66\u4e60 MAC \u5730\u5740\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-appctl ofproto\/trace s1 in_port=1,dl_vlan=30,dl_src=10:00:00:00:00:01,dl_dst=20:00:00:00:00:01 -generate\n\nFlow: in_port=1,dl_vlan=30,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=10:00:00:00:00:01,dl_dst=20:00:00:00:00:01,dl_type=0x0000\n\nbridge(\"s1\")\n------------\n 0. priority 0\n    resubmit(,1)\n 1. in_port=1, priority 99\n    resubmit(,2)\n 2. priority 32768\n    learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]-&gt;NXM_NX_REG0[0..15])\n     -&gt; table=10 vlan_tci=0x001e\/0x0fff,dl_dst=10:00:00:00:00:01 priority=32768 actions=load:0x1-&gt;NXM_NX_REG0[0..15]\n    resubmit(,3)\n 3. priority 50\n    resubmit(,10)\n    10. No match.\n            drop\n    resubmit(,4)\n 4. reg0=0,dl_vlan=30, priority 99\n    output:1\n     &gt;&gt; skipping output to input port\n    strip_vlan\n    output:3\n    output:4\n\nFinal flow: in_port=1,vlan_tci=0x0000,dl_src=10:00:00:00:00:01,dl_dst=20:00:00:00:00:01,dl_type=0x0000\nMegaflow: recirc_id=0,eth,in_port=1,dl_vlan=30,dl_vlan_pcp=0,dl_src=10:00:00:00:00:01,dl_dst=20:00:00:00:00:01,dl_type=0x0000\nDatapath actions: pop_vlan,4,3\n<\/code><\/pre>\n<p>\u56e0\u4e3a\u76ee\u7684\u5730\u5740\u662f\u672a\u77e5\u7684\uff0c\u6240\u4ee5\u6570\u636e\u5305\u88ab flood \u5230 port3\uff0cport4 \u4e0a\u3002\u7136\u540e\u6211\u4eec\u518d\u6b21\u6d4b\u8bd5 MAC \u5730\u5740\u662f\u5426\u5b66\u4e60\u5230\u4e86\u3002<\/p>\n<pre><code class=\"language-bash line-numbers\">sh ovs-appctl ofproto\/trace s1 in_port=4,dl_src=20:00:00:00:00:01,dl_dst=10:00:00:00:00:01 -generate\n\nFlow: in_port=4,vlan_tci=0x0000,dl_src=20:00:00:00:00:01,dl_dst=10:00:00:00:00:01,dl_type=0x0000\n\nbridge(\"s1\")\n------------\n 0. priority 0\n    resubmit(,1)\n 1. in_port=4,vlan_tci=0x0000, priority 99\n    mod_vlan_vid:30\n    resubmit(,2)\n 2. priority 32768\n    learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]-&gt;NXM_NX_REG0[0..15])\n     -&gt; table=10 vlan_tci=0x001e\/0x0fff,dl_dst=20:00:00:00:00:01 priority=32768 actions=load:0x4-&gt;NXM_NX_REG0[0..15]\n    resubmit(,3)\n 3. priority 50\n    resubmit(,10)\n    10. vlan_tci=0x001e\/0x0fff,dl_dst=10:00:00:00:00:01, priority 32768\n            load:0x1-&gt;NXM_NX_REG0[0..15]\n    resubmit(,4)\n 4. reg0=0x1, priority 32768\n    output:1\n\nFinal flow: reg0=0x1,in_port=4,dl_vlan=30,dl_vlan_pcp=0,vlan_tci1=0x0000,dl_src=20:00:00:00:00:01,dl_dst=10:00:00:00:00:01,dl_type=0x0000\nMegaflow: recirc_id=0,eth,in_port=4,dl_src=20:00:00:00:00:01,dl_dst=10:00:00:00:00:01,dl_type=0x0000\nDatapath actions: push_vlan(vid=30,pcp=0),2\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>OpenFlow \u91cc\u6709\u4e00\u4e2a\u91cd\u8981\u7684\u6982\u5ff5\u2014\u6d41\u8868(FlowTable)\uff0c\u901a\u8fc7 Flow Table\uff0c\u6211\u4eec\u53ef\u4ee5\u5236\u5b9a\u4ea4\u6362 &hellip; <a href=\"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">OpenFlow \u7684\u6d41\u8868\u5339\u914d\u89c4\u5219<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[124],"class_list":["post-1353","post","type-post","status-publish","format-standard","hentry","category-network","tag-ovs"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>OpenFlow \u7684\u6d41\u8868\u5339\u914d\u89c4\u5219 - \u4e00\u53ea\u5b89\u9759\u7684\u732b<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"OpenFlow \u7684\u6d41\u8868\u5339\u914d\u89c4\u5219 - \u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"og:description\" content=\"OpenFlow \u91cc\u6709\u4e00\u4e2a\u91cd\u8981\u7684\u6982\u5ff5\u2014\u6d41\u8868(FlowTable)\uff0c\u901a\u8fc7 Flow Table\uff0c\u6211\u4eec\u53ef\u4ee5\u5236\u5b9a\u4ea4\u6362 &hellip; \u7ee7\u7eed\u9605\u8bfbOpenFlow \u7684\u6d41\u8868\u5339\u914d\u89c4\u5219\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/\" \/>\n<meta property=\"og:site_name\" content=\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-09T14:16:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-05T01:58:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.myway5.com\/wp-content\/uploads\/2023\/01\/openflow-flow.webp\" \/>\n<meta name=\"author\" content=\"jiangpengfei\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"jiangpengfei\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/\"},\"author\":{\"name\":\"jiangpengfei\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"headline\":\"OpenFlow \u7684\u6d41\u8868\u5339\u914d\u89c4\u5219\",\"datePublished\":\"2023-01-09T14:16:06+00:00\",\"dateModified\":\"2023-07-05T01:58:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/\"},\"wordCount\":222,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"image\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2023\/01\/openflow-flow.webp\",\"keywords\":[\"ovs\"],\"articleSection\":[\"\u7f51\u7edc\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/\",\"url\":\"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/\",\"name\":\"OpenFlow \u7684\u6d41\u8868\u5339\u914d\u89c4\u5219 - \u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2023\/01\/openflow-flow.webp\",\"datePublished\":\"2023-01-09T14:16:06+00:00\",\"dateModified\":\"2023-07-05T01:58:57+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/#primaryimage\",\"url\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2023\/01\/openflow-flow.webp\",\"contentUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2023\/01\/openflow-flow.webp\",\"width\":700,\"height\":402},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.myway5.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"OpenFlow \u7684\u6d41\u8868\u5339\u914d\u89c4\u5219\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.myway5.com\/#website\",\"url\":\"https:\/\/www.myway5.com\/\",\"name\":\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"description\":\"\u60f3\u5565\u5462\",\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.myway5.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\",\"name\":\"jiangpengfei\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"caption\":\"jiangpengfei\"},\"logo\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.myway5.com\/index.php\/author\/joyme\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"OpenFlow \u7684\u6d41\u8868\u5339\u914d\u89c4\u5219 - \u4e00\u53ea\u5b89\u9759\u7684\u732b","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":"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/","og_locale":"zh_CN","og_type":"article","og_title":"OpenFlow \u7684\u6d41\u8868\u5339\u914d\u89c4\u5219 - \u4e00\u53ea\u5b89\u9759\u7684\u732b","og_description":"OpenFlow \u91cc\u6709\u4e00\u4e2a\u91cd\u8981\u7684\u6982\u5ff5\u2014\u6d41\u8868(FlowTable)\uff0c\u901a\u8fc7 Flow Table\uff0c\u6211\u4eec\u53ef\u4ee5\u5236\u5b9a\u4ea4\u6362 &hellip; \u7ee7\u7eed\u9605\u8bfbOpenFlow \u7684\u6d41\u8868\u5339\u914d\u89c4\u5219","og_url":"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/","og_site_name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","article_published_time":"2023-01-09T14:16:06+00:00","article_modified_time":"2023-07-05T01:58:57+00:00","og_image":[{"url":"https:\/\/www.myway5.com\/wp-content\/uploads\/2023\/01\/openflow-flow.webp","type":"","width":"","height":""}],"author":"jiangpengfei","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"jiangpengfei","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"8 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/#article","isPartOf":{"@id":"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/"},"author":{"name":"jiangpengfei","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"headline":"OpenFlow \u7684\u6d41\u8868\u5339\u914d\u89c4\u5219","datePublished":"2023-01-09T14:16:06+00:00","dateModified":"2023-07-05T01:58:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/"},"wordCount":222,"commentCount":0,"publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"image":{"@id":"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/#primaryimage"},"thumbnailUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2023\/01\/openflow-flow.webp","keywords":["ovs"],"articleSection":["\u7f51\u7edc"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/","url":"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/","name":"OpenFlow \u7684\u6d41\u8868\u5339\u914d\u89c4\u5219 - \u4e00\u53ea\u5b89\u9759\u7684\u732b","isPartOf":{"@id":"https:\/\/www.myway5.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/#primaryimage"},"image":{"@id":"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/#primaryimage"},"thumbnailUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2023\/01\/openflow-flow.webp","datePublished":"2023-01-09T14:16:06+00:00","dateModified":"2023-07-05T01:58:57+00:00","breadcrumb":{"@id":"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/#primaryimage","url":"https:\/\/www.myway5.com\/wp-content\/uploads\/2023\/01\/openflow-flow.webp","contentUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2023\/01\/openflow-flow.webp","width":700,"height":402},{"@type":"BreadcrumbList","@id":"https:\/\/www.myway5.com\/index.php\/2023\/01\/09\/openflow-match-rule\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.myway5.com\/"},{"@type":"ListItem","position":2,"name":"OpenFlow \u7684\u6d41\u8868\u5339\u914d\u89c4\u5219"}]},{"@type":"WebSite","@id":"https:\/\/www.myway5.com\/#website","url":"https:\/\/www.myway5.com\/","name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","description":"\u60f3\u5565\u5462","publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.myway5.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685","name":"jiangpengfei","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","caption":"jiangpengfei"},"logo":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/"},"url":"https:\/\/www.myway5.com\/index.php\/author\/joyme\/"}]}},"views":8314,"_links":{"self":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/1353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/comments?post=1353"}],"version-history":[{"count":1,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/1353\/revisions"}],"predecessor-version":[{"id":1354,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/1353\/revisions\/1354"}],"wp:attachment":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/media?parent=1353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/categories?post=1353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/tags?post=1353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}