ifconfig 中文man頁(yè)面
NAME
ifconfig - 配置網(wǎng)絡(luò)接口
總覽
ifconfig [接口]
ifconfig 接口 [aftype] options | address ...
描述
ifconfig 用于配置常駐內(nèi)核的網(wǎng)絡(luò)接口。它用于在引導(dǎo)成功時(shí)設(shè)定網(wǎng)絡(luò)接口。此后,只在需要調(diào)試及系統(tǒng)調(diào)整時(shí)才使用。
如沒有給出參數(shù), ifconfig 顯示當(dāng)前有效接口的狀態(tài)。如給定單個(gè) 接口 作為參數(shù),它只顯示給出的那個(gè)接口的狀態(tài);如果給出一個(gè) -a 參數(shù),它會(huì)顯示所有接口的狀態(tài),包括那些停用的接口。否則就對(duì)一個(gè)接口進(jìn)行配置。
地址族
如果跟在接口名稱后的第一個(gè)參數(shù)是它支持地址族的名稱,那么這個(gè)地址族被用于翻譯和顯示所有的協(xié)議地址。當(dāng)前支持的地址族包括 inet ( TCP/IP ,缺省), inet6 ( IPv6 ) , ax25 ( AMPR 無(wú)線分組 ), ddp ( Appletalk 2 代), ipx ( Novell IPX ) 和 netrom ( AMPR 無(wú)線分組)。
選項(xiàng)
接口 接口名稱。通常是一個(gè)后跟單元號(hào)的驅(qū)動(dòng)設(shè)備名,例如第一個(gè)以太接口 eth0 。
- up
- 此選項(xiàng)激活接口。如果給接口聲明了地址,等于隱含聲明了這個(gè)選項(xiàng)。
- down
- 此選項(xiàng)使接口驅(qū)動(dòng)設(shè)備關(guān)閉。
- [-]arp
- 允許或禁止在接口上使用 ARP 協(xié)議。
- [-]promisc
- 允許或禁止接口置于混雜模式。如果選用,則接口可以接收網(wǎng)絡(luò)上的所有分組。
- [-]allmulti
- 允許或禁止 組播模式(all-multicast) 。 如果選用,則接口可以接收網(wǎng)絡(luò)上的所有組播分組。
- metric N
- 將接口度量值設(shè)置為整數(shù) N。 (譯注:度量值表示在這個(gè)路徑上發(fā)送一個(gè)分組的成本,就是通過(guò)多少個(gè)路由)
- mtu N
- 此選項(xiàng)設(shè)定接口的最大傳輸單元 MTU。
- dstaddr addr
- 為點(diǎn)到點(diǎn)鏈路(如 PPP )設(shè)定一個(gè)遠(yuǎn)程 IP 地址。此選項(xiàng)現(xiàn)已廢棄;用 pointopoint 選項(xiàng)替換。
- netmask addr
- 為接口設(shè)定 IP 網(wǎng)絡(luò)掩碼。缺省值通常是 A,B 或 C 類的網(wǎng)絡(luò)掩碼 (由接口的 IP 地址推出),但也可設(shè)為其它值。
- add addr/prefixlen
- 為接口加入一個(gè) IPv6 地址。
- del addr/prefixlen
- 為接口刪除一個(gè) IPv6 地址。
- tunnel aa.bb.cc.dd
- 建立一個(gè)新的 SIT (在 IPv4 中的 IPv6 )設(shè)備,為給定的目的地址建立通道。
- irq addr
- 為接口設(shè)定所用的中斷值。并不是所有的設(shè)備都能動(dòng)態(tài)更改自己的中斷值。
- io_addr addr
- 為接口設(shè)定起始輸入/輸出地址。
- mem_start addr
- 設(shè)定接口所用的共享內(nèi)存起始地址。只有少數(shù)設(shè)備需要。
- media type
- 設(shè)定接口所用的物理端口或介質(zhì)類型。并不是所有設(shè)備都會(huì)更改這項(xiàng)值,而且它們支持的類型可能并相同。典型的 type 是 10base2 (細(xì)纜以太網(wǎng)), 10baseT (雙絞線 10Mbps 以太網(wǎng)), AUI (外部收發(fā)單元接口)等等。介質(zhì)類型為 auto 則用于讓設(shè)備自動(dòng)判斷介質(zhì)。同樣,并非所有設(shè)備都可以這樣工作。
- [-]broadcast [addr]
- 如果給出了地址參數(shù),則可以為接口設(shè)定該協(xié)議的廣播地址。否則,為接口設(shè)置(或清除) IFF_BROADCAST 標(biāo)志。
- [-]pointopoint [addr]
- 此選項(xiàng)允許接口置為 點(diǎn)到點(diǎn) 模式,這種模式在兩臺(tái)主機(jī)間建立一條無(wú)人可以監(jiān)聽的直接鏈路。
如果還給出了地址參數(shù),則設(shè)定鏈路另一方的協(xié)議地址,正如廢棄的 dstaddr 選項(xiàng)的功能。否則,為接口設(shè)置(或清除) IFF_POINTOPOINT 標(biāo)志。 - hw class address
- 如接口驅(qū)動(dòng)程序支持,則設(shè)定接口的硬件地址。此選項(xiàng)必須后跟硬件的類型名稱和硬件地址等價(jià)的可打印 ASCII 字符。當(dāng)前支持的硬件類型包括 ether (以太網(wǎng)), ax25 (AMPR AX.25), ARCnet 和 netrom (AMPR NET/ROM)。
- multicast
- 為接口設(shè)定組播標(biāo)志。通常無(wú)須用此選項(xiàng)因?yàn)榻涌诒旧頃?huì)正確設(shè)定此標(biāo)志。
- address
- 為接口分配的 IP 地址。
- txqueuelen length
- 為接口設(shè)定傳輸隊(duì)列的長(zhǎng)度??梢詾榫哂懈邥r(shí)延的低速接口設(shè)定較小值以避免在象 telnet 這樣煩人的交互通信時(shí)大量高速的傳輸。
注意
從內(nèi)核版本 2.2 起不再有別名接口的顯式接口統(tǒng)計(jì)信息了。打印出的源地址統(tǒng)計(jì)信息被同一接口的所有別名地址共享。打印出的源地址統(tǒng)計(jì)信息被同一接口的所有別名地址共享。如果你需要每個(gè)地址的統(tǒng)計(jì)信息,就應(yīng)該用 ipchains(8) 命令為地址加入顯式的記帳規(guī)則。
相關(guān)文件
/proc/net/socket
/proc/net/dev
/proc/net/if_inet6
BUGS
當(dāng)顯示 appletalk DDP 和 IPX 地址時(shí)不能用此命令進(jìn)行更改,但可以用這條命令顯示。
又見
route(8), netstat(8), arp(8), rarp(8), ipchains(8)
#p#
NAME
ifconfig - configure a network interface
SYNOPSIS
ifconfig [interface]
ifconfig interface [aftype] options | address ...
DESCRIPTION
Ifconfig is used to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary. After that, it is usually only needed when debugging or when system tuning is needed.
If no arguments are given, ifconfig displays the status of the currently active interfaces. If a single interface argument is given, it displays the status of the given interface only; if a single -a argument is given, it displays the status of all interfaces, even those that are down. Otherwise, it configures an interface.
Address Families
If the first argument after the interface name is recognized as the name of a supported address family, that address family is used for decoding and displaying all protocol addresses. Currently supported address families include inet (TCP/IP, default), inet6 (IPv6), ax25 (AMPR Packet Radio), ddp (Appletalk Phase 2), ipx (Novell IPX) and netrom (AMPR Packet radio).
OPTIONS
- interface
- The name of the interface. This is usually a driver name followed by a unit number, for example eth0 for the first Ethernet interface.
- up
- This flag causes the interface to be activated. It is implicitly specified if an address is assigned to the interface.
- down
- This flag causes the driver for this interface to be shut down.
- [-]arp
- Enable or disable the use of the ARP protocol on this interface.
- [-]promisc
- Enable or disable the promiscuous mode of the interface. If selected, all packets on the network will be received by the interface.
- [-]allmulti
- Enable or disable all-multicast mode. If selected, all multicast packets on the network will be received by the interface.
- metric N
- This parameter sets the interface metric.
- mtu N
- This parameter sets the Maximum Transfer Unit (MTU) of an interface.
- dstaddr addr
- Set the remote IP address for a point-to-point link (such as PPP). This keyword is now obsolete; use the pointopoint keyword instead.
- netmask addr
- Set the IP network mask for this interface. This value defaults to the usual class A, B or C network mask (as derived from the interface IP address), but it can be set to any value.
- add addr/prefixlen
- Add an IPv6 address to an interface.
- del addr/prefixlen
- Remove an IPv6 address from an interface.
- tunnel aa.bb.cc.dd
- Create a new SIT (IPv6-in-IPv4) device, tunnelling to the given destination.
- irq addr
- Set the interrupt line used by this device. Not all devices can dynamically change their IRQ setting.
- io_addr addr
- Set the start address in I/O space for this device.
- mem_start addr
- Set the start address for shared memory used by this device. Only a few devices need this.
- media type
- Set the physical port or medium type to be used by the device. Not all devices can change this setting, and those that can vary in what values they support. Typical values for type are 10base2 (thin Ethernet), 10baseT (twisted-pair 10Mbps Ethernet), AUI (external transceiver) and so on. The special medium type of auto can be used to tell the driver to auto-sense the media. Again, not all drivers can do this.
- [-]broadcast [addr]
- If the address argument is given, set the protocol broadcast address for this interface. Otherwise, set (or clear) the IFF_BROADCAST flag for the interface.
- [-]pointopoint [addr]
- This keyword enables the point-to-point mode of an interface, meaning that it is a direct link between two machines with nobody else listening on it.
If the address argument is also given, set the protocol address of the other side of the link, just like the obsolete dstaddr keyword does. Otherwise, set or clear the IFF_POINTOPOINT flag for the interface. - hw class address
- Set the hardware address of this interface, if the device driver supports this operation. The keyword must be followed by the name of the hardware class and the printable ASCII equivalent of the hardware address. Hardware classes currently supported include ether (Ethernet), ax25 (AMPR AX.25), ARCnet and netrom (AMPR NET/ROM).
- multicast
- Set the multicast flag on the interface. This should not normally be needed as the drivers set the flag correctly themselves.
- address
- The IP address to be assigned to this interface.
- txqueuelen length
- Set the length of the transmit queue of the device. It is useful to set this to small values for slower devices with a high latency (modem links, ISDN) to prevent fast bulk transfers from disturbing interactive traffic like telnet too much.
NOTES
Since kernel release 2.2 there are no explicit interface statistics for alias interfaces anymore. The statistics printed for the original address are shared with all alias addresses on the same device. If you want per-address statistics you should add explicit accounting rules for the address using the ipchains(8) command.
Interrupt problems with Ethernet device drivers fail with EAGAIN. See http://www.scyld.com/expert/irq-conflict.html for more information.
FILES
/proc/net/socket
/proc/net/dev
/proc/net/if_inet6
BUGS
While appletalk DDP and IPX addresses will be displayed they cannot be altered by this command.
SEE ALSO
route(8), netstat(8), arp(8), rarp(8), ipchains(8)