ÉîÈëÀí½â Neutron -- OpenStack ÍøÂçʵÏÖ£¨3£©£ºVXLAN
ģʽ
VXLAN ģʽÏ£¬ÍøÂçµÄ¼Ü¹¹¸ú GRE ģʽÀàËÆ£¬Ëù²»Í¬µÄÊÇ£¬²»Í¬½ÚµãÖ®¼äͨ¹ý
VXLAN ËíµÀ»¥Í¨£¬¼´ÐéÄ⻯²ãÊDzÉÓÃµÄ VXLAN ÐÒé¡£
»ù±¾½á¹¹ÈçÏÂͼËùʾ¡£

ÆäÖУ¬½ÚµãÍøÂçÅäÖÃÈçÏÂËùʾ£¬×¢ÒâÊý¾ÝÍøÂç½Ó¿ÚÐèÒª IP µØÖ·£¬ÒòΪÊÇËíµÀÐÒéÐèÒªµ×ϵÄÈý²ãת·¢Ö§³Ö¡£
1¡¢¿ØÖƽڵã
eth0: 9.186.100.77/24 ×÷Ϊ¹ÜÀíÍøÂ磨ͬʱҲÊǹ«¹²ÍøÂ磩¡£
eth1: 10.0.100.77/24 ×÷ΪÊý¾ÝÍøÂç½Ó¿Ú¡£
2¡¢¼ÆËã½Úµã
eth0: 9.186.100.88/24 ×÷Ϊ¹ÜÀíÍøÂ磨ͬʱҲÊǹ«¹²ÍøÂ磩¡£
eth1: 10.0.100.88/24 ×÷ΪÊý¾ÝÍøÂç½Ó¿Ú¡£
¼ÆËã½Úµã
¼ÆËã½ÚµãÉÏÔËÐÐ×ÅÐéÄâ»ú¡£Èç¹û²»ÆôÓà DVR ÌØÐÔ£¬ÔòËùÓеÄÍøÂçÏà¹ØµÄ·þÎñ£¬¶¼ÔÚÍøÂç½ÚµãÉϽøÐС£¼´¼ÆËã½ÚµãÉϵÄÍøÂçÖ»ÐèҪʵÏÖ¶þ²ãת·¢¼´¿É¡£
br-int
¼¯³ÉÍøÇÅ br-int ¹æÔò±È½Ï¼òµ¥£¬×÷Ϊһ¸öÕý³£µÄ¶þ²ã½»»»»úʹÓá£ÎÞÂÛÏÂÃæÐéÄ⻯²ãÊÇÄÄÖÖ¼¼ÊõʵÏÖ£¬¼¯³ÉÍøÇÅÊÇ¿´²»µ½µÄ£¬Ö»ÖªµÀ¸ù¾Ý
vlan ºÍ mac ½øÐÐת·¢¡£
ËùÁ¬½Ó½Ó¿Ú³ýÁË´Ó°²È«ÍøÇŹýÀ´µÄ qvo-xxx£¨Ã¿¸öÐéÄâ»ú»áÓÐÒ»¸ö£©£¬¾ÍÊÇÒ»¸öÍùÍâµÄ patch-tun
½Ó¿Ú£¬Á¬½Óµ½ br-tun ÍøÇÅ¡£
ÆäÖУ¬qvo-xxx ½Ó¿ÚÉÏ»áΪÿ¸öÍøÂç·ÖÅäÒ»¸öÄÚ²¿ vlan ºÅ£¬±ÈÈçÕâÀïÊÇͬһ¸öÍøÂçÆô¶¯ÁËÁ½Ì¨Ðé»ú£¬ËùÒÔ
tag ¶¼Îª 1¡£
Bridge br-int fail_mode: secure Port br-int Interface br-int type: internal Port "qvoc4493802-43" tag: 1 Interface "qvoc4493802-43" Port patch-tun Interface patch-tun type: patch options: {peer=patch-int} Port "qvof47c62b0-db" tag: 1 Interface "qvof47c62b0-db" |
ת·¢¹æÔò±í 0 ÖÐÊǶÔËùÓаü½øÐÐ NORMAL£¬±í 23 ÖÐÊÇËùÓаüÖ±½Ó¶ªÆú£¨ÊÇ·ñºóÃæ½«°²È«×鹿ÔòÔÚÕâÀïʵÏÖ£¿£©¡£
$ sudo ovs-ofctl dump-flows br-int NXST_FLOW reply (xid=0x4): cookie=0x0, duration=52889.682s, table=0, n_packets=161, n_bytes=39290, idle_age=13, priority=1 actions=NORMAL cookie=0x0, duration=52889.451s, table=23, n_packets=0, n_bytes=0, idle_age=52889, priority=0 actions=drop |
br-tun
br-tun ×÷ΪÐéÄ⻯²ãÍøÇÅ£¬¹æÔò¾ÍÒª¸´ÔÓһЩ¡£ Òª½«ÄÚ²¿¹ýÀ´µÄÍø°ü½øÐкÏÀíÕç±ð£¬ÄÚ²¿´ø×ÅÕýÈ· vlan
tag ¹ýÀ´µÄ£¬´ÓÕýÈ·µÄ tunnel ÈÓ³öÈ¥£»ÍâÃæ´ø×ÅÕýÈ· tunnel ºÅ¹ýÀ´µÄ£¬Òª¸Äµ½¶ÔÓ¦µÄÄÚ²¿
vlan tag ÈÓµ½ÀïÃæ¡£
Bridge br-tun fail_mode: secure Port "vxlan-0a00644d" Interface "vxlan-0a00644d" type: vxlan options: {df_default="true", in_key=flow, local_ip="10.0.100.88", out_key=flow, remote_ip="10.0.100.77"} Port patch-int Interface patch-int type: patch options: {peer=patch-tun} Port br-tun Interface br-tun type: internal |
ÆäÖУ¬¶Ë¿Ú br-tun ÊÇÄÚ²¿¶Ë¿Ú£¬vxlan-0a00644d ÕâÑùµÄ¶Ë¿ÚÊÇÏòÆäËü½Úµã·¢°üʱºòµÄ
VXLAN ËíµÀ¶Ëµã£¬patch-int ¶Ë¿Úͨ¹ýÒ»Ìõ¹ÜµÀÁ¬½Óµ½ br-int É쵀 patch-tun
¶Ë¿Ú¡£
Õý³£Çé¿öÏ£¬ÐéÄâ»úµÄÁ÷Á¿¾¹ý br-int ת·¢£¬¾¹ý patch-tun ¶Ë¿Ú£¬µÖ´ï patch-int
¶Ë¿Ú£¬´Ó¶øµ½´ï br-tun ÍøÇÅ£¬¸ÃÍøÇŸù¾Ý×ÔÉí¹æÔò½«ºÏÊʵÄÍø°ü¾¹ý VXLAN ËíµÀËͳöÈ¥¡£
$ sudo ovs-ofctl dump-flows br-tun NXST_FLOW reply (xid=0x4): cookie=0x0, duration=329.194s, table=0, n_packets=31, n_bytes=2906, idle_age=29, priority=1,in_port=1 actions=resubmit(,2) cookie=0x0, duration=325.847s, table=0, n_packets=14, n_bytes=1591, idle_age=33, priority=1,in_port=2 actions=resubmit(,4) cookie=0x0, duration=328.954s, table=0, n_packets=6, n_bytes=480, idle_age=321, priority=0 actions=drop cookie=0x0, duration=328.712s, table=2, n_packets=9, n_bytes=694, idle_age=33,
priority=0,dl_dst=00:00:00:00:00:00/01:00:00:00:00:00 actions=resubmit(,20) cookie=0x0, duration=328.465s, table=2, n_packets=22, n_bytes=2212,
idle_age=29, priority=0,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00 actions=resubmit(,22) cookie=0x0, duration=328.223s, table=3, n_packets=0, n_bytes=0, idle_age=328, priority=0 actions=drop cookie=0x0, duration=50.703s, table=4, n_packets=12, n_bytes=1451, idle_age=33,
priority=1,tun_id=0x3e9 actions=mod_vlan_vid:1,resubmit(,10) cookie=0x0, duration=327.979s, table=4, n_packets=2, n_bytes=140, idle_age=94, priority=0 actions=drop cookie=0x0, duration=327.742s, table=10, n_packets=12, n_bytes=1451,
idle_age=33, priority=1 actions=learn(table=20,hard_timeout=300,
priority=1,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],
load:0->NXM_OF_VLAN_TCI[],load:NXM_NX_TUN_ID[]->NXM_NX_TUN_ID[],
output:NXM_OF_IN_PORT[]),output:1 cookie=0x0, duration=38.551s, table=20, n_packets=9, n_bytes=694, hard_timeout=300,
idle_age=33, hard_age=33, priority=1,vlan_tci=0x0001/0x0fff,
dl_dst=fa:16:3e:83:95:fa actions=load:0->NXM_OF_VLAN_TCI[],load:0x3e9->NXM_NX_TUN_ID[],output:2 cookie=0x0, duration=327.504s, table=20, n_packets=0, n_bytes=0, idle_age=327,
priority=0 actions=resubmit(,22) cookie=0x0, duration=50.94s, table=22, n_packets=11, n_bytes=1334,
idle_age=29, dl_vlan=1 actions=strip_vlan,set_tunnel:0x3e9,output:2 cookie=0x0, duration=327.261s, table=22, n_packets=10, n_bytes=808, idle_age=51, priority=0 actions=drop |
ÕâЩ¹æÔò×é³ÉÈçÏÂͼËùʾµÄת·¢Âß¼¡£

