Forrest logo
back to the lxc tool

lxc-network:tldr:a49e4

lxc-network: Add a running instance to a specific network.
$ lxc network attach ${network_name} ${container_name}
try on your machine

The command "lxc network attach ${network_name} ${container_name}" is used to attach a network interface from a specific network to a container in LXC (Linux Containers) virtualization.

Here is a breakdown of the command:

  • "lxc" is the command-line tool used for managing LXC containers.
  • "network" is the subcommand that deals with network-related operations.
  • "attach" is a specific action taken on the network interfaces of a container.
  • "${network_name}" is a placeholder that represents the name of the network interface you want to attach. You need to replace it with the actual name of the network interface.
  • "${container_name}" is another placeholder that represents the name of the container you want to attach the network interface to. Similarly, you need to replace it with the actual name of the container.

By executing this command, you are instructing LXC to attach the specified network interface to the specified container, allowing the container to connect to the network defined by that interface.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the lxc tool