Network problems with VLANs on LXC

I’m trying to use an LXC container to test a “router on a stick” style environment.
I have an interface which should have two VLANs on it, one for each side of the router.

I’ve created the first VLAN on the host, and assigned an IPv4 address to it.
I’ve create the second VLAN in an LXC container, using “lxc.net.1.type = vlan”, and assigned a different IPv4 address on a different subnet.

I can ping to the router from both the host and container.

When I try to ping from container to the IP that the host has or vice versa, it doesn’t work.

I can see (with tcpdump in the VLAN, or on the overall interface), that the packets are sent out, and sent back by the router with the VLANs and MAC addresses changed correctly.

But the receiving Linux endpoint just ignores the packets.

Is there something I need to change to allow this to work?

It turned out to be a dumb error - I’d got one character wrong in a MAC address in two places.

1 Like