Open vSwitch

2018-09-26  本文已影响31人  捞小虾

添加/删除 bridge


$ ovs-vsctl add-br br0
$ ovs-vsctl del-br br0

添加 Port


$ ovs-vsctl add-port br0 eth0
$ ovs-vsctl del-port br0 eth0

添加/删除 SPAN port


$ ovs-vsctl add-br br0
$ ovs-vsctl add-port br0 eth0
$ ovs-vsctl add-port br0 tap0
$ ovs-vsctl add-port br0 tap1 \
    -- --id=@p get port tap1 \
    -- --id=@m create mirror name=m0 select-all=true output-port=@p \
    -- set bridge br0 mirrors=@m

$ ovs-vsctl clear bridge br0 mirrors

添加 vlan


$ ovs-vsctl add-br br0
$ ovs-vsctl add-port br0 eth0
$ ovs-vsctl add-port br0 eth1
$ ovs-vsctl set Port eth0 tag=101
$ ovs-vsctl set Port eth1 trunks=101,102
$ ovs-vsctl set bridge br0 flood-vlans=101,102

查看 bridge


$ ovs-vsctl show
59714912-7f2e-4369-8e42-b1ebd2f8b27e
    Bridge sw_bridge
        Port "enp17s0f1"
            tag: 664
            Interface "enp17s0f1"
        Port "enp16s0f1"
            trunks: [664]
            Interface "enp16s0f1"
        Port "enp139s0f3"
            trunks: [664]
            Interface "enp139s0f3"
        Port "enp16s0f0"
            tag: 664
            Interface "enp16s0f0"
        Port sw_bridge
            Interface sw_bridge
                type: internal
        Port "enp17s0f0"
            tag: 664
            Interface "enp17s0f0"
    ovs_version: "2.0.0"
$ ovs-vsctl list bridge sw_bridge
_uuid               : 3fd1b3e8-55a0-4e9b-92f9-06da1204966a
controller          : []
datapath_id         : "0000000cbd0691b9"
datapath_type       : ""
external_ids        : {}
fail_mode           : []
flood_vlans         : [664]
flow_tables         : {}
ipfix               : []
mirrors             : []
name                : sw_bridge
netflow             : []
other_config        : {}
ports               : [5cddc029-a363-4857-ba37-40e283e1a857, 5f34f745-2f9f-41eb-b28b-be06a40fca10, 9c4d3ad1-152f-4995-9d67-0e2dfb8614a8, a02a1c83-b79f-40d3-bf7d-4f2df64b90bb, a7a90eac-77ae-446a-a72a-97e0639db6f5, f234bc7f-74bb-4136-a696-379d304ef72e]
protocols           : []
sflow               : []
status              : {}
stp_enable          : false
$ ovs-ofctl show sw_bridge
OFPT_FEATURES_REPLY (xid=0x2): dpid:0000000cbd0691b9
n_tables:254, n_buffers:256
capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE
 1(enp17s0f0): addr:00:0c:bd:0a:92:32
     config:     0
     state:      0
     current:    10GB-FD FIBER AUTO_NEG
     advertised: 1GB-FD 10GB-FD FIBER AUTO_NEG AUTO_PAUSE
     supported:  1GB-FD 10GB-FD FIBER AUTO_NEG AUTO_PAUSE
     speed: 10000 Mbps now, 10000 Mbps max
 2(enp17s0f1): addr:00:0c:bd:0a:92:33
     config:     0
     state:      0
     current:    10GB-FD FIBER AUTO_NEG
     advertised: 1GB-FD 10GB-FD FIBER AUTO_NEG AUTO_PAUSE
     supported:  1GB-FD 10GB-FD FIBER AUTO_NEG AUTO_PAUSE
     speed: 10000 Mbps now, 10000 Mbps max
 3(enp16s0f1): addr:00:0c:bd:0a:92:37
     config:     0
     state:      0
     current:    10GB-FD FIBER AUTO_NEG
     advertised: 1GB-FD 10GB-FD FIBER AUTO_NEG AUTO_PAUSE
     supported:  1GB-FD 10GB-FD FIBER AUTO_NEG AUTO_PAUSE
     speed: 10000 Mbps now, 10000 Mbps max
 4(enp16s0f0): addr:00:0c:bd:0a:92:36
     config:     0
     state:      0
     current:    10GB-FD FIBER AUTO_NEG
     advertised: 1GB-FD 10GB-FD FIBER AUTO_NEG AUTO_PAUSE
     supported:  1GB-FD 10GB-FD FIBER AUTO_NEG AUTO_PAUSE
     speed: 10000 Mbps now, 10000 Mbps max
 8(enp139s0f3): addr:00:0c:bd:06:91:b9
     config:     0
     state:      0
     current:    100MB-FD COPPER AUTO_NEG
     advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-FD COPPER AUTO_NEG AUTO_PAUSE
     supported:  10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-FD COPPER AUTO_NEG AUTO_PAUSE
     speed: 100 Mbps now, 1000 Mbps max
 LOCAL(sw_bridge): addr:00:0c:bd:06:91:b9
     config:     0
     state:      0
     speed: 0 Mbps now, 0 Mbps max
OFPT_GET_CONFIG_REPLY (xid=0x4): frags=normal miss_send_len=0
上一篇下一篇

猜你喜欢

热点阅读