zephyr/samples/net/ipv4_autoconf
Alberto Escolar Piedras 442a3e2c5c samples/net several: Use hwmv2 native targets identifiers
For the 64 bit targets, change identifiers to the new hwmv2 ones.
And remove redundant overlays (which were equal for the 32
and 64 bit versions)

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-15 16:13:12 +01:00
..
boards hwmv2: Introduce Hardware model version 2 and convert devices 2024-03-02 16:56:33 -05:00
src samples: net: Change samples to support new IPv4 netmask setting API 2024-03-03 18:58:29 +01:00
CMakeLists.txt cmake: increase minimal required version to 3.20.0 2021-08-20 09:47:34 +02:00
prj.conf samples: net: ipv4_autoconf: Convert to new logging system 2018-10-04 14:13:57 +03:00
README.rst samples: net: doc: Use new Sphinx extension to document networking samples 2023-09-19 15:22:59 +01:00
sample.yaml samples/net several: Use hwmv2 native targets identifiers 2024-03-15 16:13:12 +01:00

.. zephyr:code-sample:: ipv4-autoconf
   :name: IPv4 autoconf client
   :relevant-api: networking net_if net_context net_mgmt

   Perform IPv4 autoconfiguration and self-assign a random IPv4 address

Overview
********

This sample application starts a IPv4 autoconf and self-assigns
a random IPv4 address in the 169.254.0.0/16 range, it defends
the IPv4 address and resolves IPv4 conflicts if multiple
parties try to allocate an identical address.

Requirements
************

- :ref:`networking_with_host`

Building and Running
********************

These are instructions for how to use this sample application running
on a :ref:`frdm_k64f` board to configure a link local IPv4 address and
connect to a Linux host.

Connect ethernet cable from a :ref:`Freedom-K64F board <frdm_k64f>` to a Linux
host machine and check for new interfaces.

Running Avahi client in Linux Host
==================================

Assign a IPv4 link local address to the interface in the Linux system

.. code-block:: console

   $ avahi-autoipd --force-bind -D eth0


FRDM_K64F
=========

Build Zephyr the ``samples/net/ipv4_autoconf`` application using these
steps:

.. zephyr-app-commands::
   :zephyr-app: samples/net/ipv4_autoconf
   :host-os: unix
   :board: frdm_k64f
   :goals: build flash
   :compact:

Once IPv4 LL has completed probing and announcement, details are shown like this:

.. code-block:: console

   $ sudo screen /dev/ttyACM0 115200

.. code-block:: console

   [ipv4ll] [INF] main: Run ipv4 autoconf client
   [ipv4ll] [INF] handler: Your address: 169.254.218.128

Note that the IP address may change at each self assignment.

To verify the Zephyr application is running and has configured an IP address
type:

.. code-block:: console

   $ ping -I eth1 169.254.218.128