centos

centos系统ifconfig命令使用指南

小樊
84
2025-02-13 09:44:46
栏目: 智能运维

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,子网掩码为 255.255.255.0):
ifconfig eth0 192.168.1.100 netmask 255.255.255.0
  1. 删除网络接口的 IP 地址(例如:eth0):
ifconfig eth0 0.0.0.0
  1. 临时更改网络接口的 MTU(最大传输单元)(例如:eth0,MTU 为 1400):
ifconfig eth0 mtu 1400
  1. 显示网络接口的广播地址:
ifconfig eth0 broadcast
  1. 显示网络接口的硬件地址(MAC 地址):
ifconfig eth0 hw ether

请注意,ifconfig 命令在某些 Linux 发行版中可能已被弃用,取而代之的是 ip 命令。在使用 CentOS 7 或更高版本时,您可能需要使用 ip 命令来执行类似的操作。

0
看了该问题的人还看了