手机版 收藏 导航

ifconfig 命令常用选项介绍

原创   www.link114.cn   2025-03-24 11:43:37

ifconfig 命令常用选项介绍

ifconfig 命令是一个用于配置和显示 Linux 系统网络接口的工具。它可以用于查看和修改网络接口的配置信息,如 IP 地址、子网掩码、MAC 地址等。下面是 ifconfig 命令的一些常用选项:

  • up/down - 启动/停止指定的网络接口。例如: ifconfig eth0 up 可以启动 eth0 接口。
  • add/del - 添加或删除 IPv6 地址。例如: ifconfig eth0 add 2001:db8::1/64 可以为 eth0 接口添加一个 IPv6 地址。
  • broadcast - 设置广播地址。例如: ifconfig eth0 broadcast 192.168.1.255
  • netmask - 设置子网掩码。例如: ifconfig eth0 netmask 255.255.255.0
  • hw - 设置 MAC 地址。例如: ifconfig eth0 hw ether 00:11:22:33:44:55
  • metric - 设置路由度量值。例如: ifconfig eth0 metric 100
  • mtu - 设置最大传输单元。例如: ifconfig eth0 mtu 1500

使用 ifconfig 命令可以快速地获取和配置网络接口的信息,是 Linux 系统管理员必备的网络管理工具之一。