Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How to share a folder between KVM & OpenVZ?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

How to share a folder between KVM & OpenVZ?

I have a Windows KVM VM and a Linux OpenVZ container on the same node. I want to share a folder between the two, such that only these two VMs see it (i.e. it must not be accessible from any other OpenVZ container on the same node). The added complexity is that the OpenVZ VM has only IPv6 (I can add IPv4 but I don't want it to be routable to the internet or visible to any other VMs). The KVM VM has NAT IPv4 and currently no IPv6 but I could add IPv6 to it if necessary. The solution needs to be as fast as possible, that's why I am not really considering sshfs.
One option I considered was to install Samba on the host node and share the OpenVZ filesystem that way, but I am concerned it may open up my host node to exploits from the other OpenVZ containers.
The other option I am looking at is installing Samba on the OpenVZ container. The question becomes how do I connect these two VMs in a secure way? Should I add one extra network adapter to each?

Any better ideas?

Comments

  • shovenoseshovenose Member, Host Rep

    VPN?

    Thanked by 1elwebmaster
  • wychwych Member

    I use NFS for some OVZ > OVZ sharing.

  • I think I'll go with IPv6<->IPv6 VPN. Thanks.

  • elwebmasterelwebmaster Member
    edited June 2014

    I was not able to add IPv6 to my KVM, I don't think the qemu user mode NAT supports it. This is how I solved my problem:

    1) Install Samba on the host node. Set interface in smb.conf to 127.0.0.1 and disable Samba startup on boot:
    update-rc.d -f samba remove
    (this Samba instance is not used at all actually)

    2) Add this line to my qemu conf file:
    args: -smb /var/lib/vz/private/400/media

    It's that easy. Qemu creates a virtual Samba instance running on 10.0.2.4 (within the user mode network) which is visible only to my KVM VM and has read-write access to the /media folder in OpenVZ.

    Posting this just in case somebody finds it useful.

Sign In or Register to comment.