centos

centos ifconfig命令格式是什么

小樊
32
2025-07-06 15:30:17
栏目: 智能运维

ifconfig 命令在 CentOS 系统中用于配置、激活和查询网络接口参数。它的基本格式如下:

ifconfig [interface] [options]

以下是一些常用的 ifconfig 命令示例:

  1. 显示所有网络接口的信息:
ifconfig
  1. 显示指定网络接口的信息(如 eth0):
ifconfig eth0
  1. 为指定网络接口设置 IP 地址和子网掩码(如 eth0):
ifconfig eth0 192.168.1.100 netmask 255.255.255.0
  1. 启用指定网络接口(如 eth0):
ifconfig eth0 up
  1. 禁用指定网络接口(如 eth0):
ifconfig eth0 down

请注意,ifconfig 命令在某些 CentOS 版本中可能已被弃用,建议使用 ip 命令替代。ip 命令提供了更强大的功能和更好的性能。

0
看了该问题的人还看了