Online Book Reader

Home Category

UNIX System Administration Handbook - Evi Nemeth [183]

By Root 2614 0
storms occur because the same link-layer broadcast address must be used to transport packets no matter what the IP broadcast address has been set to. For example, suppose that machine X thinks the broadcast address is A1 and that machine Y thinks it is A2. If X sends a packet to address A1, Y will receive the packet (because the link-layer destination address is the broadcast address), will see that the packet is not for itself and also not for the broadcast address (because Y thinks the broadcast address is A2), and will then forward the packet back onto the net. If there are two machines in Y’s state, the packet will circulate forever until it expires. Broadcast storms can erode your bandwidth, especially on a large switched net.

A better way to avoid problems with broadcast pings is to prevent your border routers from forwarding them and to tell individual hosts not to respond to them. See the vendor-specific sections starting on page 306 for instructions on how to implement these constraints on each of our example systems.

In the ifconfig example at the beginning of this section, the broadcast address is 128.138.240.255 because the network is a /24, as specified by the netmask value of 255.255.255.0.

Executing ifconfig en0 shows the following output:

en0: flags=63 inet 128.138.240.1

netmask ffffff00 broadcast 128.138.240.255

Let’s look at some complete examples.

# ifconfig lo0 127.0.0.1 up

This command configures the loopback interface, which doesn’t usually require any options to be set. You should never need to change your system’s default configuration for this interface. The implied netmask of 255.0.0.0 is correct and does not need to be manually overridden.

# ifconfig en0 128.138.243.151 netmask 255.255.255.192

broadcast 128.138.243.191 up

This is a typical example for an Ethernet interface. The IP and broadcast addresses are set to 128.138.243.151 and 128.138.243.191, respectively. The network is class B (you can tell from the first byte of the address), but it has been subnetted by an additional ten bits into a /26 network. 192 in the netmask is 11000000 in binary and so adds 2 extra bits to the 24 contained in the three 255 octets. The 191 in the broadcast address is 10111111 in binary, which sets all 6 host bits to 1s and indicates that this interface is part of the 3rd network (10) in the group of 4 carved out of the 4th octet.

Now that you know how to configure a network interface by hand, you need to figure out how the parameters to ifconfig are set when the machine boots, and you need to make sure that the new values are entered correctly. You normally do this by editing one or more configuration files; see the vendor-specific sections starting on page 306 for more information.

route: configure static routes


The route command defines static routes, explicit routing table entries that never change (you hope), even if you run a routing daemon.18

When you add a new machine to a local area network, you usually only need to specify a default route; see the next section for details. Be sure to read your system’s man page for route as well. Syntax, flags, and arguments vary enormously among vendors.

This book’s discussion of routing is split between this section and Chapter 14, Routing. Although most of the basic information about routing and the route command is here, you might find it helpful to read the first few sections of Chapter 14 if you need more information.

Routing is performed at the IP layer. When a packet bound for some other host arrives, the packet’s destination IP address is compared with the routes in the kernel’s routing table. If it matches or partially matches a route in the table, the packet is forwarded to the “next gateway” IP address associated with that route.

There are two special cases: First, a packet may be destined for some host on a directly connected network. In this case, the “next gateway” address in the routing table will be one of the local host’s own interfaces, and the packet is sent directly to its destination.

Return Main Page Previous Page Next Page

®Online Book Reader