vtep-ctl + add-ls+ bind-ls +br-get-external-id

[root@kunpeng82 scripts]# vtep-ctl add-ls ls1
vtep-ctl set Logical_Switch ls1 tunnel_key=33
[root@kunpeng82 scripts]# vtep-ctl list-ls 
ls2
[root@kunpeng82 scripts]# ovs-vsctl show
ec7f002f-352c-476c-8348-5f2c86c8194f
    Bridge "br1"
        Port "br1"
            Interface "br1"
                type: internal
    Bridge "br0_vtep_ls2"
        Port "vx3"
            Interface "vx3"
                type: vxlan
                options: {key="44", remote_ip="192.168.16.83"}
        Port "0100-tortap3-l"
            Interface "0100-tortap3-l"
                type: patch
                options: {peer="0100-tortap3-p"}
        Port "br0_vtep_ls2"
            Interface "br0_vtep_ls2"
                type: internal
    Bridge vtep_bfd
        Port vtep_bfd
            Interface vtep_bfd
                type: internal
        Port "bfd192.168.16.83"
            Interface "bfd192.168.16.83"
                type: vxlan
                options: {remote_ip="192.168.16.83"}
    Bridge "br0"
        Port "br0"
            Interface "br0"
                type: internal
        Port "0100-tortap3-p"
            Interface "0100-tortap3-p"
                type: patch
                options: {peer="0100-tortap3-l"}
        Port "tortap1"
            tag: 0
            Interface "tortap1"
        Port "tortap3"
            Interface "tortap3"
        Port "tortap2"
            tag: 0
            Interface "tortap2"
    ovs_version: "2.12.0"
[root@kunpeng82 scripts]# vtep-ctl list-ls 
ls2
[root@kunpeng82 scripts]# vtep-ctl add-ls ls1
[root@kunpeng82 scripts]# ovs-vsctl show
ec7f002f-352c-476c-8348-5f2c86c8194f
    Bridge "br1"
        Port "br1"
            Interface "br1"
                type: internal
    Bridge "br0_vtep_ls2"
        Port "vx3"
            Interface "vx3"
                type: vxlan
                options: {key="44", remote_ip="192.168.16.83"}
        Port "0100-tortap3-l"
            Interface "0100-tortap3-l"
                type: patch
                options: {peer="0100-tortap3-p"}
        Port "br0_vtep_ls2"
            Interface "br0_vtep_ls2"
                type: internal
    Bridge vtep_bfd
        Port vtep_bfd
            Interface vtep_bfd
                type: internal
        Port "bfd192.168.16.83"
            Interface "bfd192.168.16.83"
                type: vxlan
                options: {remote_ip="192.168.16.83"}
    Bridge "br0"
        Port "br0"
            Interface "br0"
                type: internal
        Port "0100-tortap3-p"
            Interface "0100-tortap3-p"
                type: patch
                options: {peer="0100-tortap3-l"}
        Port "tortap1"
            tag: 0
            Interface "tortap1"
        Port "tortap3"
            Interface "tortap3"
        Port "tortap2"
            tag: 0
            Interface "tortap2"
    ovs_version: "2.12.0"
[root@kunpeng82 scripts]#  vtep-ctl bind-ls br0 tortap1 0 ls1
[root@kunpeng82 scripts]#  vtep-ctl bind-ls br0 tortap2 100 ls1
[root@kunpeng82 scripts]# ovs-vsctl show
ec7f002f-352c-476c-8348-5f2c86c8194f
    Bridge "br1"
        Port "br1"
            Interface "br1"
                type: internal
    Bridge "br0_vtep_ls2"
        Port "vx3"
            Interface "vx3"
                type: vxlan
                options: {key="44", remote_ip="192.168.16.83"}
        Port "0100-tortap3-l"
            Interface "0100-tortap3-l"
                type: patch
                options: {peer="0100-tortap3-p"}
        Port "br0_vtep_ls2"
            Interface "br0_vtep_ls2"
                type: internal
    Bridge "br0_vtep_ls3"                            ---------------- 没有ls1
        Port "br0_vtep_ls3"
            Interface "br0_vtep_ls3"
                type: internal
        Port "0100-tortap2-l"
            Interface "0100-tortap2-l"
                type: patch
                options: {peer="0100-tortap2-p"}
        Port "0000-tortap1-l"
            Interface "0000-tortap1-l"
                type: patch
                options: {peer="0000-tortap1-p"}
    Bridge vtep_bfd
        Port vtep_bfd
            Interface vtep_bfd
                type: internal
        Port "bfd192.168.16.83"
            Interface "bfd192.168.16.83"
                type: vxlan
                options: {remote_ip="192.168.16.83"}
    Bridge "br0"
        Port "br0"
            Interface "br0"
                type: internal
        Port "0000-tortap1-p"
            Interface "0000-tortap1-p"
                type: patch
                options: {peer="0000-tortap1-l"}
        Port "0100-tortap3-p"
            Interface "0100-tortap3-p"
                type: patch
                options: {peer="0100-tortap3-l"}
        Port "tortap1"
            tag: 0
            Interface "tortap1"
        Port "tortap3"
            Interface "tortap3"
        Port "0100-tortap2-p"
            Interface "0100-tortap2-p"
                type: patch
                options: {peer="0100-tortap2-l"}
        Port "tortap2"
            tag: 0
            Interface "tortap2"
    ovs_version: "2.12.0"
[root@kunpeng82 scripts]# vtep-ctl add-ls ls1
vtep-ctl: cannot create logical switch ls1 because it already exists
[root@kunpeng82 scripts]# vtep-ctl list-ls 
ls1
ls2
[root@kunpeng82 scripts]# 
[root@kunpeng82 scripts]# ovsdb-client dump hardware_vtep | grep ls1
ef2dcc0e-4459-44b5-988f-aafb9c14c4e9 ""          "ls1" {}           []               []
[root@kunpeng82 scripts]# ovsdb-client dump hardware_vtep | grep ls3
[root@kunpeng82 scripts]# 

 

[root@kunpeng82 scripts]# ovs-vsctl  br-get-external-id  br0
[root@kunpeng82 scripts]# ovs-vsctl  br-get-external-id  br0_vtep_ls3
logical_switch_name=ls1                    ------------------------------逻辑网桥
vtep_logical_switch=true
[root@kunpeng82 scripts]# 
[root@kunpeng82 scripts]# ovs-vsctl  br-get-external-id  br0_vtep_ls3 
logical_switch_name=ls1
vtep_logical_switch=true
[root@kunpeng82 scripts]# ovs-vsctl  br-get-external-id  br0_vtep_ls3 logical_switch_name
ls1
[root@kunpeng82 scripts]# 
原文地址:https://www.cnblogs.com/dream397/p/13275575.html