小甲鱼 发表于 2023-10-24 04:52:35

ifconfig -- 显示或配置网络接口

ifconfig 命令

概述:

ifconfig 命令用于配置和显示 Linux 内核中网络接口的网络参数。


格式:

ifconfig [-a] [-v] [-s]
ifconfig [-v] interface options | address ...


选项:


选项含义
-a 显示所有接口,包括关闭的接口。
-v 在执行某些操作时提供额外的解释性信息。
-s 显示简短的信息。


参数:


参数 含义
interface 要配置或显示信息的网络接口。
aftype 指定地址族类型。
options 选项和参数用于配置网络接口。
address 指定网络接口的 IP 地址。


实例:

$ ifconfig   # 显示所有活动的网络接口的信息
$ ifconfig -a   # 显示所有网络接口的信息
$ ifconfig eth0   # 显示 eth0 接口的信息
$ ifconfig eth0 down   # 关闭 eth0 接口
$ ifconfig eth0 up   # 启动 eth0 接口
$ ifconfig eth0 192.168.1.1   # 设置 eth0 接口的 IP 地址
小甲鱼科普:

虽然 ifconfig 命令在许多系统上仍在使用,但在一些最新的 Linux 发行版中,它已经被 ip 命令所取代。ip 命令提供了更多的功能和更强的灵活性。

如果你正在使用的系统中没有 ifconfig 命令,你可以尝试使用 ip 命令。例如,ip addr show 命令可以用来显示网络接口的信息,这与 ifconfig 命令的功能相同。

岳明辉 发表于 2023-11-3 02:03:31

:P:'(:time:
页: [1]
查看完整版本: ifconfig -- 显示或配置网络接口