ubuntu

Ubuntu ifconfig命令的语法是什么

小樊
35
2025-12-13 03:30:14
栏目: 智能运维

ifconfig 命令在 Ubuntu 和其他 Linux 发行版中用于配置、激活和查询网络接口。其基本语法如下:

ifconfig [interface] [options]

以下是一些常用的 ifconfig 选项:

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

  1. 显示所有网络接口的信息:
ifconfig -a
  1. 显示特定网络接口的信息(例如 eth0):
ifconfig eth0
  1. 为网络接口 eth0 分配 IP 地址 192.168.1.100 和子网掩码 255.255.255.0
ifconfig eth0 inet 192.168.1.100 netmask 255.255.255.0
  1. 激活网络接口 eth0
ifconfig eth0 up
  1. 关闭网络接口 eth0
ifconfig eth0 down

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

0
看了该问题的人还看了