DOC PREVIEW
DMC ITSC 1405 - Linux 101: Use the ifconfig utility in Linux to configure your network

This preview shows page 1-2 out of 5 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Takeawayifconfig Basic functionality OptionsShortcuts More informationAdditional resourcesVersion historyTell us what you thinkPage 1 Copyright ©2006 CNET Networks, Inc. All rights reserved. For more downloads and a free TechRepublic membership, please visit http://techrepublic.com.com/2001-6240-0.htmlVersion 1.0 February 17, 2006Linux 101: Use the ifconfig utility in Linux to configure your network By Chad Perrin Takeaway The ifconfig command line utility is used to get information about a Linux network interface configuration and to make changes to it. ifconfig 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.Linux 101: Use the ifconfig utility in Linux to configure your network Basic functionality 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: • Each active interface is identified by its name. For instance, on erebus, eth0 (the first Ethernet adapter) and lo (the loopback adapter) are both active. • In the case of a physical network adapter, you'll get the MAC address, preceded by the term HWaddr. • The IP address of the interface is preceded by the term inet addr, the broadcast address by Bcast, and the subnet mask by Mask. • The IPv6 address of each interface is preceded by the term inet6 addr and its scope, predictably, by the word Scope. • The types of activity of each interface are listed together—in the case of eth0 above, it lists UP BROADCAST RUNNING MULTICAST. • Statistics for received and transmitted packets are listed on lines beginning with RX or TX, respectively. On another line, summary information about the amount of received and transmitted data is listed, including the total number of bytes transmitted and received on that device so far. Page 2 Copyright ©2006 CNET Networks, Inc. All rights reserved. For more downloads and a free TechRepublic membership, please visit http://techrepublic.com.com/2001-6240-0.htmlLinux 101: Use the ifconfig utility in Linux to configure your network Options A number of options can be specified with the ifconfig command to change its behavior: • -a This option tells ifconfig to show information about all interfaces, both active and inactive. On erebus, ifconfig -a returns results for eth0, lo, and sit0. • -s This is the "short listing" option, which shows a one-line summarized listing of data about each interface. The information returned is about interface activity, and not configuration. The output will be identical to what is returned by the netstat -i command. • -v This "verbose" option returns extra information when there are certain types of error conditions to help with troubleshooting. • [int] Simply follow up your ifconfig command with the name of an interface to get only information about that interface. For instance, you could issue the command ifconfig eth0 if you only wanted information about the eth0 interface, and not the loopback interface. Additionally, there are several options that require specifying the interface you wish to configure or get information about. • up This activates an interface if it is not already active. For instance, ifconfig eth0 up causes eth0 to be activated. • down The counterpart to up, this deactivates the specified interface. Thus, ifconfig eth0 down causes eth0 to be deactivated if it is currently active. • netmask [addr] Using the "netmask" option allows you to set the network mask for a given interface. For instance, setting the network mask for eth0 could be done by entering ifconfig eth0 netmask 255.255.255.0. • broadcast [addr] When the "broadcast" option is accompanied by an address argument, as in ifconfig eth0 broadcast 192.168.2.255, then the broadcast address for the specified interface will be set. • [addr] Simply specifying an address with an interface name, as in ifconfig eth0 192.168.2.103, will set that interface's IP address. Shortcuts 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. Page 3 Copyright ©2006 CNET Networks, Inc. All rights reserved. For more downloads and a free TechRepublic membership, please visit


View Full Document

DMC ITSC 1405 - Linux 101: Use the ifconfig utility in Linux to configure your network

Documents in this Course
Firewall

Firewall

53 pages

Syllabus

Syllabus

11 pages

Load more
Download Linux 101: Use the ifconfig utility in Linux to configure your network
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Linux 101: Use the ifconfig utility in Linux to configure your network and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Linux 101: Use the ifconfig utility in Linux to configure your network 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?