Linux ifconfig 命令:显示和配置网络接口
在 Linux 系统中,'ifconfig' 命令用于显示和配置网络接口信息。下面是一些常见的 'ifconfig' 命令的用法:
- 显示所有网络接口的信息:
ifconfig
- 显示指定网络接口的信息:
ifconfig eth0
这将显示名为'eth0' 的网络接口的详细信息。
- 启用网络接口:
ifconfig eth0 up
这将启用名为'eth0' 的网络接口。
- 禁用网络接口:
ifconfig eth0 down
这将禁用名为'eth0' 的网络接口。
- 配置 IP 地址:
ifconfig eth0 192.168.0.10 netmask 255.255.255.0
这将为名为'eth0' 的网络接口配置 IP 地址为'192.168.0.10',子网掩码为'255.255.255.0'。
需要注意的是,'ifconfig' 命令在一些 Linux 发行版中已被废弃,推荐使用'ip' 命令来替代。例如,可以使用'ip addr show' 来显示网络接口信息,使用'ip link set eth0 up' 来启用网络接口。
建议使用'man ifconfig' 或'man ip' 命令来查看更详细的帮助文档和命令用法。
原文地址: https://www.cveoy.top/t/topic/bTfn 著作权归作者所有。请勿转载和采集!