温馨提示×

Linux ifconfig命令参数含义

小樊
35
2025-12-08 23:11:49
栏目: 智能运维

ifconfig 是一个用于配置和显示 Linux 内核中网络接口的命令行实用程序。以下是一些常用的 ifconfig 命令参数及其含义:

  1. ifconfig:不带任何参数运行 ifconfig 命令将显示所有活动网络接口的详细信息。

  2. ifconfig interface:将 interface 替换为您要查看的网络接口名称(例如:eth0、wlan0 等)。这将显示指定网络接口的详细信息。

  3. ifconfig interface up:将指定网络接口(例如:eth0)设置为启用状态。

  4. ifconfig interface down:将指定网络接口(例如:eth0)设置为禁用状态。

  5. ifconfig interface hw ether address:将指定网络接口(例如:eth0)的硬件(MAC)地址更改为指定的地址(例如:00:11:22:33:44:55)。

  6. ifconfig interface mtu size:将指定网络接口(例如:eth0)的最大传输单元(MTU)设置为指定的大小(例如:1500)。

  7. ifconfig interface netmask mask:将指定网络接口(例如:eth0)的子网掩码设置为指定的值(例如:255.255.255.0)。

  8. ifconfig interface broadcast address:将指定网络接口(例如:eth0)的广播地址设置为指定的值(例如:192.168.1.255)。

  9. ifconfig interface pointopoint address:将指定网络接口(例如:eth0)的点对点地址设置为指定的值(例如:192.168.1.1)。

请注意,ifconfig 命令在某些 Linux 发行版中可能已被弃用,建议使用 ip 命令替代。

0