For faster navigation, this Iframe is preloading the Wikiwand page for ifconfig.

ifconfig

ifconfig(interface configuration的缩写)是在类Unix作业系统中于命令行界面(CLI)下或系统配置脚本中用于配置、控制及查询TCP/IP网络接口的系统管理工具。ifconfig最初于4.2BSD中作为BSD TCP/IP协议族的一部分出现。

用法

[编辑]

ifconfig的常见用途包括设置接口的IP地址子网掩码,以及禁用与启用接口。[1]在启动时,许多类Unix作业系统通过调用ifconfig的shell脚本初始化网络接口。作为交互工具,系统管理员经常使用其来显示并分析网络接口参数。下面的样例输出展示了一Linux主机(接口eth0)和OpenBSD主机上的ural0活跃接口状态:

 eth0      Link encap:Ethernet  HWaddr 00:0F:20:CF:8B:42
           inet addr:217.149.127.10  Bcast:217.149.127.63  Mask:255.255.255.192
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:2472694671 errors:1 dropped:0 overruns:0 frame:0
           TX packets:44641779 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:1761467179 (1679.7 Mb)  TX bytes:2870928587 (2737.9 Mb)
           Interrupt:28
 ural0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
         lladdr 00:0d:0b:ed:84:fb
         media: IEEE802.11 DS2 mode 11b hostap (autoselect mode 11b hostap)
         status: active
         ieee80211: nwid ARK chan 11 bssid 00:0d:0b:ed:84:fb  100dBm
         inet 172.30.50.1 netmask 0xffffff00 broadcast 172.30.50.255
         inet6 fe80::20d:bff:feed:84fb%ural0 prefixlen 64 scopeid 0xa

当前状态

[编辑]

开放的伯克利软件套件UNIX作业系统(如NetBSDOpenBSDFreeBSD)仍在活跃地开发ifconfig,并将其功能扩展到包含无线网络接口设置、VLAN中继、操控硬件功能(如TSO或硬件检验和计算)及设置桥接与隧道接口等。

Solaris曾经使用ifconfig来进行所有网络相关的配置,但自Solaris 10引入dladm来进行链路层(OSI模型第二层)配置后,ifconfig就仅能被用于进行IP(OSI模型第三层)配置。并且用户被建议使用ipadm而不是ifconfig来配置IP因为ifconfig所作出的配置不是持久的。[2]

在旧的Linux发行版中,ifconfig与route命令一同使用,用于连接电脑到网络及定义不同网络间的路由。Linux上的ifconfig是net-tools软件包的一部分。[3]

现代Linux发行版正淘汰ifconfig与route,用iproute2取代过时的net-tools,[4]然而至今仍有许多发行版还未完全替换。[5]

相关工具

[编辑]

Microsoft WindowsWindows 9x都提供winipcfg给出当前IP资讯的图形化显示。基于Windows NT内核微软作业系统均有提供ipconfig,一个与ifconfig类似的命令。ipconfig也可控制Windows DHCP客户端

Mac OS X中,ifconfig是IPConfiguration的封装,可于命令行控制BootP和DHCP客户端。由于ifconfig工作在协助管理网络设置的系统框架之下,不推荐使用ifconfig更改OS X的网络设置。要在命令行中更动Mac OS X的网络设置,应使用/usr/sbin/ipconfig或/usr/sbin/networksetup。

iwconfig,Wireless tools for Linux的一部分,名字即来源于ifconfig,用于管理在Linux的ifconfig最初范围外的无线网络接口。iwconfig可修改如无线网络的SSIDWEP密钥的无线网络专有设置,并与iwlist协同工作。Linux也包含iwspy以读取无线连接的信号、噪音与质量。

其它配置以太网适配器的相关工具包括适用Linux的ethtool、mii-tool、mii-diag,以及适用于Solaris的dladm show-link

Solaris也提供ipadm来管理IP配置。

参考资料

[编辑]
  1. ^ Linux Network Administrators Guide Section 5.7. Interface Configuration for IP页面存档备份,存于互联网档案馆
  2. ^ Comparison Map: ifconfig and ipadm Commands. [2020-04-15]. (原始内容存档于2016-10-16). 
  3. ^ net-tools download. SourceForge.net. [2021-06-12]. (原始内容存档于2021-04-30) (英语). 
  4. ^ Gundersen, Tom. News: Deprecation of net-tools. [4 August 2011]. (原始内容存档于2020-11-27). 
  5. ^ https://fedorahosted.org/releases/i/n/initscripts/页面存档备份,存于互联网档案馆) release 9.24 still showing traces of invocations of ifconfig

外部链接

[编辑]
{{bottomLinkPreText}} {{bottomLinkText}}
ifconfig
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?