1. Trang chủ
  2. » Công Nghệ Thông Tin

Practical TCP/IP and Ethernet Networking- P21 pot

5 176 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 216,42 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Figure 6.3 IPv4 address range vs class Note that there are two reserved host numbers, irrespective of class.. To summarize: • HostID = ‘all zeros’ means ‘this network.’ • HostID = ‘all

Trang 1

The NetID should normally not be all 0s as this indicates a local network With this in mind, analyze the first octet (‘w’)

For class A, the first bit is fixed at 0 The binary values for ‘w’ can therefore only vary between 000000002 (010) and 011111112 (12710) 0 is not allowed However, 127 is also a reserved number, with 127.x.y.z reserved for loop-back testing In particular, 127.0.0.1 is used to test that the TCP/IP protocol is properly configured by sending information in a loop back to the computer that originally sent the packet, without it traveling over the network The values for ‘w’ can therefore only vary between 1 and 126, which allows for

126 possible class A NetIDs

For class B, the first two bits are fixed at 10 The binary values for ‘w’ can therefore only vary between 100000002 (12810) and 101111112 (19110)

For class C, the first three bits are fixed at 110 The binary values for ‘w’ can therefore only vary between 110000002 (19210) and 110111112 (22310)

The relationship between ‘w’ and the address class can therefore be summarized as follows

Figure 6.3

IPv4 address range vs class

Note that there are two reserved host numbers, irrespective of class These are ‘all zeros’

or ‘all ones’ for HostID An IP address with a host number of zero is used as the address

of the whole network For example, on a class C network with the NetID = 200.100.100, the IP address 200.100.100.0 indicates the whole network If all the bits of the HostID are set to 1, for example 200.100.100.255, then a broadcast message will be sent to every host on that network

To summarize:

• HostID = ‘all zeros’ means ‘this network.’

• HostID = ‘all ones’ means ‘all hosts on this network’

For class A, the number of NetIDs is determined by octet ‘w’ Unfortunately, the first bit (fixed at 0) is used to indicate class A and hence cannot be used This leaves seven usable bits Seven bits allow 27 = 128 combinations, from 0 to 127 0 and 127 are reserved; hence only 126 NetIDs are possible The number of HostIDs, on the other hand, is determined by octets ‘x’, ‘y’ and ‘z’ From these 24 bits, 224 = 16 777 218 combinations are available All zeros and all ones are not permissible, which leaves

16 777 216 usable combinations

For class B, the number of NetIDs is determined by octets ‘w’ and ‘x’ The first bits (10) are used to indicate class B and hence cannot be used This leaves fourteen usable bits Fourteen bits allow 214 = 16 384 combinations The number of HostIDs is determined by octets ‘y’ and ‘z’ From these 16 bits, 216 = 65 536 combinations are available All zeros and all ones are not permissible, which leaves 65 534 usable combinations

Trang 2

/TZKXTKZRG_KXVXUZUIURY For class C, the number of NetIDs is determined by octets ‘w’, ‘x’ and ‘y’ The first three bits (110) are used to indicate class C and hence cannot be used This leaves twenty-two usable bits Twenty-twenty-two bits allow 222 = 2 097 152 combinations The number of HostIDs is determined by octet ‘z’ From these 8 bits, 28 = 256 combinations are available Once again, all zeros and all ones are not permissible which leaves 254 usable combinations

Figure 6.4

Hosts and subnets per class

Strictly speaking, one should be referring to ‘netmasks’ in general, or to ‘subnet masks’

in the case of defining netmasks for the purposes of subnetting Unfortunately, most people (including Microsoft) have confused the two issues and are referring to subnet masks in all cases

For routing purposes it is necessary for a device to strip the HostID off an IP address, in order to ascertain whether or not the remaining NetID portion of the IP address matches the network address of that particular network

Whilst it is easy for human beings, it is not the case for a computer and the latter has to

be ‘shown’ which portion is NetID, and which is HostID This is done by defining a netmask in which a ‘1’ is entered for each bit which is part of NetID, and a ‘0’ for each bit which is part of HostID The computer takes care of the rest The ‘1’s start from the left and run in a contiguous block

For example: A conventional class C IP address, 192.100.100.5, written in binary, would be represented in binary as 11000000 01100100 01100100 00000101 Since it is a class C address, the first 24 bits represent NetID and would therefore be masked by 1s The subnet mask would therefore be:

11111111 11111111 1111111 00000000

To summarize:

• IP address: 01100100 01100100 01100100 00000101

• Subnet mask: 11111111 11111111 11111111 00000000 |< NetID >| |< HostID>|

The mask, written in decimal dotted notation, becomes 255.255.255.0 This is the so-called default netmask for class C Default netmasks for classes A and B can be configured in the same manner

Figure 6.5

Default netmasks

Trang 3

