
782
Networking Commands
If you use this command without any parameters, the computer’s host name
is displayed. If you specify a name, the computer’s host name is changed to
the name you specify.
The ifconfig command
ifconfig displays and sets configuration options for network interfaces.
Although you can configure an Ethernet adapter using this command, you’ll
rarely have to. Linux does a pretty good job of automatically configuring
network adapters, and the GNOME-based Network Configuration tool sup-
plied with the Red Hat distribution should be able to handle most network
configuration chores. So you’ll use ifconfig mostly to display network
configuration settings.
The basic syntax for ifconfig is
ifconfig interface [address] [netmask mask]
[broadcast broadcast]
The following paragraphs describe the options that you can use on the
ifconfig command:
✦ Interface: The symbolic name for your network adapter. It’s typically
eth0 for the first Ethernet adapter or eth1 for the second adapter.
✦ Address: The IP address you want to assign to the interface, such as
192.168.1.100.
✦ netmask: The subnet mask to use, such as 255.255.255.0.
✦ broadcast: The broadcast, which should be the highest address on the
subnet. For example: 192.168.1.255.
If you enter ifconfig without any parameters, the ifconfig command
displays the current status of your network adapters, like this:
eth0 Link encap:Ethernet HWaddr 00:20:78:16:E0:6A
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:2916 (2.8 Kb)
Interrupt:11 Base address:0xd000
eth1 Link encap:Ethernet HWaddr 00:40:05:80:51:F3
inet addr:192.168.3.100 Bcast:192.168.3.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2358 errors:0 dropped:0 overruns:0 frame:0
TX packets:1921 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:265194 (258.9 Kb) TX bytes:424467 (414.5 Kb)
Interrupt:3 Base address:0xc000
71_625873-bk09ch09.indd 78271_625873-bk09ch09.indd 782 9/21/10 10:48 PM9/21/10 10:48 PM