Connecting LXC to the host network

There are three main modes of connecting LXC containers to the host network:

  • Using a physical network interface on the host OS, which requires one physical interface on the host for each container
  • Using a virtual interface connected to the host software bridge using NAT
  • Sharing the same network namespace as the host, using the host network device in the container

The container configuration file provides the lxc.network.type option as we saw earlier in Table 5.1. Let's take a look at the available parameters for that configuration option:

Parameter

Description

none

The container will share the host's network namespace.

empty

LXC will create only the loopback interface.

veth

A virtual interface is created on ...

Get Containerization with LXC now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.