±í 1
ÏÈ¿´ table0 ÖеĹæÔò
cookie=0x0, duration=329.194s, table=0, n_packets=31, n_bytes=2906, idle_age=29, priority=1,in_port=1 actions=resubmit(,2) cookie=0x0, duration=325.847s, table=0, n_packets=14, n_bytes=1591, idle_age=33, priority=1,in_port=2 actions=resubmit(,4) cookie=0x0, duration=328.954s, table=0, n_packets=6, n_bytes=480, idle_age=321, priority=0 actions=drop |
´Ó 1 ¶Ë¿Ú£¨patch-int£©½øÀ´µÄÍø°ü£¬ÈÓ¸ø±í 2 ´¦Àí£¬´Ó 2 ¶Ë¿Ú£¨vxlan-0a00644d£©½øÀ´µÄÍø°ü£¬ÈÓ¸ø±í
4 ´¦Àí¡£¼´Ò»¸ö´¦ÀíÀ´×ÔÄÚ²¿ vm µÄ£¬Ò»¸ö´¦ÀíÀ´×ÔÍâÃæµÄ vxlan ËíµÀµÄ¡£
±í 2
¶ÔÓÚÄÚ²¿°ü£¬±í 2 ÖйæÔòΪ
cookie=0x0, duration=53316.397s, table=2, n_packets=0, n_bytes=0, idle_age=53316,
priority=0,dl_dst=00:00:00:00:00:00/01:00:00:00:00:00 actions=resubmit(,20) cookie=0x0, duration=53316.162s, table=2, n_packets=161, n_bytes=39562, idle_age=422,
priority=0,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00 actions=resubmit(,22) |
¼´ÀïÃæ¹ýÀ´µÄµ¥²¥°ü£¬ÈÓ¸ø±í 20 ´¦Àí£»¶à²¥ºÍ¹ã²¥°ü£¬ÈÓ¸ø±í 22 ´¦Àí¡£
±í 3
¶ªÆúËùÓаü¡£
cookie=0x0, duration=328.223s, table=3, n_packets=0, n_bytes=0, idle_age=328, priority=0 actions=drop |
±í 4
¶ÔÓÚÍⲿÀ´µÄÊý¾Ý£¬±í 4 ÖйæÔòΪ
cookie=0x0, duration=50.703s, table=4, n_packets=12, n_bytes=1451, idle_age=33,
priority=1,tun_id=0x3e9 actions=mod_vlan_vid:1,resubmit(,10) cookie=0x0, duration=327.979s, table=4, n_packets=2, n_bytes=140, idle_age=94, priority=0 actions=drop |
Æ¥Å䏸¶¨µÄ tunnel ºÅ£¬Ìí¼Ó¶ÔÓ¦µÄ vlan ºÅ£¬ÈÓ¸ø±í 10 ȥѧϰһϺóÈÓµ½ br-int
ÍøÇÅ¡£
±í 10
cookie=0x0, duration=327.742s, table=10, n_packets=12, n_bytes=1451, idle_age=33,
priority=1 actions=learn(table=20,hard_timeout=300,priority=1,
NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],
load:0->NXM_OF_VLAN_TCI[],load:NXM_NX_TUN_ID[]->NXM_NX_TUN_ID[],
output:NXM_OF_IN_PORT[]),output:1 |
Ö÷Òª×÷ÓÃÊÇѧϰÍⲿ£¨´Ó tunnel£©½øÀ´µÄ°ü£¬Íù±í 20 ÖÐÌí¼Ó¶Ô·µ³Ì°üµÄÕý³£×ª·¢¹æÔò£¬²¢ÇÒ´Ó patch-int
ÈÓ¸ø br-int¡£
ʹÓÃÁË openvswitch µÄ learn ¶¯×÷¡£¸Ã¶¯×÷Äܸù¾Ý´¦ÀíµÄÁ÷À´¶¯Ì¬ÐÞ¸ÄÆäËü±íÖеĹæÔò¡£
¾ßÌåÀ´¿´ learn ¹æÔò¡£
table=20 ˵Ã÷ÊÇÐ޸ıí 20 ÖеĹæÔò£¬ºóÃæÊÇÌí¼ÓµÄ¹æÔòÄÚÈÝ£»
NXM_OF_VLAN_TCI[0..11]£¬Æ¥Åä¸úµ±Ç°Á÷ͬÑùµÄ VLAN Í·£¬ÆäÖÐ NXM ÊÇ Nicira
Extensible Match µÄËõд£»
NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[]£¬°üµÄÄ¿µÄ mac ¸úµ±Ç°Á÷µÄÔ´ mac
Æ¥Å䣻
load:0->NXM_OF_VLAN_TCI[]£¬½« vlan ºÅ¸ÄΪ 0£»
load:NXM_NX_TUN_ID[]->NXM_NX_TUN_ID[]£¬½« tunnel ºÅÐÞ¸ÄΪµ±Ç°µÄ
tunnel ºÅ£»
output:NXM_OF_IN_PORT[]£¬´Óµ±Ç°Èë¿Ú·¢³ö¡£
±í 20
cookie=0x0, duration=38.551s, table=20, n_packets=9, n_bytes=694, hard_timeout=300, idle_age=33,
hard_age=33, priority=1,vlan_tci=0x0001/0x0fff,
dl_dst=fa:16:3e:83:95:fa actions=load:0->NXM_OF_VLAN_TCI[],load:0x3e9->NXM_NX_TUN_ID[],output:2 cookie=0x0, duration=327.504s, table=20, n_packets=0, n_bytes=0, idle_age=327, priority=0 actions=resubmit(,22) |
ÆäÖУ¬µÚÒ»Ìõ¹æÔò¾ÍÊDZí 10 ѧϰÀ´µÄ½á¹û¡£¶ÔÓÚ vlan ºÅΪ 1£¬Ä¿±ê mac ÊÇ fa:16:3e:83:95:fa£¨Ö®Ç°£¬ÎÒÃÇ´ÓÐéÄâ»úÄÚ
ping 10.0.0.1£¬Õâ¸ö mac ×÷ΪԴ mac ´Ó tunnel À´¹ý£©µÄÍø°ü£¬È¥µô vlan
ºÅ£¬Ìí¼Óµ±Ê±µÄ vxlan ºÅ£¬²¢´Ó tunnel ·¢³ö¡£
¶ÔÓÚûѧϰµ½¹æÔòµÄÍø°ü£¬ÔòÈÓ¸ø±í 22 ´¦Àí¡£
±í 22
cookie=0x0, duration=50.94s, table=22, n_packets=11, n_bytes=1334, idle_age=29,
dl_vlan=1 actions=strip_vlan,set_tunnel:0x3e9,output:2 cookie=0x0, duration=327.261s, table=22, n_packets=10, n_bytes=808,
idle_age=51, priority=0 actions=drop |
±í 22 ¼ì²éÈç¹û vlan ºÅÕýÈ·£¬ÔòÈ¥µô vlan Í·ºó´Ó tunnel ÈÓ³öÈ¥¡£
ÍøÂç½Úµã
ÍøÂç½Úµãµ£¸º×ŽøÐÐÍøÂç·þÎñµÄÈÎÎñ£¬°üÀ¨DHCP¡¢Â·Óɺ͸߼¶ÍøÂç·þÎñµÈ¡£Ò»°ã°üÀ¨Èý¸öÍøÇÅ£ºbr-tun¡¢br-int
ºÍ br-ex¡£
$ sudo ovs-vsctl show 49761e8e-031f-4a60-b838-28bb82aac7b7 Bridge br-int fail_mode: secure Port br-int Interface br-int type: internal Port "qr-694450d6-f6" tag: 1 Interface "qr-694450d6-f6" type: internal Port "tap13685e28-b0" tag: 1 Interface "tap13685e28-b0" type: internal Port patch-tun Interface patch-tun type: patch options: {peer=patch-int} Bridge br-ex Port br-ex Interface br-ex type: internal Port "qg-e76de35e-90" Interface "qg-e76de35e-90" type: internal Bridge br-tun fail_mode: secure Port br-tun Interface br-tun type: internal Port "vxlan-0a006458" Interface "vxlan-0a006458" type: vxlan options: {df_default="true", in_key=flow, local_ip="10.0.100.77", out_key=flow, remote_ip="10.0.100.88"} Port patch-int Interface patch-int type: patch options: {peer=patch-tun} ovs_version: "2.0.2" |
br-tun
¸ú¼ÆËã½ÚµãÀàËÆ£¬br-tun ×÷ΪÐéÄ⻯²ãÍøÇÅ¡£ Òª½«ÄÚ²¿¹ýÀ´µÄÍø°ü½øÐкÏÀíÕç±ð£¬ÄÚ²¿´ø×ÅÕýÈ· vlan
tag ¹ýÀ´µÄ£¬´ÓÕýÈ·µÄ tunnel ÈÓ³öÈ¥£»ÍâÃæ´ø×ÅÕýÈ· tunnel ºÅ¹ýÀ´µÄ£¬Òª¸Äµ½¶ÔÓ¦µÄÄÚ²¿
vlan tag ÈÓµ½ÀïÃæ¡£
°üÀ¨Á½¸ö½Ó¿Ú£¬¸úÆäËü½ÓµãÐÎ³É tunnel µÄ vxlan-xxx ¶Ë¿Ú£¬ÒÔ¼°¸ú br-int »¥Á¬µÄ
patch-int ¶Ë¿Ú¡£
Bridge br-tun fail_mode: secure Port br-tun Interface br-tun type: internal Port "vxlan-0a006458" Interface "vxlan-0a006458" type: vxlan options: {df_default="true", in_key=flow, local_ip="10.0.100.77", out_key=flow, remote_ip="10.0.100.88"} Port patch-int Interface patch-int type: patch options: {peer=patch-tun} |
ÆäÖУ¬¶Ë¿Ú br-tun ÊÇÄÚ²¿¶Ë¿Ú£¬vxlan-0a00644d ÕâÑùµÄ¶Ë¿ÚÊÇÏòÆäËü½Úµã·¢°üʱºòµÄ
VXLAN ËíµÀ¶Ëµã£¬patch-int ¶Ë¿Úͨ¹ýÒ»Ìõ¹ÜµÀÁ¬½Óµ½ br-int É쵀 patch-tun
¶Ë¿Ú¡£
²é¿´ br-tun ÉϵÄת·¢¹æÔò¡£
$ sudo ovs-ofctl dump-flows br-tun NXST_FLOW reply (xid=0x4): cookie=0x0, duration=422.153s, table=0, n_packets=1073, n_bytes=107845,
idle_age=96, priority=1,in_port=1 actions=resubmit(,2) cookie=0x0, duration=185.009s, table=0, n_packets=1076, n_bytes=102922,
idle_age=96, priority=1,in_port=2 actions=resubmit(,4) cookie=0x0, duration=421.853s, table=0, n_packets=6, n_bytes=480, idle_age=62414, priority=0 actions=drop cookie=0x0, duration=421.552s, table=2, n_packets=1047, n_bytes=105725,
idle_age=96, priority=0,dl_dst=00:00:00:00:00:00/01:00:00:00:00:00 actions=resubmit(,20) cookie=0x0, duration=421.252s, table=2, n_packets=26, n_bytes=2120,
idle_age=61953, priority=0,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00 actions=resubmit(,22) cookie=0x0, duration=420.939s, table=3, n_packets=0, n_bytes=0, idle_age=62420, priority=0 actions=drop cookie=0x0, duration=394.249s, table=4, n_packets=1076, n_bytes=102922,
idle_age=96, priority=1,tun_id=0x3e9 actions=mod_vlan_vid:1,resubmit(,10) cookie=0x0, duration=420.628s, table=4, n_packets=0, n_bytes=0, idle_age=62420, priority=0 actions=drop cookie=0x0, duration=420.304s, table=10, n_packets=1076, n_bytes=102922,
idle_age=96, priority=1 actions=learn(table=20,hard_timeout=300,
priority=1,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:0->NXM_OF_VLAN_TCI[],
load:NXM_NX_TUN_ID[]->NXM_NX_TUN_ID[],output:NXM_OF_IN_PORT[]),output:1 cookie=0x0, duration=1314.149s, table=20, n_packets=1006, n_bytes=101338,
hard_timeout=300, idle_age=96, hard_age=95, priority=1,vlan_tci=0x0001/0x0fff,
dl_dst=fa:16:3e:52:7a:f2 actions=load:0->NXM_OF_VLAN_TCI[],load:0x3e9->NXM_NX_TUN_ID[],output:2 cookie=0x0, duration=419.977s, table=20, n_packets=0, n_bytes=0, idle_age=62419, priority=0 actions=resubmit(,22) cookie=0x0, duration=184.683s, table=22, n_packets=3, n_bytes=230, idle_age=61953,
dl_vlan=1 actions=strip_vlan,set_tunnel:0x3e9,output:2 cookie=0x0, duration=419.668s, table=22, n_packets=23, n_bytes=1890, idle_age=61961, priority=0 actions=drop |
ÕâЩ¹æÔò¸ú¼ÆËã½ÚµãÉ쵀 br-tun ÍøÇŹæÔòÀàËÆ£¬×é³ÉÈçÏÂͼËùʾµÄת·¢Âß¼¡£

