本文介绍: (10)查看br0桥-OVS上的所有添加port端口。(2)安装 openvswitchswitch。(7)再次查看openvswitch。(6)删除OVS 虚拟交换机查看。(13)查看openvswitch。(16)查看openvswitch。(5)查看openvswitch。(3)查看openvswitch。(6)查看openvswitch。(9)查看openvswitch。(3)查看软件ID与软件版本。(1)KVM 的三种网络模式。的 ovsif01端口internal类型

目录

一、实验

1.OVS 交换机管理

2.OVS端口管理

二、问题

1.KVM下的br0和virbr0有何区别


一、实验

1.OVS 交换机管理

(1)查看网络信息

lo:本地回环接口

enp0s17 :  ubuntu系统识别到的物理网卡

virbr0/br1/virbr0-nic : linux bridge 网桥相关

root:~# ip add show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s17: <BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:d8:2a:24 brd ff:ff:ff:ff:ff:ff
    inet 192.168.31.20/24 brd 192.168.31.255 scope global dynamic noprefixroute enp0s17
       valid_lft 42599sec preferred_lft 42599sec
    inet6 fe80::f79a:6227:76ba:e22e/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: br1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 3a:e1:3f:67:ea:22 brd ff:ff:ff:ff:ff:ff
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:2f:20:d6 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
    link/ether 52:54:00:2f:20:d6 brd ff:ff:ff:ff:ff:ff

(2)安装 openvswitchswitch

sudo apt-get install openvswitch-switch

(3)查看软件ID与软件版本

root:/# sudo ovs-vsctl show
e436b05b-210c-468a-9d94-fd63c6c419ed
    ovs_version: "2.9.8"

(4)创建OVS 虚拟交换机

ovs-vsctl add-br br0

(5)查看openvswitch

root:/# sudo ovs-vsctl show
e436b05b-210c-468a-9d94-fd63c6c419ed
    Bridge "br0"
        Port "br0"
            Interface "br0"
                type: internal
    ovs_version: "2.9.8"

(6)删除OVS 虚拟交换机并查看

ovs-vsctl del-br br0

(7)再次查看openvswitch显示已删除

root:/# sudo ovs-vsctl show
e436b05b-210c-468a-9d94-fd63c6c419ed
    ovs_version: "2.9.8"

2.OVS端口管理

 (1)向br0 添加 if01端口,并且绑定 if01接口设置端口类型 internal类型

ovs-vsctl add-port br0 if01 -- set interface if01 type=internal

(2)将if01端口设置access VLAN模式

ovs-vsctl set port if01 VLAN_mode=access 

(3)查看openvswitch

root:/# sudo ovs-vsctl show
e436b05b-210c-468a-9d94-fd63c6c419ed
    Bridge "br0"
        Port "if01"
            Interface "if01"
                type: internal
        Port "br0"
            Interface "br0"
                type: internal
    ovs_version: "2.9.8"

(4)查看网络信息

新增br0和if01

root:/# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s17: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:d8:2a:24 brd ff:ff:ff:ff:ff:ff
    inet 192.168.31.20/24 brd 192.168.31.255 scope global dynamic noprefixroute enp0s17
       valid_lft 39205sec preferred_lft 39205sec
    inet6 fe80::f79a:6227:76ba:e22e/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: br1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 3a:e1:3f:67:ea:22 brd ff:ff:ff:ff:ff:ff
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:2f:20:d6 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
    link/ether 52:54:00:2f:20:d6 brd ff:ff:ff:ff:ff:ff
8: ovs-system: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 3a:6f:7f:57:9f:3d brd ff:ff:ff:ff:ff:ff
9: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether ae:f5:0b:f1:b4:4c brd ff:ff:ff:ff:ff:ff
10: if01: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 96:1e:9c:4d:4d:62 brd ff:ff:ff:ff:ff:ff

(5)向br0 添加 if02端口,并且绑定 if02接口设置端口类型 internal类型

ovs-vsctl add-port br0 if02 -- set interface if02 type=internal

(6)查看openvswitch

root:/# sudo ovs-vsctl show
e436b05b-210c-468a-9d94-fd63c6c419ed
    Bridge "br0"
        Port "if02"
            Interface "if02"
                type: internal
        Port "if01"
            Interface "if01"
                type: internal
        Port "br0"
            Interface "br0"
                type: internal
    ovs_version: "2.9.8"

