summary refs log tree commit diff
path: root/nixos/doc/manual/from_md/administration/container-networking.section.xml
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-05-31 09:59:33 +0000
committerAlyssa Ross <hi@alyssa.is>2022-05-31 09:59:57 +0000
commit9ff36293d1e428cd7bf03e8d4b03611b6d361c28 (patch)
tree1ab51a42b868c55b83f6ccdb80371b9888739dd9 /nixos/doc/manual/from_md/administration/container-networking.section.xml
parent1c4fcd0d4b0541e674ee56ace1053e23e562cc80 (diff)
parentddc3c396a51918043bb0faa6f676abd9562be62c (diff)
downloadnixpkgs-archive.tar
nixpkgs-archive.tar.gz
nixpkgs-archive.tar.bz2
nixpkgs-archive.tar.lz
nixpkgs-archive.tar.xz
nixpkgs-archive.tar.zst
nixpkgs-archive.zip
Last good Nixpkgs for Weston+nouveau? archive
I came this commit hash to terwiz[m] on IRC, who is trying to figure out
what the last version of Spectrum that worked on their NUC with Nvidia
graphics is.
Diffstat (limited to 'nixos/doc/manual/from_md/administration/container-networking.section.xml')
-rw-r--r--nixos/doc/manual/from_md/administration/container-networking.section.xml54
1 files changed, 54 insertions, 0 deletions
diff --git a/nixos/doc/manual/from_md/administration/container-networking.section.xml b/nixos/doc/manual/from_md/administration/container-networking.section.xml
new file mode 100644
index 00000000000..788a2b7b0ac
--- /dev/null
+++ b/nixos/doc/manual/from_md/administration/container-networking.section.xml
@@ -0,0 +1,54 @@
+<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-container-networking">
+  <title>Container Networking</title>
+  <para>
+    When you create a container using
+    <literal>nixos-container create</literal>, it gets it own private
+    IPv4 address in the range <literal>10.233.0.0/16</literal>. You can
+    get the container’s IPv4 address as follows:
+  </para>
+  <programlisting>
+# nixos-container show-ip foo
+10.233.4.2
+
+$ ping -c1 10.233.4.2
+64 bytes from 10.233.4.2: icmp_seq=1 ttl=64 time=0.106 ms
+</programlisting>
+  <para>
+    Networking is implemented using a pair of virtual Ethernet devices.
+    The network interface in the container is called
+    <literal>eth0</literal>, while the matching interface in the host is
+    called <literal>ve-container-name</literal> (e.g.,
+    <literal>ve-foo</literal>). The container has its own network
+    namespace and the <literal>CAP_NET_ADMIN</literal> capability, so it
+    can perform arbitrary network configuration such as setting up
+    firewall rules, without affecting or having access to the host’s
+    network.
+  </para>
+  <para>
+    By default, containers cannot talk to the outside network. If you
+    want that, you should set up Network Address Translation (NAT) rules
+    on the host to rewrite container traffic to use your external IP
+    address. This can be accomplished using the following configuration
+    on the host:
+  </para>
+  <programlisting language="bash">
+networking.nat.enable = true;
+networking.nat.internalInterfaces = [&quot;ve-+&quot;];
+networking.nat.externalInterface = &quot;eth0&quot;;
+</programlisting>
+  <para>
+    where <literal>eth0</literal> should be replaced with the desired
+    external interface. Note that <literal>ve-+</literal> is a wildcard
+    that matches all container interfaces.
+  </para>
+  <para>
+    If you are using Network Manager, you need to explicitly prevent it
+    from managing container interfaces:
+  </para>
+  <programlisting language="bash">
+networking.networkmanager.unmanaged = [ &quot;interface-name:ve-*&quot; ];
+</programlisting>
+  <para>
+    You may need to restart your system for the changes to take effect.
+  </para>
+</section>