Network AT Commands

Provides DNS, SNTP, ping, iperf throughput testing and other common network services.

Note

  • The Network AT commands are enabled by default.

  • Refer to Configuring Project (menuconfig) and navigate to CONFIG AT CMD settings. Uncheck Enable Network to disable this command set.

AT+PING

Functional Description

Perform ping test on domain name or IP address

Command Format

AT+PING=<host>[,<-t>,<-n>,<count>,<-l>,<size>]
AT+PING=<stop>

Response Format

Success:

OK

Error:

ERROR:<error_no>

Parameters

<host>:

Target host address

  • Supports IPv4 address or domain name

<-t>:

Ping the specified host until stopped

<-n>:

Set ping packet count

  • Followed by <count> parameter

  • <count>: Number of ping packets

    • Positive integer

    • Default: 4

<-l>:

Set packet size

  • Followed by <size> parameter

  • <size>: Packet size (bytes)

    • Positive integer

    • Default: 32

<stop>:

Terminate current ping task

  • Special parameter value: stop

Note

<-t>, <-l>, <-n> parameters can be in any order

Error Codes

  • 1: Empty parameters

  • 2: Incorrect number of parameters

Examples

Default parameters test:

AT+PING=192.168.31.200

OK
[$][ping_test] 32 bytes from 192.168.31.1: icmp_seq=1 time=135 ms
[$][ping_test] 32 bytes from 192.168.31.1: icmp_seq=2 time=5 ms
[$][ping_test] 32 bytes from 192.168.31.1: icmp_seq=3 time=102 ms
[$][ping_test] 32 bytes from 192.168.31.1: icmp_seq=4 time=3 ms
[$][ping_test] 4 packets transmitted, 4 received, 0% packet loss, average 60 ms
[$][ping_test] min: 3 ms, max: 135 ms

Custom parameters test:

AT+PING=www.sohu.com,-n,3,-l,128

OK
[$][ping_test] 128 bytes from 192.168.31.1: icmp_seq=1 time=40 ms
[$][ping_test] 128 bytes from 192.168.31.1: icmp_seq=2 time=9 ms
[$][ping_test] 128 bytes from 192.168.31.1: icmp_seq=3 time=21 ms
[$][ping_test] 3 packets transmitted, 3 received, 0% packet loss, average 23 ms
[$][ping_test] min: 9 ms, max: 40 ms

AT+IPERF

Functional Description

TCP/UDP network bandwidth test

Note

This command is only supported in manual test mode.

Command Format

Server mode:

AT+IPERF=<-s>[,<-p>,<port>,<-u>]

Client mode:

AT+IPERF=<-c>,<host|stop>[,<-i>,<periodic>,<-l>,<size>,<-u>,<-b>,<bandwidth>,<-d>,<-t>,<transtime>,<-n>,<count>,<-S>,<tos>]

Response Format

Success:

OK

Error:

ERROR:<error_no>

Parameters

<-s>:

Server mode

<-c>:

Client mode

  • Followed by <host|stop> parameter

  • <host|stop>: Target host or stop command

    • <stop>: Terminate specific/all test streams

    • <host>: Server host IPv4 address

<-p>:

Set port number

  • Followed by <port> parameter

  • <port>: Server port

    • Range [1,65535]

    • Default: 5001

<-u>:

Use UDP protocol

  • Default TCP when omitted

<-i>:

Set report interval

  • Followed by <periodic> parameter

  • <periodic>: Bandwidth report interval (seconds)

    • Positive integer

<-l>:

Set packet size

  • Followed by <size> parameter

  • <size>: Packet size (bytes)

    • Positive integer

    • Default: 1460

<-b>:

Set UDP bandwidth

  • Followed by <bandwidth> parameter

  • <bandwidth>: Bandwidth (bits/sec)

    • Default: 1

<-d>:

Enable bidirectional test

<-t>:

Set test duration

  • Followed by <transtime> parameter

  • <transtime>: Transmission duration (seconds)

    • Default: 10

<-n>:

Set transmission byte count

  • Followed by <count> parameter

  • <count>: Byte count

    • Positive integer

<-S>:

Set IP TOS field

  • Followed by <tos> parameter

  • <tos>: TOS value

    • Range [0,255]

Error Codes

  • 1: Empty parameters

  • 3: Incorrect number of parameters

