openvswitch-vtep(四)
https://macauleycheng.gitbooks.io/ovn/examplewith-vtep.html
82节点
[root@kunpeng82 ~]# ip netns exec ns2 ip a 257: nstap2@if256: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 42:a1:cc:39:9a:61 brd ff:ff:ff:ff:ff:ff link-netnsid 0 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: nstap2.vlan100@nstap2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 42:a1:cc:39:9a:61 brd ff:ff:ff:ff:ff:ff inet 10.0.10.122/24 scope global nstap2.vlan100 valid_lft forever preferred_lft forever inet6 fe80::40a1:ccff:fe39:9a61/64 scope link valid_lft forever preferred_lft forever [root@kunpeng82 ~]# ip netns exec ns1 ip a 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 250: nstap1@if249: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 82:32:fe:df:ff:94 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 10.0.10.120/24 scope global nstap1 valid_lft forever preferred_lft forever inet6 fe80::8032:feff:fedf:ff94/64 scope link valid_lft forever preferred_lft forever [root@kunpeng82 ~]#
[root@kunpeng82 ~]# ip netns exec ns3 ip a 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 259: nstap3@if258: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether e2:df:4a:92:e8:20 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 10.0.10.125/24 scope global nstap3 valid_lft forever preferred_lft forever inet6 fe80::e0df:4aff:fe92:e820/64 scope link valid_lft forever preferred_lft forever [root@kunpeng82 ~]#
81节点
[root@bogon ~]# ip netns exec ns1 ip a 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: nstap1.vlan100@nstap1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether d2:40:3e:24:38:f6 brd ff:ff:ff:ff:ff:ff 124: nstap1@if123: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether d2:40:3e:24:38:f6 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 10.0.10.121/24 scope global nstap1 valid_lft forever preferred_lft forever [root@bogon ~]#
[root@bogon ~]# ip netns exec ns1 ping 10.0.10.125 PING 10.0.10.125 (10.0.10.125) 56(84) bytes of data. ^C --- 10.0.10.125 ping statistics --- 2 packets transmitted, 0 received, 100% packet loss, time 1048ms [root@bogon ~]# ip netns exec ns1 ping 10.0.10.120 PING 10.0.10.120 (10.0.10.120) 56(84) bytes of data. 64 bytes from 10.0.10.120: icmp_seq=1 ttl=64 time=0.648 ms 64 bytes from 10.0.10.120: icmp_seq=2 ttl=64 time=0.275 ms ^C --- 10.0.10.120 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1058ms rtt min/avg/max/mdev = 0.275/0.461/0.648/0.187 ms [root@bogon ~]# ip netns exec ns1 ping 10.0.10.122 PING 10.0.10.122 (10.0.10.122) 56(84) bytes of data. 64 bytes from 10.0.10.122: icmp_seq=1 ttl=64 time=0.689 ms 64 bytes from 10.0.10.122: icmp_seq=2 ttl=64 time=0.151 ms ^C --- 10.0.10.122 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1048ms rtt min/avg/max/mdev = 0.151/0.420/0.689/0.269 ms [root@bogon ~]#
[root@kunpeng82 ~]# ovs-ofctl dump-flows br0 cookie=0x0, duration=430889.990s, table=0, n_packets=220, n_bytes=14616, in_port=tortap1 actions=output:"0000-tortap1-p" cookie=0x0, duration=430889.983s, table=0, n_packets=41112, n_bytes=8969744, in_port="0000-tortap1-p" actions=output:tortap1 cookie=0x0, duration=359027.339s, table=0, n_packets=533, n_bytes=31082, in_port="0100-tortap2-p" actions=mod_vlan_vid:100,output:tortap2 cookie=0x0, duration=2901.932s, table=0, n_packets=54, n_bytes=3532, in_port="0100-tortap3-p" actions=mod_vlan_vid:100,output:tortap3 cookie=0x0, duration=359027.346s, table=0, n_packets=91, n_bytes=6810, in_port=tortap2,dl_vlan=100 actions=strip_vlan,output:"0100-tortap2-p" cookie=0x0, duration=2901.940s, table=0, n_packets=0, n_bytes=0, in_port=tortap3,dl_vlan=100 actions=strip_vlan,output:"0100-tortap3-p" [root@kunpeng82 ~]#
不带vlan信息的报文,在pkt_mark做下标记后往下送,pkt_mark 信息存储在寄存器中: vlan_tci = 0x0000/0x1ffff actions=load:1 -> NXM_NX_PKT_MARK[31..31], normal
[root@kunpeng82 devuser]# ovs-vsctl show ec7f002f-352c-476c-8348-5f2c86c8194f Bridge "br0_vtep_ls1" Port "0100-tortap3-l" Interface "0100-tortap3-l" type: patch options: {peer="0100-tortap3-p"} Port "vx4" Interface "vx4" type: vxlan options: {key="33", remote_ip="192.168.16.81"} Port "br0_vtep_ls1" Interface "br0_vtep_ls1" 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 "bfd192.168.16.81" Interface "bfd192.168.16.81" type: vxlan options: {remote_ip="192.168.16.81"} Port vtep_bfd Interface vtep_bfd type: internal Bridge "br0" Port "br0" Interface "br0" type: internal Port "0100-tortap3-p" Interface "0100-tortap3-p" type: patch options: {peer="0100-tortap3-l"} Port "0100-tortap2-p" Interface "0100-tortap2-p" type: patch options: {peer="0100-tortap2-l"} Port "tortap1" tag: 0 Interface "tortap1" Port "0000-tortap1-p" Interface "0000-tortap1-p" type: patch options: {peer="0000-tortap1-l"} Port "tortap3" Interface "tortap3" Port "tortap2" tag: 0 Interface "tortap2" ovs_version: "2.12.0" [root@kunpeng82 devuser]#
1、vtep-ctl add-ps br0
2、vtep-ctl set Physical_Switch br0 tunnel_ips=192.168.16.81,…………
vtep只能绑定一个bridge
可以添加多个logic switch
3、 vtep-ctl add-ls ls0
4、 vtep-ctl bind-ls br0 p0 100 ls0
5、 vtep-ctl set Logical_Switch ls0 tunnel_key=33
6、 vtep-ctl add-ucast-remote ls0 d2:40:3e:24:38:f6 192.168.16.83
添加一个单播地址,每添加一个形成一个Port "vx"
7、 vxlan本地ip: enahisic2i2 192.168.16.82/24,网卡enahisic2i2不需要加入ovs