linux - Setup private networking between two hosts and two VMs with libvirt / openvswitch -
i have 2 nodes , 2 vm's
kvm01 -nic1 123.123.123.1 vm1 -vnet1 123.123.123.2 (public) -vnet2 10.0.0.1 (private) kvm02 -nic1 123.123.123.2 vm2 -vnet1 123.123.123.4 (public) -vnet2 10.0.0.2 (private) how possible setup openvswitch network vm1 , vm2 on private network hosts in 2 different locations?
edit:
running command:
# ovs-vsctl add-port br-private vxlan1 -- \ set interface vxlan1 type=vxlan options:remote_ip=123.123.123.2 resulted in ovs configuration:
root@backup01:~# ovs-vsctl show 6276bd0a-920b-469d-a4e0-90d990dd8f94 bridge "br-private1" port "vxlan1" interface "vxlan1" type: vxlan options: {remote_host="107.150.29.72"} port "br-private1" interface "br-private1" type: internal ovs_version: "2.3.0" root@kvmssd01:~# ovs-vsctl show da6399d4-1435-437d-90d7-3e75c443389b bridge br-private port "vxlan1" interface "vxlan1" type: vxlan options: {remote_host="107.150.29.68"} port br-private interface br-private type: internal ovs_version: "2.3.0" using kernel:
root@backup01:~# uname -r 3.16.0-4-amd64 with module:
root@backup01:~# modinfo openvswitch filename: /lib/modules/3.16.0-4-amd64/kernel/net/openvswitch/openvswitch.ko license: gpl description: open vswitch switching datapath depends: libcrc32c,vxlan,gre intree: y vermagic: 3.16.0-4-amd64 smp mod_unload modversions and version of ovs:
root@backup01:~# ovs-vsctl --version ovs-vsctl (open vswitch) 2.3.0 compiled dec 19 2014 03:59:10 db schema 7.6.0 resulted in these errors:
root@backup01:~# ovs-vswitchd logs 2015-07-23t16:34:59z|00001|reconnect|info|logs: connecting... 2015-07-23t16:34:59z|00002|reconnect|info|logs: connection attempt failed (address family not supported protocol) 2015-07-23t16:34:59z|00003|reconnect|info|logs: waiting 1 seconds before reconnect 2015-07-23t16:35:00z|00004|reconnect|info|logs: connecting... 2015-07-23t16:35:00z|00005|reconnect|info|logs: connection attempt failed (address family not supported protocol) 2015-07-23t16:35:00z|00006|reconnect|info|logs: waiting 2 seconds before reconnect lsmod output:
# lsmod | grep openvswitch openvswitch 63932 0 gre 12777 1 openvswitch vxlan 35053 1 openvswitch libcrc32c 12426 1 openvswitch
one option set vxlan tunnel between ovs bridges on 2 hosts.
creating ovs bridges
on each host, create ovs bridge used private network:
ovs-vsctl add-br br-private when create libvirt vms, attach vnet2 on each guest br-private bridge. using virt-install like:
virt-install ... -w bridge=br-private,virtualport_type=openvswitch if using other mechanism create guests, corresponding xml looks like:
<interface type='bridge'> < source bridge='br-private'/> < virtualport type='openvswitch'/> < /interface> creating vxlan tunnels
now create vxlan tunnel kvm01 kvm02. on kvm01:
ovs-vsctl add-port br-private vxlan1 -- \ set interface vxlan1 type=vxlan options:remote_ip=123.123.123.2 and on kvm02:
ovs-vsctl add-port br-private vxlan1 -- \ set interface vxlan1 type=vxlan options:remote_ip=123.123.123.1 with tunnel in place , guests connected br-private, have created virtual network spans multiple hosts.
note vxlan runs on udp port 4789, may need modify firewall configuration permit these connections.
the finished ovs configuration this:
# ovs-vsctl show ac885d3d-b636-4bb1-a75e-37f361af87e3 bridge br-private port "vxlan1" interface "vxlan1" type: vxlan options: {remote_ip="192.168.122.107"} port br-private interface br-private type: internal port vnet2 interface vnet2 ovs_version: "2.3.2" ...although of course using host ip addresses, rather address testing environment.
Comments
Post a Comment