Internal registers self-test: passed.
ROM checksum self-test: passed (0x04f4518b).
...
In this example, an Intel Ethernet Pro 100 NIC has been recognized. To disable support
for a NIC, the kernel module can be unloaded, but usually only after the device is no
longer in use. Read the next section to learn how to configure a NIC after it has been
recognized by the Linux kernel and how to control its behavior.
Using Network Configuration Tools
If you add or replace networking hardware after your initial installation, you must config-
ure the new hardware. You can do so using either the command line or the graphical
configuration tools. To configure a network client host using the command line, you can
use a combination of commands or edit specific files under the
/etc directory. To config-
ure the hardware through a graphical interface, you can use Ubuntu’s graphical tool for X
called
network-admin. This section introduces command-line and graphical software tools
you can use to configure a network interface and network settings on your Ubuntu
system. You’ll see how to control your NIC and manage how your system interacts with
your network.
Using the command-line configuration tools can seem difficult if you are new to Linux.
For anyone new to networking, the
network-admin graphical tool is the way to go. Both
manual and graphical methods require root access to work. If you do not have root
access, get it before trying any of these actions. You should not edit any scripts or settings
files used by graphical network administration tools on your system. Your changes will be
lost the next time the tool, such as
network-admin, is run! Either use a manual approach
and write your own network setup script, or stick to using graphical configuration
utilities.
Command-Line Network Interface Configuration
You can configure a network interface from the command line using the basic Linux
networking utilities. You configure your network client hosts with the command line by
using commands to change your current settings or by editing a number of system files.
Two commands,
ifconfig and route, are used for network configuration. The netstat
command displays information about the network connections.
/sbin/ifconfig
ifconfig is used to configure your network interface. You can use it to
. Activate or deactivate your NIC or change your NIC’s mode
. Change your machine’s IP address, netmask, or broadcast address
. Create an IP alias to allow more than one IP address on your NIC
. Set a destination address for a point-to-point connection
Using Network Configuration Tools
405
18
You can change as many or as few of these options as you’d like with a single command.
The basic structure for the command is as follows:
ifconfig [network device] options
Table 18.1 shows a subset of ifconfig options and examples of their uses.
TABLE 18.1 ifconfig Options
Use Option Example
Create alias
[network device] ifconfig eth0:0_:[number]
10.10.10.10
Change IP address ifconfig eth0 10.10.10.12
Change the netmask netmask [netmask] fconfig eth0 netmask 255.255.255.0
Change the broadcast broadcast [address] ifconfig eth0 broadcast
10.10.10.255
Take interface down down ifconfig eth0 down
Bring interface up up (add IP address) ifconfig eth0 up (ifconfig eth0
10.10.10.10)
Set NIC promiscuous [-]promisc ifconfig eth0 promisc mode on
[ifconfig eth0 -promisc] [off]
Set multicasting mode
[-]allmulti ifconfig eth0_on [off]
allmulti [ifconfig
eth0 -allmulti]
Enable [disable] [-]pointopoint ifconfig_point-to-point address
[address] eth0_pointopoint 10.10.10.20 [ifconfig eth0
pointopoint_10.10.10.20]
The ifconfig man page shows other options that enable your machine to interface with a
number of network types such as AppleTalk, Novell, IPv6, and others. Again, read the man
page for details on these network types.
NOTE
Promiscuous mode causes the NIC to receive all packets on the network. It is often
used to sniff a network. Multicasting mode enables the NIC to receive all multicast
traffic on the network.
If no argument is given,
ifconfig displays the status of active interfaces. For example, the
output of
ifconfig, without arguments and one active and configured NIC, looks similar
to this:
$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:0F:EA:B2:53:85
inet addr:192.168.2.5 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20f:eaff:feb2:5385/64 Scope:Link
CHAPTER 18 Network Connectivity
406

Get Ubuntu Unleashed, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.