openharmony配置默认IP地址

openharmony配置默认IP地址

247
247
2024-08-31 / 0 评论 / 69 阅读 / 正在检测是否收录...

文件所在路径:

/system/etc/communication/netmanager_ext/ethernet_interfaces.json

配置方法:

{
    "config_ethernet_interfaces": [
        {
            "iface": "eth0",  // 网络接口名称,如 eth0
            "caps": [],  // 能力集,通常留空
            "ip": "192.168.0.10",  // 静态分配的 IP 地址
            "gateway": "192.168.0.1",  // 网关地址
            "dns": "",  // DNS 服务器,可选,留空或指定
            "netmask": "255.255.255.0",  // 子网掩码
            "route": "",  // 路由,可选,留空或指定
            "routemask": ""  // 路由掩码,可选,留空或指定
        }
    ]
}

然后将文件导入:

hdc shell mount -o rw,remount /
hdc file send ethernet_interfaces.json /system/etc/communication/netmanager_ext/

重启设备即可

1

评论 (0)

取消