本文介绍: (10)查看br0桥-OVS上的所有添加的port端口。(2)安装 openvswitch–switch。(7)再次查看openvswitch。(6)删除OVS 虚拟交换机并查看。(13)查看openvswitch。(16)查看openvswitch。(5)查看openvswitch。(3)查看openvswitch。(6)查看openvswitch。(9)查看openvswitch。(3)查看软件ID与软件版本。(1)KVM 的三种网络模式。的 ovs的if01端口。internal类型。
一、实验
1.OVS 交换机管理
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> 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)安装 openvswitch–switch
sudo apt-get install openvswitch-switch
root:/# sudo ovs-vsctl show
e436b05b-210c-468a-9d94-fd63c6c419ed
ovs_version: "2.9.8"
ovs-vsctl add-br br0
root:/# sudo ovs-vsctl show
e436b05b-210c-468a-9d94-fd63c6c419ed
Bridge "br0"
Port "br0"
Interface "br0"
type: internal
ovs_version: "2.9.8"
ovs-vsctl del-br br0
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
ovs-vsctl set port if01 VLAN_mode=access
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"
已新增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
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"
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
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"
root:/# ovs-vsctl list-ports br0
if02
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
root:/# sudo ovs-vsctl show
e436b05b-210c-468a-9d94-fd63c6c419ed
Bridge "br0"
Port "br0"
Interface "br0"
type: internal
ovs_version: "2.9.8"
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
root:/# sudo ovs-vsctl show
e436b05b-210c-468a-9d94-fd63c6c419ed
ovs_version: "2.9.8"
二、问题
1.KVM下的br0和virbr0有何区别
(2)区别
virbr0为NAT模式,它其实就是hypervisor的虚拟接口
原文地址:https://blog.csdn.net/cronaldo91/article/details/134766212
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_36398.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。