Xem mẫu

Because of the all bits 0 and all bits 1 restrictions, this defines 218-2 (from 1 to 262143) valid subnets. This split provides 262142 subnets each with a maximum of 26-2 (62) hosts. The value applied to the subnet number takes the value of the full octet with non-significant bits set to zero. For example, the hexadecimal value 01 in this subnet mask assumes an 8-bit value 01000000. This provides a subnet value of 64. Applying the 255.255.255.192 to the sample Class A address of 9.67.38.1 provides the following information: 00001001 01000011 00100110 00000001 = 9.67.38.1 (Class A address) 11111111 11111111 11111111 11------ 255.255.255.192 (subnet mask) ===================================== logical_AND 00001001 01000011 00100110 00------ = 9.67.38.0 (subnet base address) This leaves a host address of: -------- -------- -------- --000001 = 1 (host address) IP will recognize all host addresses as being on the local network for which the logical_AND operation described earlier produces the same result. This is important for routing IP datagrams in subnet environments (refer to 3.1.3, “IP routing” on page 77). The subnet number is: -------- 01000011 00100110 00------ = 68760 (subnet number) This subnet number is a relative number. That is, it is the 68760th subnet of network 9 with the given subnet mask. This number bears no resemblance to the actual IP address that this host has been assigned (9.67.38.1). It has no meaning in terms of IP routing. The division of the original into is chosen by the network administrator. The values of all zeroes and all ones in the field are reserved. Variable length subnetting example Consider a corporation that has been assigned the Class C network 165.214.32.0. The corporation has the requirement to split this address range into five separate networks each with the following number of hosts: Ê Subnet 1: 50 hosts Ê Subnet 2: 50 hosts Ê Subnet 3: 50 hosts 76 TCP/IP Tutorial and Technical Overview Ê Subnet 4: 30 hosts Ê Subnet 5: 30 hosts This cannot be achieved with static subnetting. For this example, static subnetting divides the network into four subnets each with 64 hosts or eight subnets each with 32 hosts. This subnet allocation does not meet the stated requirements. To divide the network into five subnets, multiple masks need to be defined. Using a mask of 255.255.255.192, the network can be divided into four subnets each with 64 hosts. The fourth subnet can be further divided into two subnets each with 32 hosts by using a mask of 255.255.255.224. There will be three subnets each with 64 hosts and two subnets each with 32 hosts. This satisfies the stated requirements and eliminates the possibility of a high number of wasted host addresses. Determining the subnet mask Usually, hosts will store the subnet mask in a configuration file. However, sometimes this cannot be done, for example, as in the case of a diskless workstation. The ICMP protocol includes two messages: address mask request and address mask reply. These allow hosts to obtain the correct subnet mask from a server (refer to “Address Mask Request (17) and Address Mask Reply (18)” on page 116). Addressing routers and multihomed hosts Whenever a host has a physical connection to multiple networks or subnets, it is described as being multihomed. By default, all routers are multihomed because their purpose is to join networks or subnets. A multihomed host has different IP addresses associated with each network adapter. Each adapter connects to a different subnet or network. 3.1.3 IP routing An important function of the IP layer is IP routing. This provides the basic mechanism for routers to interconnect different physical networks. A device can simultaneously function as both a normal host and a router. A router of this type is referred to as a router with partial routing information. The router only has information about four kinds of destinations: Ê Hosts that are directly attached to one of the physical networks to which the router is attached. Ê Hosts or networks for which the router has been given explicit definitions. Chapter 3. Internetworking protocols 77 Ê Hosts or networks for which the router has received an ICMP redirect message. Ê A default for all other destinations. Additional protocols are needed to implement a full-function router. These types of routers are essential in most networks, because they can exchange information with other routers in the environment. We review the protocols used by these routers in Chapter 5, “Routing protocols” on page 171. There are two types of IP routing: direct and indirect. Direct routing If the destination host is attached to the same physical network as the source host, IP datagrams can be directly exchanged. This is done by encapsulating the IP datagram in the physical network frame. This is called direct delivery and is referred to as direct routing. Indirect routing Indirect routing occurs when the destination host is not connected to a network directly attached to the source host. The only way to reach the destination is through one or more IP gateways. (Note that in TCP/IP terminology, the terms gateway and router are used interchangeably. This describes a system that performs the duties of a router.) The address of the first gateway (the first hop) is called an indirect route in the IP routing algorithm. The address of the first gateway is the only information needed by the source host to send a packet to the destination host. In some cases, there may be multiple subnets defined on the same physical network. If the source and destination hosts connect to the same physical network but are defined in different subnets, indirect routing is used to communicate between the pair of devices. A router is needed to forward traffic between subnets. 78 TCP/IP Tutorial and Technical Overview Figure 3-5 shows an example of direct and indirect routes. Here, host C has a direct route to hosts B and D, and an indirect route to host A via gateway B. Host A Host B Host C Host D Figure 3-5 IP: Direct and indirect routes IP routing table The determination of direct routes is derived from the list of local interfaces. It is automatically composed by the IP routing process at initialization. In addition, a list of networks and associated gateways (indirect routes) can be configured. This list is used to facilitate IP routing. Each host keeps the set of mappings between the following: Ê Destination IP network addresses Ê Routes to next gateways This information is stored in a table called the IP routing table. Three types of mappings are in this table: Ê The direct routes describing locally attached networks Ê The indirect routes describing networks reachable through one or more gateways Chapter 3. Internetworking protocols 79 Ê The default route that contains the (direct or indirect) route used when the destination IP network is not found in the mappings of the previous types of type 1 and 2 Figure 3-6 presents a sample network. 128.10 129.7 Host A Host B Host E Host F 128.15 Host C Host D Figure 3-6 IP: Routing table scenario The routing table of host D might contain the following (symbolic) entries (Table 3-2). Table 3-2 Host D sample entries Destination 129.7.0.0 128.15.0.0 128.10.0.0 default 127.0.0.1 Router E D B B loopback Interface lan0 lan0 lan0 lan0 loo 80 TCP/IP Tutorial and Technical Overview ... - tailieumienphi.vn
nguon tai.lieu . vn