Currently IP addresses are issued classless, which means that it is not possible to determine the boundary between NetID and HostID by analyzing the IP address itself This makes the use of a Subnet Mask even more necessary

Although it is theoretically possible, one would never place all the hosts (for example, all

65 534 hosts on a class B address) on a single segment – the sheer volume of traffic would render the network useless For this reason one might have to revert to subnetting Assume that a class C address of 192.100.100.0 has been allocated to a network As shown earlier, a total of 254 hosts are possible Now assume further that the company has four networks, connected by a router (or routers)

Figure 6.6

Before subnetting

Creating subnetworks under the 192.100.100.0 network address and assigning a different subnetwork number to each LAN segment could solve the problem

To create a subnetwork, ‘steal’ some of the bits assigned to the HostID and use them for a subnetwork number, leaving fewer bits for HostID Instead of NetID + HostID, the

IP address will now represent NetID + SubnetID + HostID To calculate the number of bits to be reassigned to the SubnetID, choose a number of bits ‘n’ so that (2n)–2 is bigger than or equal to the number of subnets required This is because two of the possible bit combinations of the new SubnetID, namely all 0s and all 1s, are not recommended In this case, 4 subnets are required so 3 bits have to be ‘stolen’ from the HostID since (23)–2

= 6, which is sufficient in view of the 4 subnets we require

Since only 5 bits are now available for HostID (3 of the 8 ‘stolen’), each subnetwork can now only have 30 HostIDs numbered 00001 (110) through 11110 (3010), since neither

00000 nor 11111 is allowed To be technically correct, each subnetwork will only have

29 computers (not 30) since one HostID will be allocated to the router on that subnetwork

The ‘z’ of the IP address is calculated by concatenating the SubnetID and the HostID For example, for HostID = 1 (00001) on SubnetID = 3 (011), z would be 011 appended to

00001 which gives 01100001 in binary or, 97

Trang 4

Figure 6.7

IPv4 address allocation – 6 subnets on class C address

Note that the total available number of HostIDs have dropped from 254 to 180

In the preceding example, the first 3 bits of the HostID have been allocated as SubnetID, and have therefore effectively become part of the NetID A default class C subnet mask would unfortunately obliterate these 3 bits, with the result that the routers would not be able to route messages between the subnets For this reason the subnet mask has to be EXTENDED another 3 bits to the right, so that it becomes 11111111

11111111 11111111 11100000 The extra bits have been typed in italics, for clarity The

subnet mask is now 255.255.255.224

Figure 6.8

After subnetting

Trang 5

If it is certain that a network will never be connected to the Internet, any IP address can

be used as long as the IP addressing rules are followed To keep things simple, it is advisable to use class C addresses Assign each LAN segment its own class C network number Then it is possible to assign each host a complete IP address simply by appending the decimal host number to the decimal network number With a unique class

C network number for each LAN segment, there can be 254 hosts per segment

If there is a possibility of connecting a network to the Internet, one should not use IP addresses that might result in address conflicts In order to prevent such conflicts, either ask an ISP for Internet-unique IP addresses, or use IP addresses reserved for private works The first method is the preferred one since none of the IP addresses will be used anywhere else on the Internet The ISP may charge a fee for this privilege

The second method of preventing IP address conflicts on the Internet is using addresses reserved for private networks The IANA has reserved several blocks of IP addresses for this purpose as shown below:

Figure 6.9

Reserved IP addresses

Hosts on the Internet are not supposed to be assigned reserved IP addresses Thus, if the network is eventually connected to the Internet, even if traffic from one of the hosts

on the network somehow gets to the Internet, there should be no address conflicts Furthermore, reserved IP addresses are not routed on the Internet because Internet routers are programmed not to forward messages sent to or from reserved IP addresses

The disadvantage of using IP addresses reserved for private networks is that when a network does eventually get connected to the Internet, all the hosts on that network will need to be reconfigured Each host will need to be reconfigured with an Internet-unique

IP address, or one will have to configure the connecting gateway as a proxy to translate the reserved IP addresses into Internet-unique IP addresses that have been assigned by an ISP For more information about IP addresses reserved for private networks, refer to RFC 1918

Initially, the IPv4 Internet addresses were only assigned in classes A, B and C This approach turned out to be extremely wasteful, as large amounts of allocated addresses were not being used Not only was the class D and E address space underutilized, but a company with 500 employees that was assigned a class B address would have 65,034 addresses that no-one else could use

Presently, IPv4 addresses are considered classless The issuing authorities simply hand down a block of contiguous addresses to ISPs, who can then issue them one by one, or break the large block up into smaller blocks for distribution to sub-ISPs, who will then repeat the process Because of the fact that the 32 bit IPv4 addresses are no longer considered ‘classful’, the traditional distinction between class A, B and C addresses and the implied boundaries between the NetID and HostID can be ignored Instead, whenever

Ngày đăng: 04/07/2014, 08:21

TỪ KHÓA LIÊN QUAN