ifconfig

    命令格式

    ifconfig

    [-a]

    <_interface_\> <_address_\> [netmask ] [gateway ]

    [hw ether ] [mtu ]

    [inet6 add ]

    [inet6 del ]

    [up|down]

    表 1 参数说明

    使用指南

    • 命令需要启动TCP/IP协议栈后才能使用。
    • 由于IP冲突检测需要反应时间,每次使用ifconfig设置IP后会有2S左右的延时。
    1. ifconfig eth0 192.168.100.31 netmask 255.255.255.0 gateway 192.168.100.1 hw ether 00:49:cb:6c:a1:31
    2. ifconfig eth0 inet6 add 2001:a:b:c:d:e:f:d
    3. ifconfig eth0 inet6 del 2001:a:b:c:d:e:f:d

    输出说明

    1. 设置网络参数

      输出的各参数说明如下表所示:

      表 2 参数说明

    2. 获取协议栈统计信息

      输出的各参数说明如下表所示:

      表 3 ifconfig -a 参数说明

    3. 设置IPv6的地址信息