|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| docker/ | | 11-Mar-2024 | - | 486 | 352 |
| libcoap/ | | 11-Mar-2024 | - | 24,481 | 16,307 |
| mbedtls-2.4.0/ | | 11-Mar-2024 | - | 174,048 | 123,507 |
| python-websocket-server/ | | 11-Mar-2024 | - | 840 | 631 |
| systemd/ | | 11-Mar-2024 | - | 56 | 40 |
| tinydtls-0.8.2/ | | 11-Mar-2024 | - | 25,524 | 17,937 |
| virtual-hub/ | | 11-Mar-2024 | - | 586 | 444 |
| .gitignore | D | 11-Mar-2024 | 2.2 KiB | 111 | 100 |
| Makefile | D | 11-Mar-2024 | 2.3 KiB | 86 | 59 |
| README NAT.md | D | 11-Mar-2024 | 2.8 KiB | 81 | 60 |
| README.docker | D | 11-Mar-2024 | 1.6 KiB | 55 | 35 |
| README.legacy | D | 11-Mar-2024 | 5.9 KiB | 238 | 150 |
| README.md | D | 11-Mar-2024 | 7.6 KiB | 265 | 218 |
| avahi-daemon.conf | D | 11-Mar-2024 | 1,017 | 50 | 22 |
| avahi-daemon.sh | D | 11-Mar-2024 | 45 | 4 | 1 |
| big-file.html | D | 11-Mar-2024 | 1.5 KiB | 16 | 14 |
| ca.crt | D | 11-Mar-2024 | 1.1 KiB | 20 | 19 |
| client.crt | D | 11-Mar-2024 | 1,001 | 18 | 17 |
| client_privkey.pem | D | 11-Mar-2024 | 1.6 KiB | 28 | 27 |
| coap-client.c | D | 11-Mar-2024 | 47.3 KiB | 1,912 | 1,506 |
| dnsmasq.conf | D | 11-Mar-2024 | 483 | 21 | 11 |
| dnsmasq.sh | D | 11-Mar-2024 | 43 | 4 | 1 |
| dnsmasq_nat.conf | D | 11-Mar-2024 | 195 | 12 | 7 |
| docker.conf | D | 11-Mar-2024 | 1 KiB | 43 | 28 |
| docker.conf.stop | D | 11-Mar-2024 | 153 | 5 | 3 |
| dtls-client.c | D | 11-Mar-2024 | 22 KiB | 666 | 508 |
| dtls-server.c | D | 11-Mar-2024 | 11 KiB | 463 | 326 |
| echo-apps-cert.pem | D | 11-Mar-2024 | 1.1 KiB | 19 | 18 |
| echo-apps-key.pem | D | 11-Mar-2024 | 1.6 KiB | 28 | 27 |
| echo-client.c | D | 11-Mar-2024 | 22.6 KiB | 771 | 647 |
| echo-server.c | D | 11-Mar-2024 | 14.1 KiB | 630 | 492 |
| http-server.py | D | 11-Mar-2024 | 806 | 34 | 24 |
| https-server.pem | D | 11-Mar-2024 | 2.7 KiB | 47 | 46 |
| https-server.py | D | 11-Mar-2024 | 1.4 KiB | 52 | 28 |
| index.html | D | 11-Mar-2024 | 178 | 9 | 8 |
| loop-ppp-dev.sh | D | 11-Mar-2024 | 929 | 34 | 10 |
| loop-pppd.sh | D | 11-Mar-2024 | 1 KiB | 40 | 18 |
| loop-radvd.sh | D | 11-Mar-2024 | 1.7 KiB | 74 | 45 |
| loop-slip-tap.sh | D | 11-Mar-2024 | 1.2 KiB | 48 | 22 |
| loop-slip.sh | D | 11-Mar-2024 | 1.1 KiB | 45 | 21 |
| loop-socat.sh | D | 11-Mar-2024 | 927 | 33 | 9 |
| monitor_15_4.c | D | 11-Mar-2024 | 10.1 KiB | 507 | 383 |
| nat.conf | D | 11-Mar-2024 | 685 | 29 | 16 |
| nat.conf.stop | D | 11-Mar-2024 | 229 | 7 | 5 |
| nat.png | D | 11-Mar-2024 | 63 KiB | | |
| net-capture.py | D | 11-Mar-2024 | 2.9 KiB | 100 | 72 |
| net-setup.sh | D | 11-Mar-2024 | 2.9 KiB | 140 | 95 |
| radvd_native_posix.conf | D | 11-Mar-2024 | 577 | 34 | 26 |
| radvd_slip.conf | D | 11-Mar-2024 | 577 | 34 | 26 |
| start-leshan.sh | D | 11-Mar-2024 | 822 | 19 | 11 |
| stop-leshan.sh | D | 11-Mar-2024 | 152 | 5 | 2 |
| stunnel.conf | D | 11-Mar-2024 | 1.1 KiB | 48 | 41 |
| stunnel.sh | D | 11-Mar-2024 | 739 | 25 | 6 |
| stunnel_sc.conf | D | 11-Mar-2024 | 721 | 32 | 27 |
| tcptest.py | D | 11-Mar-2024 | 3.4 KiB | 119 | 79 |
| throughput-client.c | D | 11-Mar-2024 | 18 KiB | 596 | 497 |
| tunslip6.c | D | 11-Mar-2024 | 27.7 KiB | 1,172 | 952 |
| zephyr-websocket-server.py | D | 11-Mar-2024 | 943 | 30 | 18 |
| zeth-tunnel.conf | D | 11-Mar-2024 | 2.4 KiB | 70 | 48 |
| zeth-tunnel.conf.stop | D | 11-Mar-2024 | 507 | 20 | 15 |
| zeth-vlan.conf | D | 11-Mar-2024 | 1.8 KiB | 63 | 43 |
| zeth.conf | D | 11-Mar-2024 | 502 | 21 | 12 |
| zeth.conf.stop | D | 11-Mar-2024 | 98 | 6 | 3 |
| zeth0-gptp.conf | D | 11-Mar-2024 | 139 | 7 | 4 |
| zeth1-gptp.conf | D | 11-Mar-2024 | 140 | 7 | 4 |
README NAT.md
1# Create NAT and routing for Zephyr native network on Linux
2
3This page describes how you can set up a networking rules that allows you to run Zephyr applications
4build to native_posix or QEMU targets and get them to access public Internet.
5
6
7
8![Network overview](nat.png)
9
10Zephyr applications, when build on native_posix or various qemu targets,
11run simulated Ethernet driver that attaches itself to a network interface called zeth.
12This is Linux TAP interface so it can send and receive Ethernet frames.
13
14In order to have networking with Zephyr, you need to configure IP address on linux kernel side,
15set up the routing and have NAT (Network Address Translation / IP masquerading) for outbound
16traffic.
17
18Optionally, having dnsmasq to serve as small stand-alone DHCP and DNS server helps.
19When running dnsmasq, it must bind into the zeth interface, so it does not serve any
20requests coming from outside network.
21
22## Building the Zephyr application for native networking
23
24At minimun, you need following Kconfig settings for your *native_posix* application to have
25working network
26
27```
28# General network requirements
29CONFIG_NETWORKING=y
30CONFIG_NET_IPV4=y
31CONFIG_NET_TCP=y
32CONFIG_NET_UDP=y
33CONFIG_NET_SOCKETS=y
34
35# Native posix requirements
36CONFIG_ENTROPY_GENERATOR=y
37CONFIG_TEST_RANDOM_GENERATOR=y
38
39CONFIG_NET_L2_ETHERNET=y
40CONFIG_ETH_NATIVE_POSIX=y
41CONFIG_ETH_NATIVE_POSIX_RANDOM_MAC=y
42
43# IPv4 config
44CONFIG_NET_CONFIG_SETTINGS=y
45CONFIG_NET_CONFIG_NEED_IPV4=y
46CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
47CONFIG_NET_CONFIG_MY_IPV4_GW="192.0.2.2"
48CONFIG_DNS_RESOLVER=y
49CONFIG_DNS_RESOLVER_MAX_SERVERS=1
50CONFIG_DNS_SERVER_IP_ADDRESSES=y
51CONFIG_DNS_SERVER1="192.0.2.2"
52```
53
54## Running the native_posix app
55
56You can test your configuration for example in `zephyr/samples/net/sockets/http_get` by creating
57a file called `boards/native_posix.conf` with the content from the sample above.
58
59```sh
60cd zephyr/samples/net/sockets/http_get
61# create boards/native_posix.conf
62
63# Building the application
64west build -b native_posix -- -DOVERLAY_CONFIG=overlay-tls.conf
65
66# Run the application
67# Note that you need to run it realtime (-rt) so responses don't timeout,
68# otherwise it would run faster.
69# Also any TLS/DTLS traffic needs proper seed or random generator,
70# $RANDOM is adequate enough for testing purposes, not secure though,
71./build/zephyr/zephyr.elf -rt -seed=$RANDOM
72
73# Run application that use shell, for example lwm2m_client
74# These spawn the shell and logs into a virtual serial port on /dev/pts/X
75# it is easier to open a x-terminal to this serial port when you start the application
76./build/zephyr/zephyr.elf -rt -seed=$RANDOM -attach_uart
77```
78
79You might need to supply also `-attach_uart_cmd` parameter, in case default X-terminal is not
80installed. For example `-attach_uart_cmd='x-terminal-emulator -e screen %s &'` works.
81
README.docker
1# Testing with net-tools and Docker
2
3* Create Docker image
4
5 cd docker/
6 docker build -t net-tools .
7
8* Setup network interfaces, IP addresses and routes
9
10 sudo ./net-setup.sh --config docker.conf start
11
12* Run Docker image
13
14 Set the docker internal network name to the value $DOCKER_USER_INTERFACE
15 in docker.config above, default is 'net-tools0'. The bridge network that
16 docker creates will be printed on standard out, it's bridge interface
17 name will be br-XXXXXXXXXXXX. Check that the IPv4 and IPv6 addresses
18 given on the docker command line match the subnets in 'docker.conf'.
19
20 Interactively:
21
22 docker run --hostname=zephyr --name=net-tools \
23 --ip=192.0.2.2 --ip6=2001:db8::2 \
24 --rm -it --network=net-tools0 net-tools sh
25
26 exit with Ctrl-p ctrl-q to execute tests from the command line
27
28 Non-interactively
29
30 docker run --hostname=zephyr --name=net-tools \
31 --ip=192.0.2.2 --ip6=2001:db8::2 \
32 --rm -dt --network=net-tools0 net-tools sh
33
34* Run Qemu / native-posix image
35
36 rm -rf build && mkdir build
37
38 cmake -GNinja -DBOARD=native_posix -B build
39 or
40 cmake -GNinja -DBOARD=qemu_x86 -DOVERLAY_CONFIG=overlay-e1000.conf \
41 -B build
42
43 ninja -C build run
44
45* Execute tests like echo-client
46
47 docker container exec net-tools /net-tools/echo-client 2001:db8::1
48 docker container exec net-tools /net-tools/echo-client -t 2001:db8::1
49 docker container exec net-tools /net-tools/echo-client 192.0.2.1
50 docker container exec net-tools /net-tools/echo-client -t 192.0.2.1
51
52* Remove the network setup:
53
54 sudo ./net-setup.sh --config docker.conf stop
55
README.legacy
1The comments and instructions below are for legacy IP stack in Zephyr.
2
3tunslip6
4========
5
6tunslip6 can be used in host side to create a tun device that
7is connected to a unix socket that qemu is providing. This
8way it is possible to pass packets between host and target
9system via slip protocol.
10
11You need to connect tunslip6 to the second qemu serial line
12through a UNIX socket (qemu option -serial unix:/tmp/slip-socket).
13
141) Start socat
15
16$ socat PTY,link=/tmp/slip.dev UNIX-LISTEN:/tmp/slip.sock
17
182) Start qemu, use the listener demo app. Note that you need to
19 set CONFIG_NETWORKING_UART=y in your configuration.
20
21 You might need to set the platform and ARCH like this if simple_uart
22 driver is not found in your default platform.
23
24$ make PLATFORM_CONFIG=basic_cortex_m3 ARCH=arm \
25 QEMU_EXTRA_FLAGS="-serial none -serial unix:/tmp/slip.sock" qemu
26
27 or just simply
28
29$ make qemu
30
313) Start tunslip6
32
33$ sudo ./tunslip6 -s `readlink /tmp/slip.dev` 2001:db8::1/64
34
354) Send data to listener
36
37$ nc -u -6 2001:db8::2 4242 <<EOF
38foobar
39EOF
40
41There are also convenience scripts for running socat, radvd and
42tunslip6 processes called loop-socat.sh, loop-radvd.sh and
43loop-slip.sh. So to simplify things you need three terminals
44for doing this:
45
46Terminal 1:
47$ ./loop-socat.sh
48
49Terminal 2:
50$ sudo ./loop-slip.sh
51
52Terminal 3:
53$ sudo ./loop-radvd.sh
54
55After running these scripts you do not need to manual restart
56them when qemu process stops.
57
58
59radvd
60=====
61In order the IPv6 stateless address auto configuration (SLAAC)
62to work, you need to run radvd or similar tool in host side.
63There is an example radvd.conf file present in the tools directory.
64
65$ sudo radvd -d 1 -C radvd.conf -m stderr
66
67
68tunslip
69=======
70
71tunslip if for IPv4 networks and it can be used in host side
72to create a tun device that is connected to a unix socket that
73qemu is providing. This way it is possible to pass packets
74between host and target system via slip protocol.
75
76You need to connect tunslip to the second qemu serial line
77through a UNIX socket (qemu option -serial unix:/tmp/slip-socket).
78
791) Start socat
80
81$ socat PTY,link=/tmp/slip.dev UNIX-LISTEN:/tmp/slip.sock
82
832) Start qemu, use the listener demo app. Note that you need to
84 set CONFIG_NETWORKING_UART=y in your configuration.
85
86 You might need to set the platform and ARCH like this if simple_uart
87 driver is not found in your default platform.
88
89$ make PLATFORM_CONFIG=basic_cortex_m3 ARCH=arm \
90 QEMU_EXTRA_FLAGS="-serial none -serial unix:/tmp/slip.sock" qemu
91
923) Start tunslip
93
94$ sudo ./tunslip -s `readlink /tmp/slip.dev` 192.0.2.1 255.255.255.0
95
964) Send data to listener
97
98$ nc -u 192.0.2.2 4242 <<EOF
99foobar
100EOF
101
102
103echo-client
104===========
105
106echo-client is a tool that is run in Linux host side and
107which sends pre-defined UDP data packets to echo-server
108application that is running in qemu side. This client
109process verifies that it is able to receive data correctly
110from the echo-server and thus verify that the upper layer
111networking components in Zephyr IP stack work properly.
112
113You needs to setup the slip connection (see the steps 1 to 3)
114in tunslip6 section of this document.
115
116Example:
117
118$ ./echo-client 2001:db8::2
119
120In order to send multicast IPv6 packets, one needs to
121give the network interface as a parameter.
122
123$ ./echo-client -i tun0 ff84::2
124
125
126echo-server
127===========
128
129echo-server is a tool that is run in Linux host side and
130which waits UDP data sent by echo-client application that
131is running in qemu side.
132
133You needs to setup the slip connection (see the steps 1 to 3)
134in tunslip6 section of this document. Make sure that the Linux
135host firewall is not blocking the packets that the echo-client
136running in qemu is sending via tun0 device.
137
138Example:
139
140$ sudo ./echo-server -i tun0
141
142
143dtls-client
144===========
145
146dtls-client is a tool that is run in Linux host side and
147which connects to dtls-server running in qemu.
148
149You needs to setup the slip connection (see the steps 1 to 3)
150in tunslip6 section of this document.
151
152Example:
153
154$ make dtls-client
155
156$ ./dtls-client -b 2001:db8::1 2001:db8::2
157
158
159dtls-server
160===========
161
162dtls-server is a tool that is run in Linux host side and
163which waits DTLS data sent by dtls-client application that
164is running in qemu side.
165
166You needs to setup the slip connection (see the steps 1 to 3)
167in tunslip6 section of this document.
168
169Example:
170
171$ make dtls-server
172
173$ ./dtls-server -i tun0
174
175monitor_15_4
176============
177
178monitor_15_4 is a tool that is run in Linux host side and
179which reads data from pipes which is written buy 15.4 test
180application from qemu. This is T juntion tool which reads
181and writes data from pipes and feed into pipes (this way
182both qemus communicate each other) and same time data
183written in PCAP format for wireshark monitoring.
184
185Please also read samples/network/test_15_4/README for
186how to configure and run two qemus.
187
188Make and run this tool
189
190$ make
191
192Usage : monitor_15_4 <sample pcap file> [<pipe_1> <pipe_2>]
193
194$ monitor_15_4 sample.pcap
195
196or
197
198$ monitor_15_4 sample.pcap /tmp/ip-15-4-1 /tmp/ip-15-4-2
199
200
201coap-client
202===========
203
204coap-client is a tool that is run in Linux host side and
205which connects to coap-server running in qemu.
206
207You needs to setup the slip connection (see the steps 1 to 3)
208in tunslip6 section of this document.
209
210Example:
211
212$ make coap-client
213
214If you want to use DTLS then run client like this
215$ sudo ./coap-client -i tun0 2001:db8::2
216
217For non-DTLS case, run client like this
218$ sudo ./coap-client -n -i tun0 2001:db8::2
219
220
221coap-observe-client
222===================
223
224You can test the coap-observe-client that is running in qemu
225using the coap-server example server that is found in libcoap.
226So get libcoap package which can be found here
227https://github.com/obgm/libcoap.git
228Compile and install the libcoap library in host.
229
230You needs to setup the slip connection (see the steps 1 to 3)
231in tunslip6 section of this document.
232
233$ /home/user/libcoap/examples/coap-server -A 2001:db8::1 -p 5683
234
235Then in the samples/network/coap_observe_client directory, say
236
237$ make qemu
238
README.md
1[![Run Status](https://api.shippable.com/projects/58ffb2b81fb3ec0700e1602f/badge?branch=master)](https://app.shippable.com/github/zephyrproject-rtos/net-tools)
2
3# Networking Tools
4
5The comments and instructions below are for the new IP stack in Zephyr.
6
7Here are instructions how to communicate between Zephyr that is running
8inside QEMU, and host device that is running Linux.
9
10For setting up routing and NAT rules to allow access to external networks, please see
11the [README NAT.md](README%20NAT.md)
12
13You need to run *socat* and *tunslip* to create a minimally working
14network setup.
15
16There are convenience scripts (_loop-socat.sh_ and _loop-slip-tap.sh_) for
17running socat and tunslip6 processes. For running these, you need two
18terminals.
19
20Terminal 1:
21```
22$ ./loop-socat.sh
23```
24
25Terminal 2:
26```
27$ sudo ./loop-slip-tap.sh
28```
29
30After running these scripts you do not need to manually restart
31them when qemu process stops.
32
33In the Qemu side, you need to compile the kernel with proper config.
34Minimally you need these settings active in your project config file.
35```
36CONFIG_NETWORKING=y
37CONFIG_NET_IPV6=y
38CONFIG_NET_IPV4=y
39CONFIG_NET_YAIP=y
40CONFIG_NET_UDP=y
41CONFIG_NET_LOG=y
42CONFIG_NET_SLIP=y
43CONFIG_SLIP_TAP=y
44CONFIG_SYS_LOG=y
45CONFIG_SYS_LOG_SHOW_COLOR=y
46CONFIG_NANO_TIMEOUTS=y
47CONFIG_TEST_RANDOM_GENERATOR=y
48```
49
50After you have the loop scripts and Qemu running running you can communicate
51with the Zephyr.
52
53If your have echo-server running in the Qemu, then you can use the echo-client
54tool in net-tools directory to communicate with it.
55```
56# ./echo-client -i tap0 2001:db8::1
57```
58The IP stack responds to ping requests if properly configured.
59```
60$ ping6 -I tap0 -c 1 2001:db8::1
61```
62You can attach wireshark to tap0 interface to see what data is being
63transferred.
64
65If building with CONFIG_NET_TCP=y in your project config file, it's possible
66to run the echo-server sample in Zephyr, and then test the TCP stack using
67the supplied tcptest.py script:
68```
69$ ./tcptest.py tap0 2001:db8::1
70```
71This script will send numbers to the echo-server program, read them back,
72and compare if it got the exact bytes back. Transmission errors, timeouts,
73and time to get the response are all recorded and printed to the standard
74output.
75
76Be sure to use Python 3, as it requires a function from the socket module
77that's only available in this version (wrapper around if_nametoindex(3)).
78
79
80## Using net-setup.sh script to setup host side ethernet interface
81
82The net-setup.sh script can setup an ethernet interface to the host.
83User is able to setup a configuration file that will contain
84commands to setup IP addresses and routes to the host interface.
85This net-setup.sh script will need to be run as a root user.
86
87If no parameters are given, then "zeth" network interface and "zeth.conf"
88configuration file are used. The script waits until user presses CTRL-c
89and then removes the network interface.
90```
91$ net-setup.sh
92```
93```
94$ net-setup.sh --config zeth-vlan.conf
95```
96```
97$ net-setup.sh --config my-own-config.conf --iface foobar
98```
99
100It is also possible to let the script return and then stop the network
101interface later. Is can be done by first creating the interface with
102"start" or "up" command, and then later remove the interface with
103"stop" or "down" command.
104```
105$ net-setup.sh start
106do your things here
107$ net-setup.sh stop
108```
109```
110$ net-setup.sh --config my-own-config.conf up
111do your things here
112$ net-setup.sh --config my-own-config.conf down
113```
114
115Any extra parameters that the script does not know, are passed directly
116to "ip" command.
117```
118$ net-setup.sh --config my-own-config.conf --iface foo user bar
119```
120
121## Using encrypted SSL link with echo-* programs
122
123Install stunnel
124
125Fedora:
126```
127$ dnf install stunnel
128```
129Ubuntu:
130```
131$ apt-get install stunnel4 -y
132```
133Finally run the stunnel script in Linux
134```
135$ ./stunnel.sh
136```
137And connect echo-client to this SSL tunnel (note that the IP address
138is the address of Linux host where the tunnel end point is located).
139```
140$ ./echo-client -p 4243 2001:db8::2 -t
141```
142If you are running echo-client in Zephyr QEMU, then run echo-server like
143this:
144```
145$ ./echo-server -p 4244 -i tap0
146```
147
148If you want to re-create the certificates in echo-server and echo-client in
149Zephyr net samples, then they can be created like this (note that you do not
150need to do this as the certs have been prepared already in echo-server and
151echo-client sample sources):
152```
153$ openssl genrsa -out echo-apps-key.pem 2048
154$ openssl req -new -x509 -key echo-apps-key.pem -out echo-apps-cert.pem \
155 -days 10000 -subj '/CN=localhost'
156```
157The cert that is to be embedded into test_certs.h in echo-server and
158echo-client, can be generated like this:
159```
160$ openssl x509 -in echo-apps-cert.pem -outform DER | \
161 hexdump -e '8/1 "0x%02x, " "\n"' | sed 's/0x ,//g'
162```
163The private key to be embedded into test_certs.h in echo-server can be
164generated like this:
165```
166$ openssl pkcs8 -topk8 -inform PEM -outform DER -nocrypt \
167 -in echo-apps-key.pem | hexdump -e '8/1 "0x%02x, " "\n"' | \
168 sed 's/0x ,//g'
169```
170
171If you want to re-create the signed certificates in echo-server in Zephyr
172net samples and echo-client in net-tools, then they can be created like this
173(note that you do not need to do this as the certs have been prepared already
174in echo-server and echo-client sources):
175```
176CA
177--
178$ openssl genrsa -out ca_privkey.pem 2048
179$ openssl req -new -x509 -days 36500 -key ca_privkey.pem -out ca.crt -subj "/CN=exampleCA"
180
181Convert to DER format
182$ openssl x509 -in ca.crt -outform DER -out ca.der
183```
184
185```
186Client
187------
188$ openssl genrsa -out client_privkey.pem 2048
189$ openssl req -new -key client_privkey.pem -out client.csr -subj "/CN=exampleClient"
190$ openssl x509 -req -CA ca.crt -CAkey ca_privkey.pem -days 36500 -in client.csr -CAcreateserial -out client.crt
191```
192
193```
194Server
195------
196$ openssl genrsa -out server_privkey.pem 2048
197$ openssl req -new -key server_privkey.pem -out server.csr -subj "/CN=localhost"
198$ openssl x509 -req -CA ca.crt -CAkey ca_privkey.pem -days 36500 -in server.csr -CAcreateserial -out server.crt
199
200Convert to DER format
201$ openssl x509 -in server.crt -outform DER -out server.der
202$ openssl pkcs8 -topk8 -inform PEM -outform DER -nocrypt -in server_privkey.pem -out server_privkey.der
203```
204
205Copy ca.crt, client.crt and client_privkey.pem to net-tools.
206Copy ca.der, server.der and server_privkey.der to samples/net/sockets/echo-server/src/.
207
208Enable NET_SAMPLE_CERTS_WITH_SC in samples/net/sockets/echo-server and build the sample.
209Use stunnel_sc.conf in stunnel.sh to run echo-client with signed certificates.
210
211## Using DTLS link with echo-* programs
212
213For DTLS client functionality, you can do this
214
215```
216$ ./dtls-client -c echo-apps-cert.pem 2001:db8::1
217```
218or
219```
220$ ./dtls-client -c echo-apps-cert.pem 192.0.2.1
221```
222For DTLS server functionality, you can do this
223
224```
225$ ./dtls-server
226```
227
228## TLS connecitivity errors
229
230If you see this error print in zephyr console
231
232[net/app] [ERR] _net_app_ssl_mainloop: Closing connection -0x7180 (SSL - Verification of the message MAC failed)
233
234Then increasing the mbedtls heap size might help. So you can set the option
235CONFIG_MBEDTLS_HEAP_SIZE to some higher value.
236
237Example:
238```
239CONFIG_MBEDTLS_HEAP_SIZE=30000
240```
241
242## PPP Connectivity
243
244You can test the PPP connectivity running in Qemu in Zephyr using pppd that is
245running in Linux host. You need to run *socat* and *pppd* to create
246a minimally working network setup.
247
248There are convenience scripts (_loop-ppp-dev.sh_ and _loop-pppd.sh_) for
249running socat and pppd processes. For running these, you need two
250terminals.
251
252Terminal 1:
253```
254$ ./loop-ppp-dev.sh
255```
256
257Terminal 2:
258```
259$ sudo ./loop-pppd.sh
260```
261
262After this, start PPP enabled Zephyr application. For example Zephyr
263*echo-server* sample in samples/net/sockets/echo_server has _overlay-ppp.conf_
264file that enables PPP support.
265