README.rst
1.. zephyr:code-sample:: bridge
2 :name: bridge
3 :relevant-api: ethernet net_if
4
5 Test and debug Ethernet bridge
6
7Overview
8********
9
10Example on testing/debugging Ethernet bridge
11
12The source code for this sample application can be found at:
13:zephyr_file:`samples/net/ethernet/bridge`.
14
15Building and Running
16********************
17
18Follow these steps to build the bridge sample application:
19
20.. zephyr-app-commands::
21 :zephyr-app: samples/net/ethernet/bridge
22 :board: <board to use>
23 :conf: prj.conf
24 :goals: build
25 :compact:
26
27A quick method to verify the bridge without hardware board is using native_sim application.
28The :zephyr_file:`samples/net/ethernet/bridge/bridge-test-setup.sh` provides a script for host set-up.
29The steps are as below.
30
311. Run script for pre-setup. Two tap interfaces zeth0 and zeth1 will be created.
32
33.. code-block:: console
34
35 bridge-test-setup.sh pre-setup
36
372. Run native_sim application.
38
393. Run script for post-setup. zeth1 will be moved to another net name space. (We couldn't complete this
40 post-setup before running native_sim application, because it seems zephyr iface will not connect
41 interface in net name space.)
42
43.. code-block:: console
44
45 bridge-test-setup.sh post-setup
46
474. Test the bridging between zeth0 and zeth1. The IP will be configured as below.
48 Ping zeth1 in another net name space.
49
50 - zeth0: IPv4 192.0.2.2, IPv6 2001:db8::2
51 - zeth1: IPv4 192.0.2.3, IPv6 2001:db8::3
52
53.. code-block:: console
54
55 ping 192.0.2.3
56 ping 2001:db8::3
57
585. Clean up after testing.
59
60.. code-block:: console
61
62 bridge-test-setup.sh clean
63