Part 1
요약·해설
두 target의 build·address·serial·DHCP·Telnet transcript를 모두 보존합니다.
net · kernel
QEMU · K64F
Static · DHCPv4
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
4CD6B76128787222080706A1E341940FB46D03B6B2B42694FE39305435FDFDE7
.. zephyr:code-sample:: telnet-console
:name: Telnet console
:relevant-api: shell_api net_core net_if net_mgmt
Access Zephyr shell over telnet.
Overview
********
This application will setup IPv4/IPv6 addresses on the default
network interface. The telnet console service is started transparently
by the kernel, along with the shell and two shell modules: net and kernel.
Once up and running, you can connect to the target over the network,
using a telnet client.
Requirements
************
- :ref:`networking_with_qemu`
Building and Running
********************
QEMU x86
========
These are instructions for how to use this sample application using
QEMU on a Linux host connected to a network with DHCP service.
To use QEMU for testing, follow the :ref:`networking_with_qemu` guide.
Run Zephyr samples/net/telnet application in QEMU:
.. zephyr-app-commands::
:zephyr-app: samples/net/telnet
:host-os: unix
:board: qemu_x86
:goals: run
:compact:
Once started, you should see you IP address details for example:
.. code-block:: console
[Setup] [INF] main: Starting Telnet sample
[Setup] [INF] setup_ipv4: IPv4 address: 192.0.2.1
[Setup] [INF] setup_ipv6: IPv6 address: 2001:db8::1
At this point, your QEMU guest is up and running. Connect to the telnet
console from your linux host this way:
.. code-block:: console
$ telnet 192.0.2.1
Telnet escape character is '^]'.
Trying 192.0.2.1...
Connected to 192.0.2.1.
Escape character is '^]'.
Now type enter, the shell prompt will appear and you can enter commands,
for example ``help``.
Freedom-K64F Board
===================
These are instructions for how to use this sample application running on a
Freedom-K64F board. Unlike running it on QEMU, :ref:`Freedom-K64F board
<frdm_k64f>` network configuration for IPv4 will rely on DHCPv4. You cad modify
the :file:`prj_frdm_k64f.conf` to set static IPv4 addresses if it is really needed.
For detailed instructions about building, flashing and using the serial console
logs, follow the :ref:`Freedom-K64F board <frdm_k64f>` documentation section.
Connect ethernet cable from :ref:`Freedom-K64F <frdm_k64f>` board to a
local network providing IPv4 address configuration via DHCPv4. Creating your own
DHCP server on a local network is not in the scope of this README.
Build Zephyr samples/net/telnet application:
.. zephyr-app-commands::
:zephyr-app: samples/net/telnet
:board: frdm_k64f
:goals: build
:compact:
Flash the resulting Zephyr binary following the :ref:`Freedom-K64F <frdm_k64f>`
board documentation noted above.
From your host computer, open a serial console to your board:
.. code-block:: console
$ sudo screen /dev/ttyACM0 115200
Plug the Ethernet cable to the :ref:`Freedom-K64F <frdm_k64f>` board.
Reset the board, you should see first on the console:
.. code-block:: console
[dev/eth_mcux] [INF] eth_0_init: Enabled 100M full-duplex mode.
[dev/eth_mcux] [DBG] eth_0_init: MAC 00:04:9f:69:c7:36
shell> [Setup] [INF] main: Starting Telnet sample
[Setup] [INF] setup_dhcpv4: Running dhcpv4 client...
[Setup] [INF] setup_ipv6: IPv6 address: 2001:db8::1
And if the DHCPv4 client succeeds, you will soon see something like:
.. code-block:: console
[Setup] [INF] ipv4_addr_add_handler: IPv4 address: 192.168.0.21
[Setup] [INF] ipv4_addr_add_handler: Lease time: 86400 seconds
[Setup] [INF] ipv4_addr_add_handler: Subnet: 255.255.255.0
[Setup] [INF] ipv4_addr_add_handler: Router: 192.168.0.1
The above result depends on your local network.
At this point you should be able to connect via telnet over the network.
On your linux host:
.. code-block:: console
$ telnet 192.168.0.21
Telnet escape character is '^]'.
Trying 192.168.0.21...
Connected to 192.168.0.1.
Escape character is '^]'.
You are now connected, and as for the UART console, you can type in
your commands and get the output through your telnet client.
Part 3
한국어 전문 번역
개요
이 application은 default network interface에 IPv4와 IPv6 address를 설정합니다. Kernel은 shell 및 net·kernel shell module과 함께 Telnet console service를 자동으로 시작합니다.
서비스가 실행되면 Telnet client를 사용해 network를 통해 target에 연결할 수 있습니다.
요구 사항
빌드 및 실행
QEMU x86
다음은 DHCP service가 있는 network에 연결된 Linux host에서 QEMU로 이 sample application을 사용하는 방법입니다.
QEMU test 설정은 Networking with QEMU guide를 따릅니다.
QEMU에서 Zephyr samples/net/telnet application을 실행합니다.
west build -b qemu_x86 samples/net/telnet
west build -t run
시작되면 다음과 같은 IP address detail이 표시됩니다.
[Setup] [INF] main: Starting Telnet sample
[Setup] [INF] setup_ipv4: IPv4 address: 192.0.2.1
[Setup] [INF] setup_ipv6: IPv6 address: 2001:db8::1
이제 QEMU guest가 실행 중입니다. Linux host에서 다음과 같이 Telnet console에 연결합니다.
$ telnet 192.0.2.1
Telnet escape character is '^]'.
Trying 192.0.2.1...
Connected to 192.0.2.1.
Escape character is '^]'.
Enter를 누르면 shell prompt가 나타나며, 예를 들어 help 같은 command를 입력할 수 있습니다.
Freedom-K64F board
다음은 Freedom-K64F board에서 이 sample을 실행하는 방법입니다. QEMU와 달리 IPv4 network configuration은 DHCPv4에 의존합니다. 꼭 필요하면 prj_frdm_k64f.conf를 수정해 static IPv4 address를 설정할 수 있습니다.
Build, flash와 serial console log 사용에 관한 자세한 방법은 Freedom-K64F board 문서를 따릅니다.
Freedom-K64F board의 Ethernet cable을 DHCPv4로 IPv4 address configuration을 제공하는 local network에 연결합니다. Local network에 자체 DHCP server를 만드는 방법은 이 README의 범위에 포함되지 않습니다.
Zephyr samples/net/telnet application을 build합니다.
west build -b frdm_k64f samples/net/telnet
앞에서 언급한 Freedom-K64F board 문서에 따라 생성된 Zephyr binary를 flash합니다.
Host computer에서 board의 serial console을 엽니다.
$ sudo screen /dev/ttyACM0 115200
Freedom-K64F board에 Ethernet cable을 연결하고 board를 reset하면 console에 먼저 다음 내용이 표시됩니다.
[dev/eth_mcux] [INF] eth_0_init: Enabled 100M full-duplex mode.
[dev/eth_mcux] [DBG] eth_0_init: MAC 00:04:9f:69:c7:36
shell> [Setup] [INF] main: Starting Telnet sample
[Setup] [INF] setup_dhcpv4: Running dhcpv4 client...
[Setup] [INF] setup_ipv6: IPv6 address: 2001:db8::1
DHCPv4 client가 성공하면 곧 다음과 비슷한 내용이 표시됩니다.
[Setup] [INF] ipv4_addr_add_handler: IPv4 address: 192.168.0.21
[Setup] [INF] ipv4_addr_add_handler: Lease time: 86400 seconds
[Setup] [INF] ipv4_addr_add_handler: Subnet: 255.255.255.0
[Setup] [INF] ipv4_addr_add_handler: Router: 192.168.0.1
위 결과는 local network 설정에 따라 달라집니다. 이제 network를 통해 Telnet으로 연결할 수 있습니다. Linux host에서 다음 명령을 실행합니다. 공식 출력 예제는 192.168.0.21로 접속한 뒤 연결 대상 문구를 192.168.0.1로 표시합니다.
$ telnet 192.168.0.21
Telnet escape character is '^]'.
Trying 192.168.0.21...
Connected to 192.168.0.1.
Escape character is '^]'.
이제 연결되었습니다. UART console과 마찬가지로 Telnet client에서 command를 입력하고 출력을 받을 수 있습니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.