1.. _net_config_interface:
2
3Network Configuration Library
4#############################
5
6.. contents::
7    :local:
8    :depth: 2
9
10Overview
11********
12
13The network configuration library sets up networking devices in a
14semi-automatic way during the system boot, based on user-supplied
15Kconfig options.
16
17The following Kconfig options affect how configuration library will
18setup the system:
19
20.. csv-table:: Kconfig options for network configuration library
21   :header: "Option name", "Description"
22   :widths: 45 55
23
24   ":kconfig:option:`CONFIG_NET_CONFIG_SETTINGS`", "This option controls whether the
25   network system is configured or initialized at all. If not set, then the
26   config library is not used for initialization and the application needs to
27   do all the network related configuration itself. If this option is set,
28   then the user can optionally configure static IP addresses to be set to the
29   first network interface in the system. Typically setting static IP addresses
30   is only usable in testing and should not be used in production code. See
31   the config library Kconfig file :zephyr_file:`subsys/net/lib/config/Kconfig`
32   for specific options to set the static IP addresses."
33   ":kconfig:option:`CONFIG_NET_CONFIG_AUTO_INIT`", "The networking system is
34   automatically configured when the device is started."
35   ":kconfig:option:`CONFIG_NET_CONFIG_INIT_TIMEOUT`", "This tells how long to wait for
36   the networking to be ready and available. If for example IPv4 address from
37   DHCPv4 is not received within this limit, then a call to
38   ``net_config_init()`` will return error during the device startup."
39   ":kconfig:option:`CONFIG_NET_CONFIG_NEED_IPV4`", "The network application needs IPv4
40   support to function properly. This option makes sure the network application
41   is initialized properly in order to use IPv4.
42   If :kconfig:option:`CONFIG_NET_IPV4` is not enabled, then setting this option will
43   automatically enable IPv4."
44   ":kconfig:option:`CONFIG_NET_CONFIG_NEED_IPV6`", "The network application needs IPv6
45   support to function properly. This option makes sure the network application
46   is initialized properly in order to use IPv6.
47   If :kconfig:option:`CONFIG_NET_IPV6` is not enabled, then setting this option will
48   automatically enable IPv6."
49   ":kconfig:option:`CONFIG_NET_CONFIG_NEED_IPV6_ROUTER`", "If IPv6 is enabled, then
50   this option tells that the network application needs IPv6 router to exists
51   before continuing. This means in practice that the application wants to wait
52   until it receives IPv6 router advertisement message before continuing."
53   ":kconfig:option:`CONFIG_NET_CONFIG_MY_IPV6_ADDR`","Local static IPv6 address assigned to
54   the default network interface."
55   ":kconfig:option:`CONFIG_NET_CONFIG_PEER_IPV6_ADDR`","Peer static IPv6 address. This is mainly
56   useful in testing setups where the application can connect to a pre-defined host."
57   ":kconfig:option:`CONFIG_NET_CONFIG_MY_IPV4_ADDR`","Local static IPv4 address assigned to
58   the default network interface."
59   ":kconfig:option:`CONFIG_NET_CONFIG_MY_IPV4_NETMASK`","Static IPv4 netmask assigned to the IPv4
60   address."
61   ":kconfig:option:`CONFIG_NET_CONFIG_MY_IPV4_GW`","Static IPv4 gateway address assigned to the
62   default network interface."
63   ":kconfig:option:`CONFIG_NET_CONFIG_PEER_IPV4_ADDR`","Peer static IPv4 address. This is mainly
64   useful in testing setups where the application can connect to a pre-defined host."
65
66Sample usage
67************
68
69If :kconfig:option:`CONFIG_NET_CONFIG_AUTO_INIT` is set, then the configuration library
70is automatically enabled and run during the device boot. In this case,
71the library will call ``net_config_init()`` automatically and the application
72does not need to do any network configuration.
73
74If you want to use the network configuration library but without automatic
75initialization, you can call ``net_config_init()`` manually. The ``flags``
76parameter can be used to give hints to the library about what kind of
77functionality the application wishes to have before the actual application
78starts.
79
80API Reference
81*************
82
83.. doxygengroup:: net_config
84