The ifconfig Command


Published on

A look at this useful command for connecting your computer to a network

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

The ifconfig Command

  1. 1. ifconfig Kevin O'Brien Washtenaw Linux Users Group
  2. 2. ifconfig ● ... stands for interface configurator ● ... is part of the original internet toolkit 087-2-iface.interface.html ● ... has versions available for Linux, BSD, Solaris, and Mac OSX 2
  3. 3. man page ● 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. 3
  4. 4. man page 2 ● 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. 4
  5. 5. Sample output eth0 Link encap 10Mbps Ethernet HWaddr 00:0F:20:CF:8B:42 inet addr Bcast Mask UP BROADCAST RUNNING MULTICAST MTU 1500 Metric 0 RX packets 3136 errors217 dropped 7 overrun 26 TX packets 1752 errors 25 dropped 0 overrun 0 5
  6. 6. What is it saying? ● eth0 is the interface it is reporting on. It is the first of the ethernet interfaces on this computer. ● The Hardware Address is 00:0F:20:CF:8B:42. This is sometimes called the MAC address (Media Access Control), and is a hexadecimal number assigned to the ethernet card at the factory. ● The internet address is This is the address assigned to this computer. 6
  7. 7. What is it saying? 2 ● The Broadcast Address is This is an address that can be used to send messages to every computer on the same subnet as this computer. ● The Subnet Mask is This can be thought of as defining or identifying the subnet this computer is part of. ● The rest of it tells about packets sent, received, dropped, etc. 7
  8. 8. Use for information ● The first thing most beginners will want to do is use this for information. ● If you find you are not connected to the Internet, use this command to see if your interface is configured and active. ● You can use this to check on your IP address and subnet mask. ● There is an equivalent for wireless interfaces, called iwconfig. 8
  9. 9. Parallels for newbies ● Windows 95 through ME had a command called winipcfg ● Windows NT through Windows Vista have ipconfig ● These are essentially similar to the Unix command ifconfig 9
  10. 10. Syntax ● ifconfig interface [address [parameters]] ● interface is the interface name, such as eth0 (first ethernet device) or lo (local host) ● address is the IP address assigned to the interface. This can be specified as a dotted quad address, or as a name that can be looked up in /etc/hosts. 10
  11. 11. Parameters ● up – Makes an interface accessible to the IP layer. ● down – Makes an interface inaccessible to the IP layer, i.e. stops all traffic through this interface. ● netmask mask – Sets the subnet mask to be used by the interface. ● broadcast address – Sets the broadcast address. 11
  12. 12. Warning! ● If you are not a network administrator, be very careful about setting addresses from the command line. Even people with some experience can get confused setting a subnet mask. You don't want your interface to stop working in some mysterious way. ● Using this command to get information is completely safe. 12
  13. 13. Warning! 2 ● If you do want to experiment (a very good way to learn about these things), just make sure you are not using a mission-critical computer. Whatever you screw up you will need to unscrew.☺ 13
  14. 14. More on this command ● There are other parameters and options available for this command, but they go beyond the requirements for this presentation. Consult Google or the man page for more information. ● A good readable guide to the basics can be found at iface.ifconfig.html 14
  15. 15. Examples ● ifconfig eth0 – View the network settings on the first Ethernet adapter installed in the computer. ● ifconfig -a – Display information on all network interfaces on the computer, active or inactive. ● ifconfig eth0 down – Would take down the interface, and no packets would be sent or received. ● ifconfig eth0 up – Would bring the interface back up so it could send and receive data. 15
  16. 16. Examples 2 ● ifconfig eth0 netmask broadcast – This would assign these values to the first Ethernet device installed in the computer. Be careful here! 16