±í 0
ÏÈ¿´ table0 ÖеĹæÔò
cookie=0x0, duration=422.153s, table=0, n_packets=1073, n_bytes=107845, idle_age=96, priority=1,in_port=1 actions=resubmit(,2) cookie=0x0, duration=185.009s, table=0, n_packets=1076, n_bytes=102922, idle_age=96, priority=1,in_port=2 actions=resubmit(,4) cookie=0x0, duration=421.853s, table=0, n_packets=6, n_bytes=480, idle_age=62414, priority=0 actions=drop |
´Ó 1 ¶Ë¿Ú£¨patch-int£©½øÀ´µÄÍø°ü£¬ÈÓ¸ø±í 2 ´¦Àí£¬´Ó 2 ¶Ë¿Ú£¨vxlan-0a00644d£©½øÀ´µÄÍø°ü£¬ÈÓ¸ø±í
4 ´¦Àí¡£¼´Ò»¸ö´¦ÀíÀ´×ÔÄÚ²¿ br-int µÄ£¨ÕâÉÏÃæ¹ÒÔØ×ÅËùÓеÄÍøÂç·þÎñ£¬°üÀ¨Â·ÓÉ¡¢DHCP µÈ£©£¬Ò»¸ö´¦ÀíÀ´×ÔÍâÃæµÄ
VXLAN ËíµÀµÄ¡£
±í 2
¶ÔÓÚÄÚ²¿°ü£¬±í 2 ÖйæÔòΪ
cookie=0x0, duration=421.552s, table=2, n_packets=1047, n_bytes=105725, idle_age=96,
priority=0,dl_dst=00:00:00:00:00:00/01:00:00:00:00:00 actions=resubmit(,20) cookie=0x0, duration=421.252s, table=2, n_packets=26, n_bytes=2120, idle_age=61953,
priority=0,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00 actions=resubmit(,22) |
¼´ÀïÃæ¹ýÀ´µÄµ¥²¥°ü£¬ÈÓ¸ø±í 20 ´¦Àí£»¶à²¥ºÍ¹ã²¥°ü£¬ÈÓ¸ø±í 22 ´¦Àí¡£
±í 3
¶ªÆúËùÓаü¡£
cookie=0x0, duration=420.939s, table=3, n_packets=0, n_bytes=0, idle_age=62420, priority=0 actions=drop |
±í 4
¶ÔÓÚÍⲿÀ´µÄÊý¾Ý£¬±í 4 ÖйæÔòΪ
cookie=0x0, duration=394.249s, table=4, n_packets=1076, n_bytes=102922, idle_age=96,
priority=1,tun_id=0x3e9 actions=mod_vlan_vid:1,resubmit(,10) cookie=0x0, duration=420.628s, table=4, n_packets=0, n_bytes=0, idle_age=62420, priority=0 actions=drop |
Æ¥Å䏸¶¨µÄ tunnel ºÅ£¬Ìí¼Ó¶ÔÓ¦µÄ vlan ºÅ£¬ÈÓ¸ø±í 10 ȥѧϰһϺóÈÓµ½ br-int
ÍøÇÅ¡£
±í 10
cookie=0x0, duration=420.304s, table=10, n_packets=1076, n_bytes=102922, idle_age=96,
priority=1 actions=learn(table=20,hard_timeout=300,
priority=1,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:0->NXM_OF_VLAN_TCI[],
load:NXM_NX_TUN_ID[]->NXM_NX_TUN_ID[],output:NXM_OF_IN_PORT[]),output:1 |
Ö÷Òª×÷ÓÃÊÇѧϰÍⲿ£¨´Ó tunnel£©½øÀ´µÄ°ü£¬Íù±í 20 ÖÐÌí¼Ó¶Ô·µ³Ì°üµÄÕý³£×ª·¢¹æÔò£¬²¢ÇÒ´Ó patch-int
ÈÓ¸ø br-int¡£
ʹÓÃÁË openvswitch µÄ learn ¶¯×÷¡£¸Ã¶¯×÷Äܸù¾Ý´¦ÀíµÄÁ÷À´¶¯Ì¬ÐÞ¸ÄÆäËü±íÖеĹæÔò¡£
¾ßÌåÀ´¿´ learn ¹æÔò¡£
table=20 ˵Ã÷ÊÇÐ޸ıí 20 ÖеĹæÔò£¬ºóÃæÊÇÌí¼ÓµÄ¹æÔòÄÚÈÝ£»
NXM_OF_VLAN_TCI[0..11]£¬Æ¥Åä¸úµ±Ç°Á÷ͬÑùµÄ VLAN Í·£¬ÆäÖÐ NXM ÊÇ Nicira
Extensible Match µÄËõд£»
NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[]£¬°üµÄÄ¿µÄ mac ¸úµ±Ç°Á÷µÄÔ´ mac
Æ¥Å䣻
load:0->NXM_OF_VLAN_TCI[]£¬½« vlan ºÅ¸ÄΪ 0£»
load:NXM_NX_TUN_ID[]->NXM_NX_TUN_ID[]£¬½« tunnel ºÅÐÞ¸ÄΪµ±Ç°µÄ
tunnel ºÅ£»
output:NXM_OF_IN_PORT[]£¬´Óµ±Ç°Èë¿Ú·¢³ö¡£
±í 20
cookie=0x0, duration=1314.149s, table=20, n_packets=1006, n_bytes=101338, hard_timeout=300, idle_age=96,
hard_age=95, priority=1,vlan_tci=0x0001/0x0fff,
dl_dst=fa:16:3e:52:7a:f2 actions=load:0->NXM_OF_VLAN_TCI[],load:0x3e9->NXM_NX_TUN_ID[],output:2 cookie=0x0, duration=419.977s, table=20, n_packets=0, n_bytes=0, idle_age=62419, priority=0 actions=resubmit(,22) |
ÆäÖУ¬µÚÒ»Ìõ¹æÔò¾ÍÊDZí 10 ѧϰÀ´µÄ½á¹û¡£¶ÔÓÚ vlan ºÅΪ 1£¬Ä¿±ê mac ÊÇ fa:16:3e:83:95:fa£¨Ö®Ç°£¬ÎÒÃÇ´ÓÐéÄâ»úÄÚ
ping 10.0.0.1£¬Õâ¸ö mac ×÷ΪԴ mac ´Ó tunnel À´¹ý£©µÄÍø°ü£¬È¥µô vlan
ºÅ£¬Ìí¼Óµ±Ê±µÄ vxlan ºÅ£¬²¢´Ó tunnel ·¢³ö¡£
¶ÔÓÚûѧϰµ½¹æÔòµÄÍø°ü£¬ÔòÈÓ¸ø±í 22 ´¦Àí¡£
±í 22
cookie=0x0, duration=184.683s, table=22, n_packets=3, n_bytes=230, idle_age=61953,
dl_vlan=1 actions=strip_vlan,set_tunnel:0x3e9,output:2 cookie=0x0, duration=419.668s, table=22, n_packets=23, n_bytes=1890, idle_age=61961, priority=0 actions=drop |
±í 22 ¼ì²éÈç¹û vlan ºÅÕýÈ·£¬ÔòÈ¥µô vlan Í·ºó´Ó tunnel ÈÓ³öÈ¥¡£
br-int
¼¯³ÉÍøÇÅ br-int ¹æÔò±È½Ï¼òµ¥£¬×÷Ϊһ¸öÕý³£µÄ¶þ²ã½»»»»úʹÓá£ÎÞÂÛÏÂÃæÐéÄ⻯²ãÊÇÄÄÖÖ¼¼ÊõʵÏÖ£¬¼¯³ÉÍøÇÅÊÇ¿´²»µ½µÄ£¬Ö»ÖªµÀ¸ù¾Ý
vlan ºÍ mac ½øÐÐת·¢¡£
ËùÁ¬½Ó½Ó¿Ú°üÀ¨£º
tap-xxx£¬Á¬½Óµ½ÍøÂç DHCP ·þÎñµÄÃüÃû¿Õ¼ä£»
qr-xxx£¬Á¬½Óµ½Â·ÓÉ·þÎñµÄÃüÃû¿Õ¼ä£»
ÍùÍâµÄ patch-tun ½Ó¿Ú£¬Á¬½Óµ½ br-tun ÍøÇÅ¡£
ÆäÖÐÍøÂç·þÎñ½Ó¿ÚÉÏ»á°ó¶¨ÄÚ²¿ vlan ºÅ£¬Ã¿¸öºÅ¶ÔÓ¦Ò»¸öÍøÂç¡£
Bridge br-int fail_mode: secure Port br-int Interface br-int type: internal Port "qr-694450d6-f6" tag: 1 Interface "qr-694450d6-f6" type: internal Port "tap13685e28-b0" tag: 1 Interface "tap13685e28-b0" type: internal Port patch-tun Interface patch-tun type: patch options: {peer=patch-int} |
ת·¢¹æÔò±í 0 ÖÐÊǶÔËùÓаü½øÐÐ NORMAL£¬±í 23 ÖÐÊÇËùÓаüÖ±½Ó¶ªÆú£¨ÊÇ·ñºóÃæ½«°²È«×鹿ÔòÔÚÕâÀïʵÏÖ£¿£©¡£
$ sudo ovs-ofctl dump-flows br-int NXST_FLOW reply (xid=0x4): cookie=0x0, duration=52889.682s, table=0, n_packets=161, n_bytes=39290, idle_age=13, priority=1 actions=NORMAL cookie=0x0, duration=52889.451s, table=23, n_packets=0, n_bytes=0, idle_age=52889, priority=0 actions=drop |
br-ex
ºËÐĽӿÚÓÐÁ½¸ö¡£
Ò»¸öÊǹÒÔØµÄÎïÀí½Ó¿ÚÉÏ£¬Èç eth0£¬Íø°ü½«´ÓÕâ¸ö½Ó¿Ú·¢Ë͵½Íâ²¿ÍøÂçÉÏ¡£
ÁíÍâÒ»¸öÊÇ qg-xxx ÕâÑùµÄ½Ó¿Ú£¬ÊÇÁ¬½Óµ½ router ·þÎñµÄÍøÂçÃû×Ö¿Õ¼äÖУ¬ÀïÃæ°ó¶¨Ò»¸ö·ÓÉÆ÷µÄÍⲿ
IP£¬×÷Ϊ nAT ʱºòµÄµØÖ·£¬ÁíÍâ£¬ÍøÂçÖÐµÄ floating IP Ò²·ÅÔÚÕâ¸öÍøÂçÃû×Ö¿Õ¼äÖС£
Bridge br-ex Port "eth0" Interface "eth0" Port br-ex Interface br-ex type: internal Port "qg-e76de35e-90" Interface "qg-e76de35e-90" type: internal |
ÍøÇŵĹæÔòÒ²ºÜ¼òµ¥£¬×÷Ϊһ¸öÕý³£µÄ¶þ²ãת·¢É豸¼´¿É¡£
$ sudo ovs-ofctl dump-flows br-ex NXST_FLOW reply (xid=0x4): cookie=0x0, duration=75072.257s, table=0, n_packets=352212, n_bytes=85641148,
idle_age=0, hard_age=65534, priority=0 actions=NORMAL |
|