(7) 查看网络信息

root:/# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s17: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:d8:2a:24 brd ff:ff:ff:ff:ff:ff
    inet 192.168.31.20/24 brd 192.168.31.255 scope global dynamic noprefixroute enp0s17
       valid_lft 39017sec preferred_lft 39017sec
    inet6 fe80::f79a:6227:76ba:e22e/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: br1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 3a:e1:3f:67:ea:22 brd ff:ff:ff:ff:ff:ff
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:2f:20:d6 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
    link/ether 52:54:00:2f:20:d6 brd ff:ff:ff:ff:ff:ff
8: ovs-system: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 3a:6f:7f:57:9f:3d brd ff:ff:ff:ff:ff:ff
9: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether ae:f5:0b:f1:b4:4c brd ff:ff:ff:ff:ff:ff
10: if01: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 96:1e:9c:4d:4d:62 brd ff:ff:ff:ff:ff:ff
11: if02: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 66:c9:a7:75:d2:d8 brd ff:ff:ff:ff:ff:ff

(8)删除名称为 br0的 ovs的if01端口

 ovs-vsctl del-port br0 if01

(9)查看openvswitch

root:/# sudo ovs-vsctl show
e436b05b-210c-468a-9d94-fd63c6c419ed
    Bridge "br0"
        Port "if02"
            Interface "if02"
                type: internal
        Port "br0"
            Interface "br0"
                type: internal
    ovs_version: "2.9.8"

(10)查看br0桥-OVS上的所有添加port端口

root:/# ovs-vsctl list-ports br0
if02

(11)查看网络信息
显示端口if01已删除

root:/# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s17: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:d8:2a:24 brd ff:ff:ff:ff:ff:ff
    inet 192.168.31.20/24 brd 192.168.31.255 scope global dynamic noprefixroute enp0s17
       valid_lft 38737sec preferred_lft 38737sec
    inet6 fe80::f79a:6227:76ba:e22e/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: br1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 3a:e1:3f:67:ea:22 brd ff:ff:ff:ff:ff:ff
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:2f:20:d6 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
    link/ether 52:54:00:2f:20:d6 brd ff:ff:ff:ff:ff:ff
8: ovs-system: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 3a:6f:7f:57:9f:3d brd ff:ff:ff:ff:ff:ff
9: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether ae:f5:0b:f1:b4:4c brd ff:ff:ff:ff:ff:ff
11: if02: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 66:c9:a7:75:d2:d8 brd ff:ff:ff:ff:ff:ff

(12)删除名称为 br0的 ovs的if02端口

 ovs-vsctl del-port br0 if02

(13)查看openvswitch

root:/# sudo ovs-vsctl show
e436b05b-210c-468a-9d94-fd63c6c419ed
    Bridge "br0"
        Port "br0"
            Interface "br0"
                type: internal
    ovs_version: "2.9.8"

(14)查看网络信息

root:/# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s17: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:d8:2a:24 brd ff:ff:ff:ff:ff:ff
    inet 192.168.31.20/24 brd 192.168.31.255 scope global dynamic noprefixroute enp0s17
       valid_lft 38698sec preferred_lft 38698sec
    inet6 fe80::f79a:6227:76ba:e22e/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: br1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 3a:e1:3f:67:ea:22 brd ff:ff:ff:ff:ff:ff
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:2f:20:d6 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
    link/ether 52:54:00:2f:20:d6 brd ff:ff:ff:ff:ff:ff
8: ovs-system: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 3a:6f:7f:57:9f:3d brd ff:ff:ff:ff:ff:ff
9: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether ae:f5:0b:f1:b4:4c brd ff:ff:ff:ff:ff:ff

(15)删除名称为 br0的 ovs

ovs-vsctl del-br br0

(16)查看openvswitch

root:/# sudo ovs-vsctl show
e436b05b-210c-468a-9d94-fd63c6c419ed
    ovs_version: "2.9.8"

二、问题

1.KVM下的br0和virbr0有何区别

(1)KVM 的三种网络模式

桥接、仅主机、NAT

(2)区别

默认br0是桥接模式;

virbr0为NAT模式,它其实就是hypervisor虚拟接口

原文地址:https://blog.csdn.net/cronaldo91/article/details/134766212

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_36398.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除!

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注