Difference between revisions of "LXD & LXC"

From NixNet
m (remove quotes)
Line 6: Line 6:
  
 
[[Category:Admin guides]]
 
[[Category:Admin guides]]
 +
 +
# LXD Networking
 +
 +
To bind a container to a host port with NAT, you first need a static IP on the container:
 +
<pre>
 +
lxc attach lxdbr0 <instance> eth0 eth0
 +
lxc config device set <instance> eth0 ipv4.address=<container-ip>
 +
</pre>
 +
 +
Then the proxy device needs to be added:
 +
<pre>
 +
lxc config device add <instance> port-forward proxy connect=tcp:<container-ip>:<port> listen=tcp:<host-ip>:<port>
 +
</pre>

Revision as of 05:02, 23 March 2021

This article is part of a series of guides that describe NixNet's setup in excruciating detail. If you would like to follow them, please start at the Infrastructure page.
Caution: this guide is not finished yet; following it may leave you with an unuseable machine. To be notified of updates, please create an account and add it to your watchlist.
  1. LXD Networking

To bind a container to a host port with NAT, you first need a static IP on the container:

lxc attach lxdbr0 <instance> eth0 eth0
lxc config device set <instance> eth0 ipv4.address=<container-ip>

Then the proxy device needs to be added:

lxc config device add <instance> port-forward proxy connect=tcp:<container-ip>:<port> listen=tcp:<host-ip>:<port>