[lxc-users] lxc image copy from behind NAT

Fajar A. Nugraha list at fajar.net
Tue Jun 13 08:07:50 UTC 2017


On Tue, Jun 13, 2017 at 1:33 PM, Christoph Mathys <eraserix at gmail.com>
wrote:

> Thanks for your input!
>


> > You can probably try something like this:
> > lxc copy local:src_vm remote_name:dst_vm
>
> Unfortunately, this does not work either.
>
>
Ugh. You are right.

After further testing, that command is useful to select which IP address
the destination will connect to (this was my use case back then, since both
servers have multiple NICs, and only one is usable to connect between lxd
servers). It does NOT become the "middleman" for file transfers.

What CAN work (just tested now), is that if you have tcp forwarding enabled
with ssh (assuming ssh port is also natted):
- on both source (call it lxd1) and destination (call it lxd2) servers, run
ssh forwarding in the way that port 4301 will connect to lxd1 port 8443,
and port 4302 will connect to lxd2 port 8443 (you need one ssh with both
local port and remote port forwarding to make this happen, plus
ssh-to-localhost on each server)

- next step (doesn't matter whether on lxd1 or lxd2, both will be the same)
lxc remote add lxd1 127.0.0.1:4301
lxc remote add lxd2 127.0.0.1:4302
lxc copy lxd1:c1 lxd2:c1-copy

The lxd server on lxd2 will then connect to 127.0.0.1:4301 to get data from
lxd1. Which works, because we've setup tcp forwarding with ssh.

Whether or not this step is better compared to your export+scp, depends on
the user.

-- 
Fajar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20170613/133f5afc/attachment.html>


More information about the lxc-users mailing list