The ifconfig command line utility is used to get information about a Linux network interface configuration and to make changes to it.
Many
Windows administrators are familiar with the ipconfig command line utility, which is used to get information
about network interface configuration and make changes to it. Linux systems have a similar utility, ifconfig, which is a common part of the day-to-day tool belt of
most Linux sysadmins. There are some distinct differences between ipconfig and ifconfig, however, such as the fact that the DOS/Windows ipconfig does
not allow you to make changes to network configuration.
In
general, you must be logged in as root or use sudo to make use of the ifconfig
utility on a Linux machine. The ifconfig
utility can be used either to simply get information about network interface
configuration or to change configuration, depending on what options are used
with the ifconfig command.
Entering
ifconfig at the command line
interface without specifying any options will provide a fairly complete
description of the current state of all active network interfaces. For
instance, on a machine with hostname erebus, entering ifconfig at the command line might
return the following output:
eth0 Link encap:Ethernet HWaddr 00:C0:F0:77:FD:AD
inet addr:192.168.2.103 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::2c0:f0ff:fe77:fdad/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:913240 errors:230 dropped:0 overruns:0 frame:230
TX packets:663990 errors:7 dropped:0 overruns:0 carrier:12
collisions:0 txqueuelen:1000
RX bytes:179148797 (170.8 MiB) TX bytes:53220450 (50.7 MiB)
Interrupt:9 Base address:0xb000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:9814 errors:0 dropped:0 overruns:0 frame:0
TX packets:9814 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3655065 (3.4 MiB) TX bytes:3655065 (3.4 MiB)
Some
important information provided by the ifconfig command includes:
A
number of options can be specified with the ifconfig
command to change its behavior:
The ifconfig eth0 up command on most Linux systems can be abbreviated to ifup eth0.
The same holds true for deactivating an interface, so that ifconfig eth0 down can be abbreviated as ifdown eth0. Some Linux systems will even have
a further abbreviated command for cycling an interface’s status called ifupdown, which quickly deactivates then
reactivates an interface, though this is less common than the individual ifup and ifdown abbreviated commands.
The
“if” in ifconfig, and also
in ifup, ifdown, and ifstatus, is an
abbreviation of “interface”. It is not related to the programming
conditional “if”. You can get more information about this utility by
accessing its manpage, by entering man ifconfig at the command line.
Other
networking utilities of note include:
See
the manpages for any of these utilities to get more
information by entering “man utilityname”
at the command line. For instance, the manpage for
the arp
utility is accessed by entering man arp. You can get more information about
the man utility by entering man man.
\ I'm an IT consultant, developer, and writer. I hold both MS and CompTIA certs and am a graduate of two IT industry trade schools. I was at one time the datacenter technician for the Wikimedia Foundation, probably the \"coolest\" job I've ever had: major geek points for being the first-ever paid employee of the Wikimedia Foundation. I was sad to give it up, but moving to Colorado kinda makes working in a Florida datacenter difficult. I have also written hundreds of articles for TechRepublic. \ Aside from directly work-related skills, I'm an ethical theorist and industry analyst with a keen eye toward open source technologies and intellectual property law. Both parents have worked in IT/IS about as long as I've lived, and I have an enthusiastic interest in computing even outside my profession. I've been playing with computers off and on since about 1980. I started just in time to see an IBM 7072 in operation. \ I'm an active member of a great many Internet-enabled and meatspace computing enthusiast and professional communities including mailing lists, LUGs, and so on. \ See more at: \ \ Apotheonic Labs \ blogstrapping \ Chad Perrin Dot Com \ Copyfree Initiative \ Singular IT, LLC \ UnivAcc \ \ You can find many of my TR articles in a publication listing at Apotheonic Labs, though changes in TR's CSS have broken formatting in a lot of them. \ \ \ Open Works License | http://owl.apotheon.org \