1. Computing & Technology

Discuss in my forum

Example uses of the command "ifconfig"

A Brief Introduction

By , About.com Guide

While the ifconfig command can make changes in the network configuration of your machine, it is frequently used simply to display information about the current setup.

If you type in "ifconfig" at a command prompt and hit return the system will print out the parameter settings of the currently active network interfaces. In particular, if you want to find out what your IP address is, this command would tell you that with the "inet addr" parameter.

Here is an example of what this output can look like:


eth0      Link encap:Ethernet  HWaddr 00:18:a9:75:93:2d  
          inet addr:172.131.4.126  Bcast:255.255.255.255  Mask:255.255.255.0
          inet6 addr: fe80::219:b9cf:fc82:963d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:142 errors:0 dropped:0 overruns:0 frame:0
          TX packets:42 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:42222 (41.2 KB)  TX bytes:6091 (5.9 KB)
          Interrupt:18 

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:1110 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1110 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:55500 (54.1 KB)  TX bytes:55500 (54.1 KB)

wlan0     Link encap:Ethernet  HWaddr 00:1c:74:47:7a:9c  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wmaster0  Link encap:UNSPEC  HWaddr 00-1B-77-37-8A-9F-00-00-00-00-00-00-00-00-00-00  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
The first interface, eth0, represents the outside Internet connection. The second, lo, is a local network interface, and the remaining two are not active.

The ifconfig command is in some ways similar to the ipconfig command on MS Windows operating systems, which also tells you the IP address of your computer.

For more information see the ifconfig man page.

©2012 About.com. All rights reserved.

A part of The New York Times Company.