• Aucun résultat trouvé

User Datagram Protocol

Dans le document Setting Up LAMP: (Page 132-135)

The UDP protocol does not require a connection with another host in order to send its data.

Instead, UDP will send its packet of information with the correct address attached to it and hope that it is received by the proper computer. After the packet is received on the other end, the server will perform the requested operation or procedure and then place the return infor-mation in another packet to send back to the original host.

There is also an optional feature of UDP that we touched on in Chapter 2, “Installing Linux”:

the ability to run a checksum. This means that all of the checksum information must be stored within that one packet but on the same note, it gives that single packet the ability to know if it is correct or not.

The disadvantage of UDP is a large packet size and the fact that UDP was not built with packet loss in mind. Because UDP will not handle resending a packet, the originator of the request must resend the original packet and have the server reprocess the request for the return packet. As you can imagine, not too many programs are able to fit their information into a single packet and so the use of UDP is limited. Many applications and programs will use the speed benefit over TCP to their advantage, however; online games and most stream-ing multimedia are excellent examples of such applications.

Ports

Ports are like different radio frequencies on a single radio. If your radio had the capability to monitor every frequency at the same time with a different daemon or process, each separate

111

Using TCP/IP

frequency would be considered a port. Ports, however, are not measured by the frequency of a radio wave but are instead numbered from 0–65,000. You might already know that the default port for connecting to a web server is port 80 or that FTP’s default port is 21. You will see ports expressed many times as the IP address followed by a colon and then the port num-ber. For instance, if you have a router that enables you to SSH into it, it might come with an SSH daemon that listens on port 1100. To SSH into that router, you would use a command similar to the following:

ssh 192.168.1.2:1100

Ports are split into two groups. Anything numbered under 1024 is considered a privileged port, and its configuration cannot be changed by anyone but the system administrator. Ports 1024 and above are open for any users to access and use as they see fit. File-sharing programs, Internet Relay Chat (IRC), and other programs can be set up to use these ports.

The reason for having privileged ports is security. If any user were able to access any port, they would be able to view all the information passed through that port. If this information is in clear text and not encrypted, as on most mail servers, then sensitive information could fall into the wrong hands. Because ports below 1024 can be administered only by the root user, they also are labeled as trusted ports. If you were to access a web server or FTP server running on a port number above 1024, you could not be sure that the system administrator would even be aware of these services being run. Any user on the system could have started these services unless their access had otherwise been restricted.

Addressing

As we discussed earlier in this section, IP networking uses IP addresses. IP addresses are com-posed of four hexadecimal couplets, which are usually converted to decimal form for ease of use. Each set is separated by periods and contains a value from 0 to 255. This is sometimes referred to as dotted quad notation.

Each machine on your network must have an IP address for your network if it wishes to use TCP/IP. You must also have one or more IP addresses that represent you on the Internet as well. There are predefined ranges reserved for private networks to use depending on the type of naming scheme they are using. The naming scheme used is dependent on the size of the net-work and the number of subnets and hosts that are required. Each of the addresses within the proper range is then routed on the Internet. The ranges are as follows:

Class A 10.0.0.0 through 10.255.255.255 Class B 172.16.0.0 through 172.31.255.255 Class C 192.168.0.0 through 192.168.255.255

4337Book.fm Page 111 Saturday, June 19, 2004 5:24 PM

112

Chapter 5 • Network Connectivity

NOTE Each of these ranges contains multiple subnets within the given network. For instance, in the Class B range 172.16.1.0, 172.16.2.0 and 172.16.3.0 are all subnets within the net-work. All 0s in the host portion of an address specifies the entire netnet-work.

When you apply to your Internet Service Provider (ISP) for IP addresses, you will be given a few IP addresses (depending on how large your network is) to assign to your network. You can then set up your network so that each computer will have its own outside IP address. Alter-nately, you could assign a single outside IP address to a set of computers by using a router. The router will then forward the packets to the appropriate destination within your network.

Each class type allows for a certain number of subnets and a certain number of hosts on each subnet:

Class A Class A uses the first couplet to specify the network address. The next three couplets are available for you to divide into subnets and hosts as you see fit.

Class B In a Class B network, the first two couplets are used to specify the network while the third and fourth are available for local subnets and hosts.

Class C Finally, Class C uses the first three couplets to determine the network address, with the last being used for subnets and hosts. This last octet can be broken down even further by segmenting the 254 available hosts into their own subnets.

Class A, the rarest of the classes, will allow for 128 networks of about 1.6 million hosts per network. Class B will allow 16,320 networks to each contain 65,024 hosts, and Class C will allow for 2 million networks to have 254 hosts each.

There are also two other classes, which are reserved for special purposes: classes D and E, which fall into a range of 224.0.0.0 through 255.255.255.255. IP multicasting, which allows for packets to be sent to multiple hosts at the same time, uses these addresses. If you were to perform the math on each of the network to host numbers in the examples, you would find that only 254 numbers per octet are used to calculate the final numbers. This is because a value of 0 in an octet would refer to that particular network, and a value of 255 would refer to all hosts on that network.

NOTE An address that specifies all hosts on a network is called the broadcast address.

For instance, if you were running a Class B network, 149.74.0.0 would specify the network, and 149.74.255.255 would specify all hosts on that network.

As we mentioned before, it is also possible to subnet a Class C network. To do this, you divide your 254 addresses into subnets by using a subnet mask. A subnet mask is used to define what subnet a host belongs to. For instance, if you were to use a submask of 255.255.255.240, you

113

Dans le document Setting Up LAMP: (Page 132-135)