The etcprotocols File

Data from the network arrive at the computer as one stream. The stream may contain data packets from multiple sources bound for multiple applications. In telecommunications terminology, we say that the data stream is multiplexed. To deliver each packet to the correct application, it must be demultiplexed. The first step in this process is for the Internet Protocol to pass the packet to the correct transport protocol. IP determines the correct protocol by means of the protocol number that is contained in the datagram packet header.

The /etc/protocols file identifies the protocol number of each transport protocol. Listing 3.1 is an excerpt from the protocols file from a Red Hat system.

Listing 3.1: An Excerpt of the /etc/protocols File

$ head -33 /etc/protocols

# /etc/protocols:

# $Id: protocols,v 1.3 2001/07/07 07:07:15 nalin Exp $

# Internet (IP) protocols

# Updated for NetBSD based on RFC 1340, Assigned Numbers (July 1992).

# See also http://www.iana.org/assignments/protocol-numbers

ip

0

IP

#

internet protocol, pseudo protocol

number

#hopopt

0

HOPOPT

#

hop-by-hop options for ipv6

icmp

1

ICMP

#

internet control message protocol

igmp

2

IGMP

#

internet group management protocol

ggp

3

GGP

#

gateway-gateway protocol

ipencap

4

IP-ENCAP

#

IP encapsulated in IP (officially "

IP")

st

5

ST

#

ST datagram mode

tcp

6

TCP

#

transmission control protocol

cbt

7

CBT

#

CBT, Tony Ballardie

<[email protected]>

egp

8

EGP

#

exterior gateway protocol

igp

9

IGP

#

any private interior gateway (Cisco

: for

IGRP)

bbn-rcc

10

BBN-RCC-MON

#

BBN RCC Monitoring

nvp

11

NVP-II

#

Network Voice Protocol

pup

12

PUP

#

PARC universal packet protocol

argus

13

ARGUS

#

ARGUS

emcon

14

EMCON

#

EMCON

xnet

15

XNET

#

Cross Net Debugger

chaos

16

CHAOS

#

Chaos

udp

17

UDP

#

user datagram protocol

mux

18

MUX

#

Multiplexing protocol

dcn

19

DCN-MEAS

#

DCN Measurement Subsystems

hmp

20

HMP

#

host monitoring protocol

/etc/protocols is a simple text file. Lines that begin with a sharp sign (#) are comments. Active entries begin with the protocol name, followed by the protocol number, and optionally by alternate names for the protocol and by a descriptive comment. The comment is often helpful for identifying the protocol. Frequently, the alternate name of a protocol is simply the standard name in uppercase letters, but this is not always the case. Look at protocol numbers 4, 10, 11, and 19. These alternate names are more than just a change of case. However, protocol names are not as important as protocol numbers. The protocol number is contained in the header of the datagram, and it is the number that is used for data delivery.

Other than cosmetic differences, the protocols file on your Linux system, regardless of the distribution, will look similar to the excerpt shown in Listing 3.1. In fact, you can find a similar file on any Unix or Windows NT system because the protocol numbers are standardized. You will never need to edit this file.

The /etc/protocols file on a Red Hat 7.2 system contains about 150 lines. Despite the size of this file, only two entries are significant for most network services. One, tcp, defines the protocol number for Transmission Control Protocol—the TCP in TCP/IP. Its protocol number is 6. The other, udp, defines the protocol number for User Datagram Protocol as 17. Several of the entries in this file define protocol numbers used by routing protocols. Many other entries define experimental protocols that are not widely used. TCP and UDP carry most of the information you are interested in.

Was this article helpful?

0 0

Post a comment