摘自 VxWorks 俱乐部 https://www.vxworks.net
VxWorks 6.9 下组件 INCLUDE_IFCONFIG 提供了命令 ifconfig(),包含组件 INCLUDE_IPIFCONFIG_CMD 后,也可以在 cmd 里使用 ifconfig 命令用 于配置(或查询)网络接口 一些常用的 IPv4 命令如下
ifconfig : 列举所有接口
ifconfig <网络接口> attach : 挂接网络接口
ifconfig <网络接口> detach :卸载网络接口
ifconfig <网络接口> inet addr [可选参数] :设置 IP 地址
ifconfig "gem0 inet addr 192.168.1.102"
关机重启后IP不能保存, 在程序中使用 ifconfig("gem0 192.168.1.102");
ifconfig <网络接口> inet add [可选参数] :添加 IP 地址
ifconfig <网络接口> inet delete : 删除 IP 地址
ifconfig up : 使能网络接口
ifconfig down : 禁止网络接口
ifconfig mtu : 设置网络设备的 Maximum Transmission Unit
文档: