[Lxc-users] What's the setup for macvlan on the host to talk to containers?

atp Andrew.Phillips at lmax.com
Tue Jul 6 17:36:48 UTC 2010


You'll need a recent version of iproute2. 

I have iproute2-2.6.34.tar.bz2

1) Add a macvlan.

 ip link add link <phys> name <vif> address <mac address> type macvlan\
mode (bridge|vepa|private)

 e.g. 

  ip link add link bond200 name bond200:0 address 00:aa:bb:cc:dd:ee \
  type macvlan mode bridge 

 2) Show a macvlan

   ip -d show link bond200:0

  (without the -d you won't get the mode)

 In my case I have the container side set to.

lxc.network.type = macvlan
lxc.network.macvlan.mode = bridge
lxc.network.flags = up 
lxc.network.link = bond200
lxc.network.name = eth7
lxc.network.mtu = 1500
lxc.network.ipv4 = 192.168.90.11/24 
lxc.network.hwaddr = 4a:49:43:49:79:0B

  In terms of the conceptual model, think of it as the same as an ip
alias, or secondary ip address, but at the mac level.

  For example if you do ethtool -k bond200 on the host, and ethtool -k
eth7 on the container you'll see the same settings. Change the scatter
gather on bond200 and the change will be visible in the container. 

  Your container and macvlan modes should match. (mode bridge,
macvlan.mode=bridge). 

  HTH.

   Andy

 
On Tue, 2010-07-06 at 08:31 -0400, Whit Blauvelt wrote:
> On Tue, Jul 06, 2010 at 08:46:45AM +0100, Gordon Henderson wrote:
> > > When it's said that for the host to speak to a guest on macvlan, that this
> > > depends on setting up macvlan for the host, too, where can I find
> > > instructions on how to do that?
> > 
> > You need to compile the options into the kernel and make sure that you 
> > have the bridge-utils package.
> > 
> > Under Networking Options:
> >    801.1d Ethernet bridging
> >    802.1q VLAN
> > 
> > And under Device Drivers -> Network device support:
> >    MAC-VLAN (experimental)
> > 
> > At least that works for me!
> 
> Ah, so many levels of answers to questions! The top answer from Google about
> macvlan says in part:
> 
> "* There is nearly no documentation.
>  * What there is, is inaccurate."
> 
> Anyway, from reading around I've gotten just far enough to know to bring my
> kernel up from 2.6.32 to .34 (which with a stock Ubuntu config does have
> ethernet bridging and vlan turned on, even in .32, but in .32 the underlying
> macvlan support is incomplete for lxc's purposes), and I've learned that "ip
> link" is the way to add a macvlan on the host.
> 
> The syntax to actually work across the macvlan I'm still hazy on. What are
> the ssh invocation options? In iptables firewalling, is the best way to base
> everything on "-m mac"? Does running with macvlan require adjustments to the
> routing tables? The "nearly no documentation" is an understatement.
> 
> Is there generic vlan knowledge I should be gaining and applying here? I've
> only run real LANs. Or is macvlan quite a different animal for these
> purposes?
> 
> Thanks,
> Whit
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Lxc-users mailing list
> Lxc-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-users
Andrew Phillips
Head of Systems

www.lmax.com 

Office: +44 203 1922509
Mobile: +44 (0)7595 242 900

LMAX | Level 2, Yellow Building | 1 Nicholas Road | London | W11 4AN




The information in this e-mail and any attachment is confidential and is intended only for the named recipient(s). The e-mail may not be disclosed or used by any person other than the addressee, nor may it be copied in any way. If you are not a named recipient please notify the sender immediately and delete any copies of this message. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Any view or opinions presented are solely those of the author and do not necessarily represent those of the company.




More information about the lxc-users mailing list