diff options
author | Bobby Rong <rjl931189261@126.com> | 2021-07-01 23:11:54 +0800 |
---|---|---|
committer | Bobby Rong <rjl931189261@126.com> | 2021-07-01 23:11:54 +0800 |
commit | 3d423e2b1563ef4d38d0bb190935a26b58409b67 (patch) | |
tree | 250ec2cd274e37bedd07a1b1d6deeeba35f1d7cb | |
parent | 83fc29ffb90742fb341a24aa27d2ad344b97a754 (diff) | |
download | nixpkgs-3d423e2b1563ef4d38d0bb190935a26b58409b67.tar nixpkgs-3d423e2b1563ef4d38d0bb190935a26b58409b67.tar.gz nixpkgs-3d423e2b1563ef4d38d0bb190935a26b58409b67.tar.bz2 nixpkgs-3d423e2b1563ef4d38d0bb190935a26b58409b67.tar.lz nixpkgs-3d423e2b1563ef4d38d0bb190935a26b58409b67.tar.xz nixpkgs-3d423e2b1563ef4d38d0bb190935a26b58409b67.tar.zst nixpkgs-3d423e2b1563ef4d38d0bb190935a26b58409b67.zip |
nixos: nixos/doc/manual/configuration/ipv4-config.xml to CommonMark
4 files changed, 79 insertions, 44 deletions
diff --git a/nixos/doc/manual/configuration/ipv4-config.section.md b/nixos/doc/manual/configuration/ipv4-config.section.md new file mode 100644 index 00000000000..8a870df6094 --- /dev/null +++ b/nixos/doc/manual/configuration/ipv4-config.section.md @@ -0,0 +1,35 @@ +# IPv4 Configuration {#sec-ipv4} + +By default, NixOS uses DHCP (specifically, `dhcpcd`) to automatically +configure network interfaces. However, you can configure an interface +manually as follows: + +```nix +networking.interfaces.eth0.ipv4.addresses = [ { + address = "192.168.1.2"; + prefixLength = 24; +} ]; +``` + +Typically you'll also want to set a default gateway and set of name +servers: + +```nix +networking.defaultGateway = "192.168.1.1"; +networking.nameservers = [ "8.8.8.8" ]; +``` + +::: {.note} +Statically configured interfaces are set up by the systemd service +`interface-name-cfg.service`. The default gateway and name server +configuration is performed by `network-setup.service`. +::: + +The host name is set using [`networking.hostName`](options.html#opt-networking.hostName): + +```nix +networking.hostName = "cartman"; +``` + +The default host name is `nixos`. Set it to the empty string (`""`) to +allow the DHCP server to provide the host name. diff --git a/nixos/doc/manual/configuration/ipv4-config.xml b/nixos/doc/manual/configuration/ipv4-config.xml deleted file mode 100644 index 884becf0979..00000000000 --- a/nixos/doc/manual/configuration/ipv4-config.xml +++ /dev/null @@ -1,43 +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-ipv4"> - <title>IPv4 Configuration</title> - - <para> - By default, NixOS uses DHCP (specifically, <command>dhcpcd</command>) to - automatically configure network interfaces. However, you can configure an - interface manually as follows: -<programlisting> -<link linkend="opt-networking.interfaces._name_.ipv4.addresses">networking.interfaces.eth0.ipv4.addresses</link> = [ { - address = "192.168.1.2"; - prefixLength = 24; -} ]; -</programlisting> - Typically you’ll also want to set a default gateway and set of name - servers: -<programlisting> -<xref linkend="opt-networking.defaultGateway"/> = "192.168.1.1"; -<xref linkend="opt-networking.nameservers"/> = [ "8.8.8.8" ]; -</programlisting> - </para> - - <note> - <para> - Statically configured interfaces are set up by the systemd service - <replaceable>interface-name</replaceable><literal>-cfg.service</literal>. - The default gateway and name server configuration is performed by - <literal>network-setup.service</literal>. - </para> - </note> - - <para> - The host name is set using <xref linkend="opt-networking.hostName"/>: -<programlisting> -<xref linkend="opt-networking.hostName"/> = "cartman"; -</programlisting> - The default host name is <literal>nixos</literal>. Set it to the empty string - (<literal>""</literal>) to allow the DHCP server to provide the host name. - </para> -</section> diff --git a/nixos/doc/manual/configuration/networking.xml b/nixos/doc/manual/configuration/networking.xml index c326785dbe3..6203d2ba8dc 100644 --- a/nixos/doc/manual/configuration/networking.xml +++ b/nixos/doc/manual/configuration/networking.xml @@ -10,7 +10,7 @@ </para> <xi:include href="../from_md/configuration/network-manager.section.xml" /> <xi:include href="../from_md/configuration/ssh.section.xml" /> - <xi:include href="ipv4-config.xml" /> + <xi:include href="../from_md/configuration/ipv4-config.section.xml" /> <xi:include href="ipv6-config.xml" /> <xi:include href="firewall.xml" /> <xi:include href="wireless.xml" /> diff --git a/nixos/doc/manual/from_md/configuration/ipv4-config.section.xml b/nixos/doc/manual/from_md/configuration/ipv4-config.section.xml new file mode 100644 index 00000000000..06a70b65cfb --- /dev/null +++ b/nixos/doc/manual/from_md/configuration/ipv4-config.section.xml @@ -0,0 +1,43 @@ +<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-ipv4"> + <title>IPv4 Configuration</title> + <para> + By default, NixOS uses DHCP (specifically, + <literal>dhcpcd</literal>) to automatically configure network + interfaces. However, you can configure an interface manually as + follows: + </para> + <programlisting language="bash"> +networking.interfaces.eth0.ipv4.addresses = [ { + address = "192.168.1.2"; + prefixLength = 24; +} ]; +</programlisting> + <para> + Typically you’ll also want to set a default gateway and set of name + servers: + </para> + <programlisting language="bash"> +networking.defaultGateway = "192.168.1.1"; +networking.nameservers = [ "8.8.8.8" ]; +</programlisting> + <note> + <para> + Statically configured interfaces are set up by the systemd service + <literal>interface-name-cfg.service</literal>. The default gateway + and name server configuration is performed by + <literal>network-setup.service</literal>. + </para> + </note> + <para> + The host name is set using + <link xlink:href="options.html#opt-networking.hostName"><literal>networking.hostName</literal></link>: + </para> + <programlisting language="bash"> +networking.hostName = "cartman"; +</programlisting> + <para> + The default host name is <literal>nixos</literal>. Set it to the + empty string (<literal>""</literal>) to allow the DHCP + server to provide the host name. + </para> +</section> |