openharmony 鸿蒙 network-cfg

2026-08-25 浏览 (1)

network-cfg

network-cfg (cfg is short for config) is a tool provided for setting network parameters, for example, setting a proxy for Wi-Fi.

NOTE

network-cfg is supported since API version 20.

Environment Requirements

Before using this tool, you must obtain hdc and run the hdc shell command.

Commands

CommandDescription
helpDisplays the commands supported by the tool.
setSets network parameters.

help

# Display the help information.
network-cfg help
network-cfg -h

Setting Network Parameters

  • Display the commands supported by set.
network-cfg set -h
  • Set or cancel the current Wi-Fi proxy.
network-cfg set http_proxy [ip:port]

NOTE

  • The proxy can be set only when the Wi-Fi is connected.
  • The value range of the port number is [1, 65535]. If the port number is not specified or exceeds the value range, the default value 8080 is used.
  • The proxy takes effect only for the current Wi-Fi. You need to set the proxy again after switching the Wi-Fi.

Example:

# Set a proxy for the current Wi-Fi. The host name is localhost, and the port number is 8080.
network-cfg set http_proxy 127.0.0.1:8080
# Set a proxy for the current Wi-Fi. The host name is ip6-localhost, and the port number is 8080.
network-cfg set http_proxy [::1]
# Cancel the current Wi-Fi proxy.
network-cfg set http_proxy 0

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 acm-tool

openharmony 鸿蒙 devicedebug-tool

openharmony 鸿蒙 binary-sign-tool

openharmony 鸿蒙 atm-tool

openharmony 鸿蒙 toybox

openharmony 鸿蒙 Readme-EN

openharmony 鸿蒙 unpacking-tool

openharmony 鸿蒙 cem-tool

openharmony 鸿蒙 packing-tool

openharmony 鸿蒙 app-check-tool

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/sa5ybK2Q