mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 18/21] net: update network docs
Date: Fri, 24 Nov 2017 09:12:34 +0100	[thread overview]
Message-ID: <20171124081237.6830-19-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20171124081237.6830-1-s.hauer@pengutronix.de>

The network configuration has changed in the previous patches. Update
the documentation accordingly.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 Documentation/user/networking.rst | 99 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 94 insertions(+), 5 deletions(-)

diff --git a/Documentation/user/networking.rst b/Documentation/user/networking.rst
index 8afb433837..53fa5b3c40 100644
--- a/Documentation/user/networking.rst
+++ b/Documentation/user/networking.rst
@@ -7,6 +7,49 @@ barebox has IPv4 networking support. Several protocols such as :ref:`DHCP
 Network configuration
 ---------------------
 
+Lowlevel network device configuration
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Network devices are configured with a set of device specific variables:
+
++-------------------+--------------+----------------------------------------------------+
+| name              | type         |                                                    |
++===================+==============+====================================================+
+| <devname>.mode    | enum         | "dhcp": DHCP is used to get IP address and netmask |
+|                   |              | "static": Static IP setup described by variables   |
+|                   |              | below                                              |
+|                   |              | "disabled": Interface unused                       |
++===================+==============+====================================================+
+| <devname>.ipaddr  | ipv4 address | The IP address when using static configuration     |
++-------------------+--------------+----------------------------------------------------+
+| <devname>.netmask | ipv4 address | The netmask when using static configuration        |
++-------------------+--------------+----------------------------------------------------+
+| <devname>.gateway | ipv4 address | Alias for global.net.gateway. For                  |
+|                   |              | compatibility, do not use.                         |
++-------------------+--------------+----------------------------------------------------+
+| <devname>.serverip| ipv4 address | Alias for global.net.server. For                   |
+|                   |              | compatibility, do not use.                         |
++-------------------+--------------+----------------------------------------------------+
+| <devname>.ethaddr | MAC address  | The MAC address of this device                     |
++-------------------+--------------+----------------------------------------------------+
+
+Additionally there are some more variables that are not specific to a
+device:
+
++------------------------------+--------------+------------------------------------------------+
+| name                         | type         |                                                |
++==============================+==============+================================================+
+| global.net.gateway           | ipv4 host    | The network gateway used when a host is not in |
+|                              |              | any directly visible subnet. May be set        |
+|                              |              | automatically by DHCP.                         |
++------------------------------+--------------+------------------------------------------------+
+| global.net.server            | ipv4 host    | The default server address. If unspecified, may|
+|                              |              | be set by DHCP                                 |
++------------------------------+--------------+------------------------------------------------+
+| global.net.nameserver        | ipv4 address | The DNS server used for resolving host names.  |
+|                              |              | May be set by DHCP                             |
++------------------------------+--------------+------------------------------------------------+
+
 The first step for networking is configuring the network device. The network
 device is usually ``eth0``. The current configuration can be viewed with the
 :ref:`devinfo <command_devinfo>` command:
@@ -16,10 +59,9 @@ device is usually ``eth0``. The current configuration can be viewed with the
   barebox:/ devinfo eth0
   Parameters:
     ethaddr: 00:1c:49:01:03:4b
-    gateway: 192.168.23.1
     ipaddr: 192.168.23.197
     netmask: 255.255.0.0
-    serverip: 192.168.23.1
+    [...]
 
 The configuration can be changed on the command line with:
 
@@ -30,9 +72,56 @@ The configuration can be changed on the command line with:
 The :ref:`dhcp command <command_dhcp>` will change the settings based on the answer
 from the DHCP server.
 
-This low-level configuration of the network interface is often not necessary. Normally
-the network settings should be edited in ``/env/network/eth0``, then the network interface
-can be brought up using the :ref:`ifup command <command_ifup>`.
+To make the network device settings persistent across reboots there is a nonvolatile
+variable (nvvar) for each of the varariables above. The network device specific variables
+are:
+
+.. code-block:: sh
+
+  nv.dev.<devname>.mode
+  nv.dev.<devname>.ipaddr
+  nv.dev.<devname>.netmask
+  nv.dev.<devname>.ethaddr
+
+The others are:
+
+.. code-block:: sh
+
+  nv.net.gateway
+  nv.net.server
+  nv.net.nameserver
+
+A typical simple network setting is to use DHCP. Provided the network interface is eth0
+then this would configure the network device for DHCP:
+
+.. code-block:: sh
+
+  nv dev.eth0.mode=dhcp
+
+(In fact DHCP is the default, so the above is not necessary)
+
+A static setup would look like:
+
+.. code-block:: sh
+
+  nv dev.eth0.mode=static
+  nv dev.eth0.ipaddr=192.168.0.17
+  nv dev.eth0.netmask=255.255.0.0
+  nv net.server=192.168.0.1
+
+The settings can be activated with the :ref:`ifup command <command_ifup>`:
+
+.. code-block:: sh
+
+  ifup eth0
+
+or:
+
+.. code-block:: sh
+
+  ifup -a
+
+'ifup -a' will activate all ethernet interfaces, also the ones on USB.
 
 Network filesystems
 -------------------
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2017-11-24  8:13 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-24  8:12 Networking updates Sascha Hauer
2017-11-24  8:12 ` [PATCH 01/21] driver: Add device_detect_all() function Sascha Hauer
2017-11-24 23:34   ` Sam Ravnborg
2017-11-28  7:58     ` Sascha Hauer
2017-11-28 22:52       ` Sam Ravnborg
2017-11-24  8:12 ` [PATCH 02/21] nvvar: when setting a nvvar to NULL just free the content Sascha Hauer
2017-11-24  8:12 ` [PATCH 03/21] net: Make domainname and nameserver globalvars Sascha Hauer
2017-11-24  8:12 ` [PATCH 04/21] net: Add functions to get/set nameserver and domainname Sascha Hauer
2017-11-24 23:47   ` Sam Ravnborg
2017-11-27 15:18     ` Sascha Hauer
2017-11-24  8:12 ` [PATCH 05/21] net: introduce global.net.server Sascha Hauer
2017-11-24  8:12 ` [PATCH 06/21] net: dhcp: Do not overwrite serverip if it is valid Sascha Hauer
2017-11-25 16:36   ` Sam Ravnborg
2017-11-28  7:42     ` Sascha Hauer
2017-11-24  8:12 ` [PATCH 07/21] net: Use a single gateway Sascha Hauer
2017-11-24  8:12 ` [PATCH 08/21] net: allow udp connections on specified network device Sascha Hauer
2017-11-25 16:41   ` Sam Ravnborg
2017-11-27 14:45     ` Sascha Hauer
2017-11-24  8:12 ` [PATCH 09/21] net: dhcp: Allow to specify " Sascha Hauer
2017-11-25 16:46   ` Sam Ravnborg
2017-11-28  7:50     ` Sascha Hauer
2017-11-24  8:12 ` [PATCH 10/21] net: dhcp: avoid unnecessary casts Sascha Hauer
2017-11-24  8:12 ` [PATCH 11/21] net: dhcp: Coding style fixes Sascha Hauer
2017-11-24  8:12 ` [PATCH 12/21] net: dhcp: rework Sascha Hauer
2017-11-25 17:02   ` Sam Ravnborg
2017-11-28  7:54     ` Sascha Hauer
2017-11-24  8:12 ` [PATCH 13/21] net: Pick network device based on IP settings Sascha Hauer
2017-11-24  8:12 ` [PATCH 14/21] net: remove "current" network device Sascha Hauer
2017-11-24  8:12 ` [PATCH 15/21] net: ifup: Factor out a eth_discover function Sascha Hauer
2017-11-24  8:12 ` [PATCH 16/21] ifup: Use dhcp C API rather than running command Sascha Hauer
2017-11-24  8:12 ` [PATCH 17/21] net: Provide new way to configure network devices Sascha Hauer
2017-11-24  8:12 ` Sascha Hauer [this message]
2017-11-24  8:12 ` [PATCH 19/21] net: environment: remove ethx setup files Sascha Hauer
2017-11-24  8:12 ` [PATCH 20/21] net: environment: update automounts Sascha Hauer
2017-11-24  8:12 ` [PATCH 21/21] defaultenv: Add README for new network config Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171124081237.6830-19-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox