Online Book Reader

Home Category

UNIX System Administration Handbook - Evi Nemeth [195]

By Root 3002 0
to be sure your changes don’t cause some kind of subtle problem.

If you need to manage all the interfaces at once, the /etc/rc.d/init.d/network script takes the arguments start, stop, restart, and status. This script is invoked at boot time with the start argument.

The Red Hat startup scripts can also configure static routes. Any routes added to /etc/sysconfig/static-routes are entered into the routing table at boot time. The entries provide arguments to a route add command, although in mixed-up order:

eth0 net 130.225.204.48 netmask 255.255.255.248 gw 130.225.204.49

eth1 net 192.38.8.0 netmask 255.255.255.224 gw 192.38.8.129

The interface is specified first, followed by arguments to the route command: the route type (net or host), the target network, the netmask associated with that network, and finally, the next-hop gateway. The keyword gw is required. Current Linux kernels do not use the metric parameter to route but allow it to be entered and maintained in the routing table for routing daemons to use.

Red Hat 5.1 and later include a utility called linuxconf. This utility provides a simple interface for managing many system administration tasks, including most network-related configuration.

Configuration examples for Red Hat


The following commands bring up a Red Hat network interface and add a default route. Notice that the keyword up on the ifconfig line is not required, but gw is required on the route line.

# ifconfig eth0 192.108.21.73 netmask 255.255.255.0

# route add default gw 192.108.21.254 eth0

By default, Red Hat’s ifconfig gives lots of information, including hardware address, link encapsulation, and statistics.

% /sbin/ifconfig

eth0 Link encap:Ethernet HWaddr 00:C0:F0:1F:57:61

inet addr:192.108.21.73 Bcast:192.108.21.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX pkts:248725 errors:0 dropped:0 overruns:0 frame:0

TX pkts:5219 errors:24 dropped:0 overruns:0 carrier:20

collisions:1280 txqueuelen:100

Interrupt:10 Base addr 0x6500

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

UP LOOPBACK RUNNING MTU:3924 Metric:1

RX packets:44 errors:0 dropped:0 overruns:0 frame:0

TX packets:44 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

The value for collisions on the Ethernet interface is 1,280, which as a percentage of output packets is 24.5%; this value is extremely high and indicates a loaded network that needs to be split into multiple subnets or migrated to a switched infrastructure.

As on most systems, netstat -nr dumps the kernel’s routing table, and netstat -i shows information about network interfaces:

% netstat -nr

Kernel IP routing table

Destination Gateway Genmask Flags MSS Window irtt Iface

192.108.21.73 0.0.0.0 255.255.255.255 UH 0 0 0 eth0

192.108.21.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0

127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo

0.0.0.0 192.108.21.254 0.0.0.0 UG 0 0 0 eth0

% netstat -i

Kernel Interface table

------------Receive----------- ----------Transmit---------

Iface MTU Met OK ERR DRP OVR OK ERR DRP OVR Flg

eth0 1500 0 251684 0 0 0 5710 24 0 0 BRU

lo 3924 0 44 0 0 0 44 0 0 0 LRU

The output of Red Hat’s netstat -i, which we have cleaned up a bit to make it fit on the page, shows per-interface counts of normal packets, errors, dropped packets, and overruns in both the receive and transmit directions.

DHCP configuration for Red Hat


Red Hat comes with a DHCP server, dhcpd, and two different DHCP clients: pump24

and dhcpcd, an old DHCP client from CMU that is basically a hacked-up bootpd. We suggest that you ignore both of the supplied DHCP clients and install the client from the Internet Software Consortium at www.isc.org. In our experience, it is more reliable. Red Hat’s DHCP server is from ISC, so it’s something of a puzzlement as to why Red Hat didn’t just use their client as well. Our coverage of ISC client configuration starts on page 332.

pump is Red Hat’s default DHCP client. It is started at boot time when requested by one of the /etc/sysconfig/network-scripts/ifcfg-interface

Return Main Page Previous Page Next Page

®Online Book Reader