Datasheet
“main” (Installation and Administration) — 2004/6/25 — 13:29 — page 419 — #445
i
i
i
i
i
i
i
i
21
Linux in the Network
Netmasks and Routing
Netmasks were conceived for the purpose of informing the host with
the IP address 192.168.0.0 of the location of the host with the IP address
192.168.0.20. To put it simply, the netmask on a host with an IP address de-
fines what is internal and what is external. Hosts located internally (“in the
same subnetwork”) respond directly. Hosts located externally (“not in the
same subnetwork”) only respond via a gateway or router. Because every
network interface can receive its own IP address, it can get quite compli-
cated.
Before a network packet is sent, the following runs on the computer: the IP
address is linked to the netmask via a logical AND and the address of the
sending host is likewise connected to the netmask via the logical AND. If
there are several network interfaces available, normally all possible sender
addresses are verified. The results of the AND links are compared. If there
are no discrepancies in this comparison, the destination, or receiving host,
is located in the same subnetwork. Otherwise, it must be accessed via a
gateway. The more “1” bits are located in the netmask, the fewer hosts can
be accessed directly and the more hosts can be reached via a gateway. Sev-
eral examples are illustrated in Table 21.2.
Example 21.2: Linking IP Addresses to the Netmask
IP address (192.168.0.20): 11000000 10101000 00000000 00010100
Netmask (255.255.255.0): 11111111 11111111 11111111 00000000
---------------------------------------------------------------
Result of the link: 11000000 10101000 00000000 00000000
In the decimal system: 192. 168. 0. 0
IP address (213.95.15.200): 11010101 10111111 00001111 11001000
Netmask (255.255.255.0): 11111111 11111111 11111111 00000000
---------------------------------------------------------------
Result of the link: 11010101 10111111 00001111 00000000
In the decimal system: 213. 95. 15. 0
The netmasks appear, like IP addresses, in decimal form divided by pe-
riods. Because the netmask is also a 32-bit value, four number values are
written next to each other. Which hosts are gateways or which address do-
mains are accessible over which network interfaces must be configured.
To give another example: all machines connected with the same ethernet
cable are usually located in the same subnetwork and are directly accessi-
ble. When the ethernet is divided by switches or bridges, these hosts can
still be reached.
419
SUSE LINUX Enterprise Server










