[lxc-users] Macvlan setup issues

Steve Adams stevekadams at outlook.com
Fri Apr 29 19:22:27 UTC 2016



Sent from my Windows Phone
________________________________
From: Steve Adams<mailto:stevekadams at outlook.com>
Sent: ‎4/‎29/‎2016 12:21 PM
To: Mark Haney<mailto:mark.haney at vifprogram.com>
Subject: RE:Macvlan setup issues

The simplest way that I have found to accomplish this is with a simple bridge. I am assuming that you are using Ubuntu and have an Ethernet connection on the host. The bridge can easily be setup in /etc/network/ interfaces (there is tons of documentation). The resulting br0, or whatever you chose to call it, would then be used as the bridge device in containers config. You can than set up in the containers /etc/network/interfaces to have IP assigned by the router DHCP  or assign your own static IP in the same subnet.
Keep in mind that I have only done this with nested containers as I use a laptop primarily and wifi adds a level of complexity that I have not felt the need to deal with. But it did work perfectly in assigning IPs to the nested containers in the same subnet as the host container.

Sent from my Windows Phone

-----Original Message-----
From: "Mark Haney" <mark.haney at vifprogram.com>
Sent: ‎4/‎28/‎2016 10:02 AM
To: "lxc-users at lists.linuxcontainers.org" <lxc-users at lists.linuxcontainers.org>
Subject: [lxc-users] Macvlan setup issues

Hi all.  I'm really new to LXC/LXD as well as with macvlan setup, so bear
with me.  I'm having all kinds of trouble getting the macvlan setup to work
on my Ubuntu 16.04 VM.  The documentation isn't terribly clear, or at least
it seems to be missing something that is keeping my containers from being
accessible inside my office network directly.  I'm hoping it's something
simple, but as I've run out of good Google searches, I'm not sure what else
to try.  Here's my problem (and setup):

I've been able to get containers of various distros running file with
bridging, but I'd like to be able to access them as part of my LAN
directly.


The IP of the 16.04 host:  10.42.204.50 (gw 10.42.204.1)

Now, I went through the docs to setup macvlans as this appeared to be the
simplest (best?) method of setting up the containers to access my LAN.  So,
I ran dpkg-reconfigure lxd and removed the bridging.  Then set the macvlan
according to the docs
<https://www.stgraber.org/2016/03/19/lxd-2-0-your-first-lxd-container-312/>
:

lxc profile device set default eth0 nictype macvlan
lxc profile device set default eth0 parent ens160

The second command might not be correct, as the documentation doesn't
specify precisely what the 'parent' is, though I believe it's the host
interface name (in my case ens160).  Regardless, this seems to have worked,
at least partly because, when I launched an image of Ubuntu 15.10, the eth0
interface was correctly given a DHCP address from my LAN (10.42.204.153)
and a default gateway (10.42.204.1).

However, I cannot ping anything on my network from the container with a
'Destination Host Unreachable' message.  IP forwarding is enabled, but I
don't think I need that for this setup.  The problem is, none of the docs
say I need to do anything else to get macvlans working, which is why this
is so frustrating.  Is this just a case of I'm missing something the docs
assume I have knowledge of?  Or an actual problem.

I'm no Linux slouch, I've been using them since the RH3 days, but macvlans
are new to me, so is LXD.

Any ideas?


--

Mark Haney ::: Senior Systems Engineer
*VIF* *International Education*
P.O. Box 3566 ::: Chapel Hill, N.C. 27515 ::: USA
919-265-5006 office

Global learning for all.
www.viflearn.com
Find VIF on Facebook <http://facebook.com/VIFInternationalEducation> |
Twitter <https://twitter.com/vifglobaled> | LinkedIn
<http://www.linkedin.com/company/vif-international-education>

Recognized as a ‘Best for the World’
<http://bestfortheworld.bcorporation.net/> B Corp!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20160429/dc120d98/attachment-0001.html>


More information about the lxc-users mailing list