O'Reilly logo

Linux Pocket Guide, 2nd Edition by Daniel J. Barrett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

ifconfig — stdin  stdout  - file  -- opt  --help  --version

Synopsis

ifconfig [options] interface

The ifconfig command is an ancestor of ip. It is still found on many Linux systems but is less powerful (some would call it obsolete). We’ll cover a few simple commands here, but you should be using ip instead.

To display information about the default network interface (usually called eth0):

$ ifconfig eth0
eth0  Link encap:Ethernet  HWaddr 00:50:BA:48:4F:BA
      inet addr:192.168.0.10  Bcast:192.168.0.255 ...
      UP BROADCAST RUNNING MULTICAST  MTU:1500 ...
      RX packets:1955231 errors:0 dropped:0 overruns:0 ...
      TX packets:1314765 errors:0 dropped:0 overruns:0 ...
      collisions:0 txqueuelen:100
      ...

This includes your MAC address (00:50:BA:48:4F:BA), your IP address (192.168.0.21), your netmask (255.255.255.0), and various other information. To view all loaded network interfaces, run:

$ ifconfig -a

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required