Difference between revisions of "LXD & LXC"

From NixNet
Line 17: Line 17:
 
Then the proxy device needs to be added:
 
Then the proxy device needs to be added:
 
<pre>
 
<pre>
lxc config device add <instance> port-forward proxy connect=tcp:<container-ip>:<port> listen=tcp:<host-ip>:<port>
+
lxc config device add <instance> port-forward proxy connect=tcp:<container-ip>:<port> listen=tcp:<host-ip>:<port> nat=true
 
</pre>
 
</pre>

Revision as of 05:03, 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> nat=true