centos

centos ifconfig命令如何使用

小樊
43
2025-09-03 19:40:31
栏目: 智能运维

ifconfig 是一个用于配置和显示 Linux 内核中网络接口的命令行实用程序。在 CentOS 系统中,你可以使用 ifconfig 命令来查看和管理网络接口。

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

  1. 查看所有网络接口的信息:
ifconfig
  1. 查看指定网络接口的信息(例如,查看 eth0 接口的信息):
ifconfig eth0
  1. 启动指定的网络接口(例如,启动 eth0 接口):
ifconfig eth0 up
  1. 关闭指定的网络接口(例如,关闭 eth0 接口):
ifconfig eth0 down
  1. 为指定的网络接口分配 IP 地址(例如,为 eth0 接口分配 IP 地址 192.168.1.100):
ifconfig eth0 192.168.1.100 netmask 255.255.255.0
  1. 删除指定的网络接口的 IP 地址(例如,删除 eth0 接口的 IP 地址):
ifconfig eth0 192.168.1.100 netmask 255.255.255.0 up

注意:在较新的 CentOS 版本中,ifconfig 命令可能已被弃用,推荐使用 ip 命令来替代。你可以使用 ip addrip link 等命令来实现与 ifconfig 类似的功能。

0
看了该问题的人还看了