about summary refs log tree commit diff
path: root/nixos/doc/manual/administration
diff options
context:
space:
mode:
authorBobby Rong <rjl931189261@126.com>2021-07-02 11:59:12 +0800
committerBobby Rong <rjl931189261@126.com>2021-07-02 11:59:12 +0800
commit9b52df304bb8e4f2ef0f00ad1cdabcc3243e7733 (patch)
tree917b84c2ea70bd107cf991ca08d7b30560a7aa75 /nixos/doc/manual/administration
parent4f0efa8d7db269720192f6a4e3a2ffcbe35e30b3 (diff)
downloadnixlib-9b52df304bb8e4f2ef0f00ad1cdabcc3243e7733.tar
nixlib-9b52df304bb8e4f2ef0f00ad1cdabcc3243e7733.tar.gz
nixlib-9b52df304bb8e4f2ef0f00ad1cdabcc3243e7733.tar.bz2
nixlib-9b52df304bb8e4f2ef0f00ad1cdabcc3243e7733.tar.lz
nixlib-9b52df304bb8e4f2ef0f00ad1cdabcc3243e7733.tar.xz
nixlib-9b52df304bb8e4f2ef0f00ad1cdabcc3243e7733.tar.zst
nixlib-9b52df304bb8e4f2ef0f00ad1cdabcc3243e7733.zip
nixos: nixos/doc/manual/administration/container-networking.xml to CommonMark
Diffstat (limited to 'nixos/doc/manual/administration')
-rw-r--r--nixos/doc/manual/administration/container-networking.section.md44
-rw-r--r--nixos/doc/manual/administration/container-networking.xml59
-rw-r--r--nixos/doc/manual/administration/containers.xml2
3 files changed, 45 insertions, 60 deletions
diff --git a/nixos/doc/manual/administration/container-networking.section.md b/nixos/doc/manual/administration/container-networking.section.md
new file mode 100644
index 000000000000..0873768376cc
--- /dev/null
+++ b/nixos/doc/manual/administration/container-networking.section.md
@@ -0,0 +1,44 @@
+# Container Networking {#sec-container-networking}
+
+When you create a container using `nixos-container create`, it gets it
+own private IPv4 address in the range `10.233.0.0/16`. You can get the
+container's IPv4 address as follows:
+
+```ShellSession
+# 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
+```
+
+Networking is implemented using a pair of virtual Ethernet devices. The
+network interface in the container is called `eth0`, while the matching
+interface in the host is called `ve-container-name` (e.g., `ve-foo`).
+The container has its own network namespace and the `CAP_NET_ADMIN`
+capability, so it can perform arbitrary network configuration such as
+setting up firewall rules, without affecting or having access to the
+host's network.
+
+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:
+
+```nix
+networking.nat.enable = true;
+networking.nat.internalInterfaces = ["ve-+"];
+networking.nat.externalInterface = "eth0";
+```
+
+where `eth0` should be replaced with the desired external interface.
+Note that `ve-+` is a wildcard that matches all container interfaces.
+
+If you are using Network Manager, you need to explicitly prevent it from
+managing container interfaces:
+
+```nix
+networking.networkmanager.unmanaged = [ "interface-name:ve-*" ];
+```
+
+You may need to restart your system for the changes to take effect.
diff --git a/nixos/doc/manual/administration/container-networking.xml b/nixos/doc/manual/administration/container-networking.xml
deleted file mode 100644
index 42486f01fe8c..000000000000
--- a/nixos/doc/manual/administration/container-networking.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<section  xmlns="http://docbook.org/ns/docbook"
-          xmlns:xlink="http://www.w3.org/1999/xlink"
-          xmlns:xi="http://www.w3.org/2001/XInclude"
-          version="5.0"
-          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:
-<screen>
-<prompt># </prompt>nixos-container show-ip foo
-10.233.4.2
-
-<prompt>$ </prompt>ping -c1 10.233.4.2
-64 bytes from 10.233.4.2: icmp_seq=1 ttl=64 time=0.106 ms
-</screen>
- </para>
-
- <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-<replaceable>container-name</replaceable></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:
-<programlisting>
-<xref linkend="opt-networking.nat.enable"/> = true;
-<xref linkend="opt-networking.nat.internalInterfaces"/> = ["ve-+"];
-<xref linkend="opt-networking.nat.externalInterface"/> = "eth0";
-</programlisting>
-  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:
-<programlisting>
-networking.networkmanager.unmanaged = [ "interface-name:ve-*" ];
-</programlisting>
- </para>
-
- <para>
-  You may need to restart your system for the changes to take effect.
- </para>
-</section>
diff --git a/nixos/doc/manual/administration/containers.xml b/nixos/doc/manual/administration/containers.xml
index f149ce7bbfe6..8e0e300f367b 100644
--- a/nixos/doc/manual/administration/containers.xml
+++ b/nixos/doc/manual/administration/containers.xml
@@ -30,5 +30,5 @@
  </para>
  <xi:include href="../from_md/administration/imperative-containers.section.xml" />
  <xi:include href="../from_md/administration/declarative-containers.section.xml" />
- <xi:include href="container-networking.xml" />
+ <xi:include href="../from_md/administration/container-networking.section.xml" />
 </chapter>