• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

src/11-Mar-2024-150108

CMakeLists.txtD11-Mar-2024223 96

README.rstD11-Mar-20243.8 KiB13089

overlay-bt.confD11-Mar-2024402 1716

prj.confD11-Mar-2024626 3324

sample.yamlD11-Mar-2024134 109

README.rst

1.. _telnet-console-sample:
2
3Sample TELNET console application
4#################################
5
6Overview
7********
8
9This application will setup IPv4/IPv6 addresses on the default
10network interface. The telnet console service is started transparently
11by the kernel, along with the shell and two shell modules: net and kernel.
12Once up and running, you can connect to the target over the network,
13using a telnet client.
14
15Requirements
16************
17
18- :ref:`networking_with_qemu`
19
20
21Building and Running
22********************
23
24QEMU x86
25========
26
27These are instructions for how to use this sample application using
28QEMU on a Linux host connected to a network with DHCP service.
29
30To use QEMU for testing, follow the :ref:`networking_with_qemu` guide.
31
32Run Zephyr samples/net/telnet application in QEMU:
33
34.. zephyr-app-commands::
35   :zephyr-app: samples/net/telnet
36   :host-os: unix
37   :board: qemu_x86
38   :goals: run
39   :compact:
40
41Once started, you should see you IP address details for example:
42
43.. code-block:: console
44
45    [Setup] [INF] main: Starting Telnet sample
46    [Setup] [INF] setup_ipv4: IPv4 address: 192.0.2.1
47    [Setup] [INF] setup_ipv6: IPv6 address: 2001:db8::1
48
49At this point, your QEMU guest is up and running. Connect to the telnet
50console from your linux host this way:
51
52.. code-block:: console
53
54    $ telnet 192.0.2.1
55    Telnet escape character is '^]'.
56    Trying 192.0.2.1...
57    Connected to 192.0.2.1.
58    Escape character is '^]'.
59
60Now type enter, the shell prompt will appear and you can enter commands,
61for example ``help``.
62
63
64Freedom-K64F Board
65===================
66
67These are instructions for how to use this sample application running on a
68Freedom-K64F board. Unlike running it on QEMU, :ref:`Freedom-K64F board
69<frdm_k64f>` network configuration for IPv4 will rely on DHCPv4. You cad modify
70the :file:`prj_frdm_k64f.conf` to set static IPv4 addresses if it is really needed.
71
72For detailed instructions about building, flashing and using the serial console
73logs, follow the  :ref:`Freedom-K64F board <frdm_k64f>` documentation section.
74
75Connect ethernet cable from :ref:`Freedom-K64F <frdm_k64f>` board to a
76local network providing IPv4 address configuration via DHCPv4. Creating your own
77DHCP server on a local network is not in the scope of this README.
78
79Build Zephyr samples/net/telnet application:
80
81.. zephyr-app-commands::
82   :zephyr-app: samples/net/telnet
83   :board: frdm_k64f
84   :goals: build
85   :compact:
86
87Flash the resulting Zephyr binary following the :ref:`Freedom-K64F <frdm_k64f>`
88board documentation noted above.
89
90From your host computer, open a serial console to your board:
91
92.. code-block:: console
93
94    $ sudo screen /dev/ttyACM0 115200
95
96Plug the Ethernet cable to the :ref:`Freedom-K64F <frdm_k64f>` board.
97Reset the board, you should see first on the console:
98
99.. code-block:: console
100
101    [dev/eth_mcux] [INF] eth_0_init: Enabled 100M full-duplex mode.
102    [dev/eth_mcux] [DBG] eth_0_init: MAC 00:04:9f:69:c7:36
103    shell> [Setup] [INF] main: Starting Telnet sample
104    [Setup] [INF] setup_dhcpv4: Running dhcpv4 client...
105    [Setup] [INF] setup_ipv6: IPv6 address: 2001:db8::1
106
107And if the DHCPv4 client succeeds, you will soon see something like:
108
109.. code-block:: console
110
111   [Setup] [INF] ipv4_addr_add_handler: IPv4 address: 192.168.0.21
112   [Setup] [INF] ipv4_addr_add_handler: Lease time: 86400 seconds
113   [Setup] [INF] ipv4_addr_add_handler: Subnet: 255.255.255.0
114   [Setup] [INF] ipv4_addr_add_handler: Router: 192.168.0.1
115
116The above result depends on your local network.
117At this point you should be able to connect via telnet over the network.
118On your linux host:
119
120.. code-block:: console
121
122    $ telnet 192.168.0.21
123    Telnet escape character is '^]'.
124    Trying 192.168.0.21...
125    Connected to 192.168.0.1.
126    Escape character is '^]'.
127
128You are now connected, and as for the UART console, you can type in
129your commands and get the output through your telnet client.
130