• OPENVSWITCH


     ovs-vsctl add-port br0 vlan10 tag=10 -- set interface vlan10 type=internal
     ovs-vsctl add-port br0 vlan20 tag=20 -- set interface vlan20 type=internal
     
       
     ovs-vsctl add-port br0 enahisic2i1 trunks=10,20
    
     ovs-vsctl add-port br0 enahisic2i3 trunks=10,20


    [root@bogon ~]# ovs-vsctl show
    153bc919-e549-4c26-bc18-8ebc22b32581
    Bridge "br0"
    Port "enahisic2i1"
    trunks: [10, 20]
    Interface "enahisic2i1"
    Port "vlan20"
    tag: 20
    Interface "vlan20"
    type: internal
    Port "vlan10"
    tag: 10
    Interface "vlan10"
    type: internal
    Port "enahisic2i3"
    trunks: [10, 20]
    Interface "enahisic2i3"
    Port "br0"
    Interface "br0"
    type: internal
    ovs_version: "2.12.0"
    [root@bogon ~]#

    bogon# conf t
    bogon(config)# hostname 81.bogon
    81.bogon(config)# interface vlan10
    81.bogon(config-if)# ip address 192.168.10.1/24
    81.bogon(config-if)# no shutdown
    81.bogon(config-if)# interface vlan20
    81.bogon(config-if)#  ip address 192.168.20.1/24
    81.bogon(config-if)# no shutdown
    81.bogon(config-if)# do wr
    Note: this version of vtysh never writes vtysh.conf
    Building Configuration...
    Configuration saved to /etc/frr/zebra.conf
    Configuration saved to /etc/frr/ospfd.conf
    Can't backup old configuration file /etc/frr/bgpd.conf.sav.
    Configuration saved to /etc/frr/staticd.conf
    81.bogon(config-if)# exit
    81.bogon(config)# exit
    81.bogon# show running-config
    Building configuration...
    
    Current configuration:
    !
    frr version 7.3-MyOwnFRRVersion
    frr defaults traditional
    hostname localhost.localdomain
    log file /var/log/frr/bgpd.log
    hostname 81.bogon
    !
    interface vlan10
     ip address 192.168.10.1/24
    !
    interface vlan20
     ip address 192.168.20.1/24
    !
    line vty
    !
    end
    81.bogon# 
    [root@bogon ~]# ip a show vlan10
    12: vlan10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
        link/ether fa:82:57:cb:d0:dc brd ff:ff:ff:ff:ff:ff
        inet 192.168.10.1/24 brd 192.168.10.255 scope global vlan10
           valid_lft forever preferred_lft forever
        inet6 fe80::f882:57ff:fecb:d0dc/64 scope link 
           valid_lft forever preferred_lft forever
    [root@bogon ~]# ip a show vlan20
    13: vlan20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
        link/ether 46:ee:73:2b:ab:65 brd ff:ff:ff:ff:ff:ff
        inet 192.168.20.1/24 brd 192.168.20.255 scope global vlan20
           valid_lft forever preferred_lft forever
        inet6 fe80::44ee:73ff:fe2b:ab65/64 scope link 
           valid_lft forever preferred_lft forever
    [root@bogon ~]# 
    [root@bogon ~]# ovs-vsctl add-bond br0 bond0 enahisic2i1 enahisic2i3 trunks=10,20
    ovs-vsctl: cannot create an interface named enahisic2i1 because a port named enahisic2i1 already exists on bridge br0
    [root@bogon ~]#

     这么做会产生回路

    17:33:47.333049 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333052 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333054 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333058 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333061 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333064 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333066 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333070 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333126 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333129 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333133 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333135 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333285 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333288 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333291 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333293 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333478 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333481 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333483 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    17:33:47.333486 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.10.1 tell 192.168.10.3, length 46
    创建一个 bridge,把两块物理网卡绑定到网桥,产生了网络风暴:
    
     
    
    ovs-vsctl add-br br0
    
    ovs-vsctl add-port br0eth0
    
    ovs-vsctl add-port br0eth1
    
    问题解决: 在上面的设置下,OpenvSwitch 在 eth0 上收到一个广播包后会将其发给 eth1,然后 eth1 上的物理交换机又将这个广播包发还给 eth0,如此往复产生网络风暴。当有多个 switch 时产生更复杂的情况。
    
    解决方案1:
    
    将 eth0 与 eth1 都绑定至同一个 bridge 从而获得更大的带宽、更高的可靠性:
    
    ovs-vsctl add-br br0
    
    ovs-vsctl add-bond br0 bond0 eth0 eth1
    
    解决方案2:
    
    建立两个bridge:
    
    ovs-vsctl add-br br0
    
    ovs-vsctl add-port br0 eth0
    
    ovs-vsctl add-br br1
    
    ovs-vsctl add-port br1eth1
    
    解决方案3:
    
    打开生成树协议(spanning tree protocol, STP):
    
    ovs-vsctl add-br br0
    
    ovs-vsctl set bridge br0stp_enable=true
    
    ovs-vsctl add-port br0 eth0
    
    ovs-vsctl add-port br0  eth1
    kunpeng82.bogon# 
    kunpeng82.bogon# 
    kunpeng82.bogon# 
    kunpeng82.bogon# 
    kunpeng82.bogon# conf t
    kunpeng82.bogon(config)# interface vlan10
    kunpeng82.bogon(config-if)#  ip address 192.168.10.2/24
    kunpeng82.bogon(config-if)#  no shutdown
    kunpeng82.bogon(config-if)# interface vlan20
    kunpeng82.bogon(config-if)#  ip address 192.168.20.2/24
    kunpeng82.bogon(config-if)# no shutdown
    kunpeng82.bogon(config-if)# do wr
    Building Configuration...
    Can't open configuration file /etc/quagga/zebra.conf.RPZD3B.
    [OK]
    kunpeng82.bogon(config-if)# exit
    kunpeng82.bogon(config)# exit
    kunpeng82.bogon# exit
    [root@kunpeng82 devuser]#

    https://brezular.com/2011/12/04/openvswitch-playing-with-bonding-on-openvswitch/

  • 相关阅读:
    数据采集都做不到,怎么谈智能制造?
    值得借鉴的德国制造工厂生产观念!
    APS应用案例|纽威阀门实现高效排产
    MES应用案例|新宏泰电器乘上智能制造的东风
    你的MES今天升级了吗?
    APP-2.1-Hbuilder与夜神 & HbuilderX与夜神模拟器连接
    APP-3-百度地图应用
    APP-2-Hbuilder开发环境搭建
    ABAP-Keyword Documentation
    APP-1-相关介绍及资料
  • 原文地址:https://www.cnblogs.com/dream397/p/12928988.html
Copyright © 2020-2023  润新知