ifconfig Command
Purpose
Configures or displays network interface parameters for a network by using TCP/IP.
Syntax
ifconfig interface [ addressfamily [ address [ destinationaddress ] ] [ parameters... ] ]
ifconfig interface [ protocolfamily ] interface protocolfamily
ifconfig -a [ -l ] [ -d ] [ -u ] [ protocolfamily ]
ifconfig interface [ tcp_low_rto rto | -tcp_low_rto ]
Description
You can use the ifconfig command to assign an address to a network interface and to configure or display the current network interface configuration information. The ifconfig command must be used at system startup to define the network address of each interface present on a system. After system startup, it can also be used to redefine an interfaces address and its other operating parameters. The network interface configuration is held on the running system and must be reset at each system restart. The ifconfig command interprets the IFF_MULTICAST flag and prints its value if it is set.
An interface can receive transmissions in differing protocols, each of which might require separate naming schemes. It is necessary to specify the addressfamily parameter, which might change the interpretation of the remaining parameters. The address families that are currently supported are inet and inet6.
For the DARPA-Internet family, inet, the address is either a host name present in the host name database, that is, the /etc/hosts file, or a DARPA-Internet address that is expressed in the Internet standard dotted decimal notation.
While any user can query the status of a network interface, only a user who has administrative authority can modify the configuration of those interfaces.
The ifconfig function displays the current configuration for a network interface when no optional parameters are supplied.
If a protocol family is specified, ifconfig reports only the details specific to that protocol family.
Only a super user can modify the configuration of a network interface.
Gratuitous ARP is supported for Ethernet, token-ring, and FDDI interfaces. This support means when an IP address is assigned, the host sends an ARP request for its own address (the new address) to inform other systems of its address so that they can update their ARP entry immediately. It also lets hosts detect duplicate IP address. If you get a response to the ARP request, an error is logged in /var/adm/ras/errlog, which can be viewed by using errpt command (or by using SMIT interface) for the error ID AIXIF_ARP_DUP_ADDR.
ib0:flags=e3a0063<UP,BROADCAST,NOTRAILERS,RUNNING,ALLCAST,MULTICAST,GROUPRT>
pmtu 2048 qkey
0x1e qpn 0x48 lid 0x5c hca iba0 port 1 inet 1.2.3.120 netmask 0xffffff00 broadcast
1.2.3.255 inet6
fe80::2:c903:1:1e8d/64 tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1
The
interface now displays the path mtu (pmtu), Queue Key (qkey), Queue
Pair Number (qpn), Local ID (lid), Host Channel Adapter (hca), and
the port number (port). This information is useful during debugging
or performing diagnostics.When the detach command is specified with the ifconfig command, all
other options are ignored. Specifying the detach command prevents the garbage character in
the ipconfig command from causing any error. For example, the ifconfig en3 garbage
detach
command runs properly even when with the bad option.
Flags
Item | Description |
---|---|
-a | Optionally, the -a flag can be used instead of an interface name. This flag instructs ifconfig to display information about all interfaces in the system. |
-d | The -d flag displays interfaces that are down. You can use the flag only with the -a or -l flag. |
-l | This flag can be used to list all available interfaces on the system, with no other additional information. Use of this flag is mutually exclusive with all other flags and commands, except for -d and -u. |
-u | The -u flag displays interfaces that are up. You can use the flag only with the -a or -l flag. |
protocolfamily | This flag specifies protocols such as tcp, udp, tcp6, udp6, icmp, and icmp6. |
Parameters
Item | Description |
---|---|
address | Specifies the network address for the network interface. For the inet family, the address parameter is either a host name or an IP address in the standard dotted decimal notation. |
addressfamily | Specifies which network address family to change. The inet and inet6 address families are currently supported. This parameter defaults to the inet address family. |
destinationaddress | Specifies the address of the correspondent on the remote end of a point-to-point link. |
interface | Specifies the network interface configuration values to show
or change. You must specify an interface with the interface parameter
when you use the ifconfig command. Abbreviations for the interfaces
include:
Include a numeral after the abbreviation to identify the specific interface (for example, tr0). If interface is not yet loaded, ifconfig interface loads that interface and netstat -in lists it. In processing a status query for interface, that interface is loaded (if not already loaded) to complete the query processing. |
parameter | Allows the following parameter values:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rto | Specifies the retransmission timeout in milliseconds. The range
for this value is 0 - 3000. Requirement: You must set the timer_wheel_tick value of the no command before you set the rto value by using the ifconfig command. The rto value that you specify must be equal to or a multiple of 10 times the timer_wheel_tick value that is set. |
The following network options, commonly known as Interface Specific Network Options (ISNO), can be configured on a per interface basis:
- rfc1323 [0 | 1]
- Enables or disables TCP enhancements as specified by RFC 1323, TCP Extensions for High Performance. A value of 1 specifies that all TCP connections by using this interface will attempt to negotiate the RFC enhancements. A value of 0 disables rfc1323 for all connections by using this interface. The SOCKETS application can override this ISNO and global behavior on individual TCP connections with the setsockopt subroutine.
- -rfc1323
- Removes the use of ISNO for rfc1323 for this network. A SOCKETS application can override the global behavior on individual TCP connections by using the setsockopt subroutine.
- tcp_mssdflt Number
- Sets the default maximum segment size that is used in communicating with remote networks. If you communicate over this interface, a socket uses Number as the value of the default maximum segment size.
- -tcp_mssdflt
- Removes the use of ISNO for the tcp_mssdflt option. The global value, which is manipulated through /usr/sbin/no, is used instead.
- tcp_recvspace Size
- Specifies the default socket buffer size for interface sockets that are receiving data. The buffer size affects the window size that is used by TCP. (For more information, see the no command.)
- -tcp_recvspace
- Removes the use of ISNO for the tcp_recvspace option. The global value is used instead.
- tcp_sendspace Size
- Specifies the default socket buffer size for interface sockets that are sending data. The buffer size affects the window size that is used by TCP. (For more information, see the no command.)
- -tcp_sendspace
- Removes the use of ISNO for the tcp_sendspace option. The global value is used instead.
- tcp_nodelay [0 | 1]
- Specifies that sockets by using TCP over this interface follow the Nagle algorithm when you send data. By default, TCP follows the Nagle algorithm.
- -tcp_nodelay
- Removes the use of ISNO for the tcp_nodelay option.
Tip: Parameters that you set by using the ifconfig command are lost the next time that you restart your system. Use the chdev command to change the Object Data Manager (ODM) database for each interface to make parameter changes permanent. Use the lsattr -E -l [interface] command to view the interface attributes and use the chdev -l [interface] -a [attribute=value] command to change the attribute. For example:lsattr -E -l en0 chdev -l en0 -a tcp_sendspace=65536
Security
Examples
- To query the status of a serial line IP interface,
enter the following command:
In this example, the interface to be queried is sl1. The result of the command looks similar to the following result:ifconfig sl1
sl1: flags=51<UP,POINTOPOINT,RUNNING> inet 192.9.201.3 --> 192.9.354.7 netmask ffffff00
- To configure the local loop-back interface, enter
the following command:
ifconfig lo0 inet 127.0.0.1 up
- To mark the local token-ring interface as down,
enter the following command:
In this example, the interface to be marked is token0.ifconfig tr0 inet down
Note: Only a user with root user authority can modify the configuration of a network interface.
- To turn rfc1323 off for all connections over en5 (assuming
that the global value is 1), enter the following command:
ifconfig en0 rfc1323 0
- To configure a list of interfaces to use a vipa, enter the following
command:
ifconfig vi0 vipa_iflist en0,en1,tr0
- To remove interfaces that are configured to use vipa, enter the
following command:
ifconfig vi0 -vipa_iflist en1,tr0
- To find out which interfaces are configured to use a vipa, say
vi0, enter the following command:
ifconfig vi0
- To enable link status monitoring, enter the following command:
If the link status on adapterifconfig en0 monitor
ent0
changes todown
, the adapter notifies the interface layer, which causes the interface to also be marked asdown
. - To configure a Generic Routing Encapsulation (GRE) tunnel between
the interfaces of two nodes, enter the following command:
This creates a GRE tunnel between the local interfaceifconfig gre0 tunnel 9.3.149.70 9.3.149.121
9.3.149.70
and the remote interface9.3.149.121
. The local end of the tunnel is identified bygre0
. - To associate an IP address with the newly created interface, enter
the following command:
ifconfig gre0 10.10.10.1
- To configure NAT on a GRE tunnel, enter the following command:
In this example, the original destination port of the GRE packet isifconfig gre0 nat toaddr 127.0.0.1 fromport 80 toport 8080
80
and the command changes the destination port to8080
and the destination address to127.0.0.1
. - To configure a GIF tunnel between one-to-many endpoints (one-to-many
tunnel), enter the following command:
The command creates a one-to-many tunnel between the source (ifconfig gif0 10.10.10.1 netmask 255.255.255.0 tunnel 2000::4612:6995:6c4a:fa6e 10.10.10.10,2000::4612:6995:6c4a:fa6a 10.10.10.11,2000::4612:6995:6c4a: fa6b 15.15.15.1,2000::4612:6995:6c4a:f777
2000::4612:6995:6c4a:fa6e
) and the following 3 targets:2000::4612:6995:6c4a:fa6a
2000::4612:6995:6c4a:fa6b
2000::4612:6995:6c4a:f777
10.10.10.1
IP address to the GIF interface. - To configure a one-to-one GIF tunnel between two endpoints, enter
the following command:
The command creates a GIF tunnel between the source (ifconfig gif0 10.10.10.1 netmask 255.255.255.0 tunnel 2000::4612:6995:6c4a:fa6e 10.10.10.10,2000::4612:6995:6c4a:fa66
2000::4612:6995:6c4a:fa6e
) and the target (2000::4612:6995:6c4a:fa66
). - The command also configures the 10.10.10.1 IP address to a GIF interface.
Files
Item | Description |
---|---|
/etc/host | Contains the host name database. |
/etc/networks | Contains network names. |