The Broadcast Address

The broadcast address is used to send a packet to every host on a network. The standard broadcast address is composed of the network address and a host address of 255. Given the ifconfig statement shown previously, the default broadcast address is 172.16.5.255. Using the IP address of 172.16.5.4 and the netmask of 255.255.255.0 gives a network address of 172.16.5.0. Add to that the host address of 255 to get 172.16.5.255. So why did I define the broadcast address instead of letting it default? Because you might be surprised by the default broadcast address.

You can check the configuration of an Ethernet interface by using the ifconfig command with only the interface name as a command-line argument. This does not change any configuration values; it displays the values that have already been set. Here is an example:

# ifconfig eth0 172.16.5.4 netmask 255.255.255.0

# ifconfig eth0

eth0 Link encap:Ethernet HWaddr 00:60:97:90:37:51 inet addr:172.16.5.4 Bcast:172.16.255.255

Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:319 errors:0 dropped:0 overruns:0 TX packets:76 errors:0 dropped:0 overruns:0 Interrupt:3 Base address:0x300

In this example, we configure the interface but do not define the broadcast address, expecting that the default will be exactly what we want. Instead, the default appears to ignore the netmask argument, and creates a broadcast address that would be correct if we used the old address class rules. Be specific. There are several files and scripts involved in setting the network interface configuration during the boot. Unless you're specific about it, you might not get the configuration you want.

Was this article helpful?

0 0

Post a comment