Zhe*_*hen 185 networking linux ifconfig iproute2
对于挂载 Infiniband 卡的服务器,当我使用该ifconfig命令时,我收到以下警告:
Ifconfig uses the ioctl access method to get the full address
information, which limits hardware addresses to 8 bytes.
Because Infiniband address has 20 bytes, only the first 8 bytes
are displayed correctly.
Ifconfig is obsolete! For replacement check ip.
Run Code Online (Sandbox Code Playgroud)
我应该停止使用ifconfig吗?它是否已被弃用以支持该ip命令?还是会在近期更新?
注意:这个问题和答案是关于GNU/Linux 的“主要”发行版的。不应假定该信息适用于所有发行版,尤其不适用于其他操作系统。
小智 166
引用Thomas Pircher的网站(cc-by-sa):
ifconfig vs ip
该命令/bin/ip已经存在一段时间了。但是人们继续使用旧的命令/sbin/ifconfig。让我们明确一点:ifconfig不会很快消失,但它的新版本ip更强大,最终将取代它。
的手册页一开始ip可能看起来很吓人,但是一旦您熟悉了命令语法,就会很容易阅读。本页不会介绍ip的新特性。它具有并排比较 ififconfig和ip命令语法的快速概览。
显示网络设备和配置
ifconfig
ip addr show
ip link show
Run Code Online (Sandbox Code Playgroud)
启用网络接口
ifconfig eth0 up
ip link set eth0 up
Run Code Online (Sandbox Code Playgroud)
以类似的方式禁用网络接口:
ifconfig eth0 down
ip link set eth0 down
Run Code Online (Sandbox Code Playgroud)
Tot*_*tor 47
是的,在 Linux 上ifconfig不推荐使用 iproute2(ip命令)。
同样,arp,route和netstat命令也已弃用。
但是, iproute2 是 Linux 特定的,当其他一些 Unix 使用时ifconfig,因此如果您打算使用另一个 Unix,了解/记住它是如何工作的可能会有所帮助...
要学习“新方法”,我建议您查看这 3 个链接:
ip时,它)。根据最后一个链接,ifconfig已经+15年没有维护了:
除了 Debian 积累的大量补丁外,net-tools 软件包在 2001 年 4 月 15 日左右发布的 1.60 版本之后没有看到任何上游开发。
Sve*_*ven 20
ifconfig 现已弃用多年,是时候切换了,尤其是在像您这样的情况下。
ip已经有ifconfig一段时间的替代品,可能在某个时候ifconfig会更新,但是我不会等待它并学习使用ip它。它支持所有 linux 发行版