Note

Parameters like <-t>, <-l>, <-i> can be in any order

Examples

TCP test:

AT+IPERF=-s,-p,5002
AT+IPERF=-c,192.168.1.2,-t,100,-p,5002

UDP test:

AT+IPERF=-c,192.168.1.2,-t,100,-p,5002,-u

AT+IPERF3

Functional Description

TCP network bandwidth test (IPERF3 protocol)

Note

This command is only supported in manual test mode.

Command Format

Server mode:

AT+IPERF3=<-s>[,<-p>,<port>]

Client mode:

AT+IPERF3=<-c>,<host|stop>[,<-i>,<periodic>,<-l>,<size>,<-d>,<-t>,<transtime>,<-n>,<count>]

Response Format

Success:

OK

Error:

ERROR:<error_no>

Parameters

<-s>:

Server mode

<-c>:

Client mode

  • Followed by <host|stop> parameter

  • <host|stop>: Target host or stop command

    • <stop>: Terminate specific/all test streams

    • <host>: Server host IPv4 address

<-p>:

Set port number

  • Followed by <port> parameter

  • <port>: Server port

    • Range [1,65535]

    • Default: 5001

<-i>:

Set report interval

  • Followed by <periodic> parameter

  • <periodic>: Bandwidth report interval (seconds)

    • Positive integer

<-l>:

Set packet size

  • Followed by <size> parameter

  • <size>: Packet size (bytes)

    • Positive integer

    • Default: 1460

<-d>:

Enable bidirectional test

<-t>:

Set test duration

  • Followed by <transtime> parameter

  • <transtime>: Transmission duration (seconds)

    • Default: 10

<-n>:

Set transmission byte count

  • Followed by <count> parameter

  • <count>: Byte count

    • Positive integer

Error Codes

  • 1: Empty parameters

  • 2: Incorrect number of parameters

Note

Parameters like <-t>, <-l>, <-i> can be in any order

Examples

AT+IPERF3=-s,-p,5002
AT+IPERF3=-c,192.168.1.2,-t,100,-p,5002

AT+DNS

Functional Description

Resolve domain name to IP address

Note

  • The DNS AT commands are disabled by default.

  • Refer to Configuring Project (menuconfig) to enter CONFIG AT CMD configuration and check DNS MQTT to enable the DNS AT commands.

Command Format

AT+DNS=<host>

Response Format

Success:

+DNS:<ip_address>

OK

Error:

ERROR:<error_no>

Parameters

<host>:

Target host domain name

Error Codes

  • 1: Empty parameters

  • 2: Domain name resolution failed

Usage Example

Resolve domain name www.baidu.com:

AT+DNS=www.baidu.com

+DNS:103.235.46.102

OK

AT+QUERYDNSSRV

Functional Description

Query currently configured DNS server addresses

Note

  • The DNS AT commands are disabled by default.

  • Refer to Configuring Project (menuconfig) to enter CONFIG AT CMD configuration and check DNS MQTT to enable the DNS AT commands.

Command Format

AT+QUERYDNSSRV

Response Format

Success:

+QUERYDNSSRV:[<primary_dns>,<secondary_dns>]

OK

Error:

ERROR:<error_no>

Error Codes

  • 1: Non-empty input parameters

Usage Example

Query DNS servers:

AT+QUERYDNSSRV

+QUERYDNSSRV:8.8.8.8, 8.8.4.4

OK

AT+SETDNSSRV

Functional Description

Set DNS server addresses

Note

  • The DNS AT commands are disabled by default.

  • Refer to Configuring Project (menuconfig) to enter CONFIG AT CMD configuration and check DNS MQTT to enable the DNS AT commands.

Command Format

AT+SETDNSSRV=<primary_dns>[,<secondary_dns>]

Response Format

Success:

OK

Error:

ERROR:<error_no>

Parameters

<primary_dns>:

Primary DNS server address

<secondary_dns>:

Secondary DNS server address (optional)

Error Codes

  • 1: Incorrect number of parameters

  • 2: Invalid DNS server address format

Usage Example

Set one DNS server 8.8.8.8:

AT+SETDNSSRV=8.8.8.8

OK

Set two DNS servers 8.8.8.8 and 8.8.4.4:

AT+SETDNSSRV=8.8.8.8,8.8.4.4

OK