본문 바로가기

Programming Language/C&C++

소켓 통신 #3 - ICMP 클라이언트 구현하기(1)

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

소켓 통신 #3 - ICMP 클라이언트 구현하기(1)

- by Tapito


ICMP 패킷 헤더

 이번에는 좀 더 저수준으로 소켓을 다뤄보겠습니다. ICMP(Internet Control Message Protocol)는 ping 명령에서 사용되는 프로토콜로 목적지와의 통신이 원활한지를 확인하는데 사용됩니다. 저수준이니만큼 패킷의 구조도 직접 작성해야 하는데요, 목적지로 ping을 보내서 되돌아오기까지의 과정에서 주고받는 데이터를 에코(echo)라 합니다. 에코를 보내고 받을 때 전달되는 ICMP 구조체는 아래와 같이 선언하기로 약속(RFC 792 규격)되었습니다.

/* ICMP 헤더 구조체의 예 */
typedef struct _tagICMPHDR
{
	BYTE bType; // Type
	BYTE bCode; // Code
	WORD wChecksum; // Checksum
	WORD wIdentification; // Identification
	WORD wSequence; // Sequence
} ICMPHDR, NEAR * PICMPHDR, FAR * LPICMPHDR;

 Type과 Code 항목은 현재 주고받는 패킷의 종류를 지정합니다. 보통 보낼 때는 8-0번, 받을 때는 0-0번을 많이 씁니다. 그 외 다른 값은 서버가 아닌 라우터가 응답하는 패킷이며 의미는 아래와 같습니다.

Type 이름 및 설명 참조
0 echo reply: ping을 요청하여 되돌아가는 응답 패킷입니다. RFC 792
1 unassigned: 이 범위의 Type은 아직 정의되지 않았습니다. JBP
2 unassigned: 이 범위의 Type은 아직 정의되지 않았습니다. JBP
3 destination unreachable: 목적지까지 도달할 수 없습니다. 이에 대한 내용은 Code로 세분화됩니다.
  • 0: network unreachable (서버가 속한 네트워크가 이 패킷을 거부합니다.)
  • 1: host unreachable (서버가 이 패킷을 거부합니다.)
  • 2: protocol unreachable (서버가 지정된 프로토콜로는 패킷을 거부합니다.)
  • 3: port unreachable (서버가 지정된 포트로는 패킷을 거부합니다.)
    4: fragmentation needed and don't fragment was set (전송할 데이터를 몇 개의 패킷으로 쪼개어 보내야 하는데 don't fragment 속성이 지정되어 단편화 할 수 없습니다.
  • 5: source route failed (라우팅 실패)
  • 6: destination network unknown (목적지에 있는 네트워크를 알 수 없습니다.)
  • 7: destination host unknown (목적지를 알 수 없습니다.)
  • 8: source-host isolated (발신지와 수신지가 물리적으로 분리되어있습니다.)
  • 9: communication with destination network is administratively prohibited (목적지가 속해있는 네트워크와 통신하는 것이 금지되어 있습니다.)
  • 10: communication with destination host is administratively prohibited (목적지와 통신하는 것이 금지되었습니다.)
  • 11: destination network unreachable for Type Of Service (지정된 TOS로는 목적지가 속한 네트워크가 패킷을 거부합니다.)
  • 12: destination host unreachable for Type Of Service (지정된 TOS로는 서버가 패킷을 거부합니다.)
  • 13: communication administratively prohibited (이 통신망으로 통신하는 것이 금지되었습니다. - RFC 1812)
  • 14: host precedence violation (서버측에서 우선순위 관련해 패킷을 처리하는 중 충돌이 발생했습니다. - RFC 1812)
  • 15: precedence cutoff in effect (우선순위 상 이 패킷이 배제되었습니다. - RFC 1812)
RFC 792
4 source quench: 목적지까지 가는 중 어느 라우터에 데이터가 폭주하여 패킷이 반송됨 (비표준 메시지) RFC 792
5 redirect: 패킷 데이터그램의 재지정 아래의 Code 값으로 의미가 세분화됩니다.
  • 0: redirect datagram for the network or subnet
  • 1: redirect datagram for the host
  • 2: redirect datagram for the Type Of Service of network
  • 3: redirect datagram for the Type Of Service and host
RFC 792
6 alternate host address: 서버 주소가 변경되었습니다. Code값은 항상 0입니다. JBP
7 unassigned: 아직 배정되지 않았습니다. JBP
8 echo: 클라이언트가 서버측으로 PING 응답을 요청합니다. Code는 항상 0입니다. RFC 792
9 router advertisement RFC 1256
10 router selection RFC 1256
11 time exceeded: 시간제한 초과입니다. 아래 Code로 의미가 세분화됩니다.
  • 0: TTL 초과입니다.
  • 1: 단편화된 패킷을 재조합하는데 시간이 초과되었습니다.
RFC 792

12

parameter problem: 아래 Code 값으로 의미가 세분화됩니다.
  • 0: pointer indicates the error
  • 1: missing a required option - RFC 1108
  • 2: bad length
RFC 792

13

time stamp RFC 792

14

time stamp reply RFC 792

15

information request RFC 792

16

information reply RFC 792

17

address mask request RFC 792

18

address mask reply RFC 792

19~29

19번은 보안 목적, 나머지는 Robustness 시험을 위해 예약 RFC 792
30 traceroute: 라우팅되는 경로를 추적합니다. RFC 792
31 datagram conversion error RFC 792
32 Mobile Host Redirect
33 IPv6 Where-Are-You
34 IPv6 I-Am-Here
35 Mobile Registration Request
36 Mobile Registration Reply
37 SKIP
38 Photuris

 다양한 예외 상황들이 정의되어 있지만 우선은 에코를 보낼 때는 Type=8, Code=0이 되고 에코를 받을 때는 Type=0, Code=0이 된다는 것만 알면 됩니다. 다음으로 알아야 할 사항이 체크섬(checksum)입니다. 수신된 패킷에 오류가 있는지 없는지를 검사하는 수단인데 소켓 통신용 체크섬을 구하는 방법은 다음과 같습니다.

 1. 헤더를 포함하여 전송할 패킷의 총 크기가 짝수 바이트이면 2바이트씩 나누어 그 합을 구합니다. 이 합을 4바이트 정수라 할 때 하위 2바이트에 상위 2바이트를 다시 더합니다. 같은 작업을 한번 더 수행합니다.

 2. 패킷의 총 크기가 홀수 바이트면 2바이트씩 나누어 그 합을 구한 다음 남은 1바이트를 또 더합니다. 이 합을 4바이트 정수라 할 때 하위 2바이트에 상위 2바이트를 다시 더합니다. 같은 작업을 한번 더 수행합니다.

 이 과정을 코드로 작성하면

/* GetChecksum: 바이너리의 체크섬을 구합니다. */
WORD GetChecksumWord(LPBYTE lpByte, SIZE_T nByte)
{
	SIZE_T tByte;
	DWORD dwTemp = 0;
	WORD wReturn;

	switch (nByte % 2)
	{
	case 0: // 짝수 바이트면
		for (tByte = 0; tByte < nByte; tByte += 2)
		{
			dwTemp += MAKEWORD(lpByte[tByte], lpByte[tByte + 1]);
		}
		dwTemp = LOWORD(dwTemp) + HIWORD(dwTemp);
		dwTemp = LOWORD(dwTemp) + HIWORD(dwTemp);
		wReturn = (WORD)((~dwTemp) & 0xFFFF);
		break;
	case 1: // 홀수 바이트면
		for (tByte = 0; tByte < nByte - 1; tByte += 2)
		{
			dwTemp += MAKEWORD(lpByte[tByte], lpByte[tByte + 1]);
		}
		dwTemp = lpByte[nByte - 1];
		dwTemp = LOWORD(dwTemp) + HIWORD(dwTemp);
		dwTemp = LOWORD(dwTemp) + HIWORD(dwTemp);
		wReturn = (WORD)((~dwTemp) & 0xFFFF);
		break;
	default:
		wReturn = 0;
	}

	return wReturn;
}

IP 패킷 헤더

 원래 송신지와 수신지 사이에서 ping이 오갈때는 ICMP 헤더 앞에 IP 헤더가 붙습니다. 에코를 받을 때는 저수준 소켓으로 IP 헤더를 읽을 수 있지만, 에코를 보낼 때는 기본적으로 소켓에서 알아서 IP헤더를 구성합니다. 이 IP 헤더의 내용까지 직접 구성하려면 복잡한 절차가 필요한데 이는 조금 미뤄둡니다. IP 헤더의 주소는 아래와 같습니다.

/* IPv4 Header -- RFC 791 */
/* IPv4 헤더 (옵션 없는 버전): 20바이트 */
typedef struct _tagIPHDR4
{
	BYTE bVersionIHL; // Version and IHL
	BYTE bTypeOfService; // Type Of Service
	WORD wLength; // Total Packet Length
	WORD wIdentification; // Fragment Identification
	WORD wFlagOffset; // Flags and Fragment Offset
	BYTE bTimeToLive; // Time To Live
	BYTE bProtocol; // Protocol
	WORD wChecksum;		// Checksum
	struct in_addr addressSource; // Internet Address - Source
	struct in_addr addressDestination; // Internet Address - Destination
} IPHDR4, NEAR * PIPHDR4, FAR * LPIPHDR4
/* IPv4 헤더 (옵션 있는 버전) */
typedef struct _tagIPHDR4
{
	BYTE bVersionIHL; // Version and IHL
	BYTE bTypeOfService; // Type Of Service
	WORD wLength; // Total Packet Length
	WORD wIdentification; // Fragment Identification
	WORD wFlagOffset; // Flags and Fragment Offset
	BYTE bTimeToLive; // Time To Live
	BYTE bProtocol; // Protocol
	WORD wChecksum;		// Checksum
	struct in_addr addressSource; // Internet Address - Source
	struct in_addr addressDestination; // Internet Address - Destination
	DWORD dwOptionPadding; // IP Header Options and Padding
	BYTE lpOptionData[1]; // Option Data (크기 가변)
} IPHDR4, NEAR * PIPHDR4, FAR * LPIPHDR4

 Version과 IHL(Internet Header Length): 1 바이트 크기를 가지며 상위 1니블은 버전, 하위 1니블은 이 IP 헤더 길이의 상대값입니다. IPv4에서 버전 니블은 항상 4입니다. 두 니블의 곱이 IP 헤더의 크기를 나타냅니다. 예를 들어 Version = 4이고 IHL = 5이면 이 IP 헤더의 크기는 4 * 5 = 20이며 Version = 4, IHL = 15이면 이 IP 헤더의 크기는 4 * 15 = 60바이트입니다. IHL은 5 이상 15이하의 값이어야 하며 위의 구조체를 모두 구현한 풀 버전의 헤더를 구성하고 싶다면 IHL 값은 15여야 합니다.

 Type Of Service(ToS): 라우터의 패킷 처리 우선순위와 관련된 값입니다. 현재 사용되는 네트워크에서는 이 값을 무시합니다.

 Total Packet Length: IP 헤더를 포함하여 이후 딸려나오는 모든 데이터의 크기입니다.

 Fragment Identification: 데이터가 여러개의 패킷으로 분할되어 전송될 때 동일한 데이터의 일부분이라면 그 패킷들의 ID 값은 서로 같습니다.

 Flags and Frament Offset: 상위 3비트는 Flag 항목으로 분할의 특성입니다. 첫 번째 비트는 항상 0, 두 번때 비트는 0으로 설정되면 라우터가 임의로 분할 가능, 1로 설정되면 목적지 컴퓨터가 데이터조각들을 다시 이어 붙일 수 없으므로 라우터로 하여금 패킷을 나누지 말 것을 지정합니다. 세 번째 비트는 이 패킷이 데이터 조각들의 마지막으로서 더 이상 수신될 것이 없다면 0, 이후로 계속 수신해야 한다면 1입니다.
나머지 비트는 오프셋입니다. 온전한 데이터의 바이너리가 0부터 시작하는 오프셋이라 가정할 때 이 패킷은 어느 오프셋부터 시작되는 부분인지를 지정합니다.

 Time To Live: 최초 송신 시 0xFF로 전송되어 라우터를 지날때마다 1씩 깎이는 값입니다. 0에 도달하면 이 패킷은 길을 잃은 것으로 간주, 네트워크 상에서 소멸됩니다.

 Protocol Identifier: 이 패킷이 어떤 프로토콜로 교환되는 데이터인지를 나타냅니다. 구체적인 값은 아래 표와 같습니다.

Decimal Keyword Protocol IPv6 Extension Header Reference
0 HOPOPT IPv6 Hop-by-Hop Option Y [RFC2460]
1 ICMP Internet Control Message [RFC792]
2 IGMP Internet Group Management [RFC1112]
3 GGP Gateway-to-Gateway [RFC823]
4 IPv4 IPv4 encapsulation [RFC2003]
5 ST Stream [RFC1190][RFC1819]
6 TCP Transmission Control [RFC793]
7 CBT CBT [Tony_Ballardie]
8 EGP Exterior Gateway Protocol [RFC888][David_Mills]
9 IGP any private interior gateway (used by Cisco for their IGRP) [Internet_Assigned_Numbers_Authority]
10 BBN-RCC-MON BBN RCC Monitoring [Steve_Chipman]
11 NVP-II Network Voice Protocol [RFC741][Steve_Casner]
12 PUP PUP [Boggs, D., J. Shoch, E. Taft, and R. Metcalfe, "PUP: An Internetwork Architecture", XEROX Palo Alto Research Center, CSL-79-10, July 1979; also in IEEE Transactions on Communication, Volume COM-28, Number 4, April 1980.][[XEROX]]
13 ARGUS ARGUS [Robert_W_Scheifler]
14 EMCON EMCON [<mystery contact>]
15 XNET Cross Net Debugger [Haverty, J., "XNET Formats for Internet Protocol Version 4", IEN 158, October 1980.][Jack_Haverty]
16 CHAOS Chaos [J_Noel_Chiappa]
17 UDP User Datagram [RFC768][Jon_Postel]
18 MUX Multiplexing [Cohen, D. and J. Postel, "Multiplexing Protocol", IEN 90, USC/Information Sciences Institute, May 1979.][Jon_Postel]
19 DCN-MEAS DCN Measurement Subsystems [David_Mills]
20 HMP Host Monitoring [RFC869][Bob_Hinden]
21 PRM Packet Radio Measurement [Zaw_Sing_Su]
22 XNS-IDP XEROX NS IDP ["The Ethernet, A Local Area Network: Data Link Layer and Physical Layer Specification", AA-K759B-TK, Digital Equipment Corporation, Maynard, MA. Also as: "The Ethernet - A Local Area Network", Version 1.0, Digital Equipment Corporation, Intel Corporation, Xerox Corporation, September 1980. And: "The Ethernet, A Local Area Network: Data Link Layer and Physical Layer Specifications", Digital, Intel and Xerox, November 1982. And: XEROX, "The Ethernet, A Local Area Network: Data Link Layer and Physical Layer Specification", X3T51/80-50, Xerox Corporation, Stamford, CT., October 1980.][[XEROX]]
23 TRUNK-1 Trunk-1 [Barry_Boehm]
24 TRUNK-2 Trunk-2 [Barry_Boehm]
25 LEAF-1 Leaf-1 [Barry_Boehm]
26 LEAF-2 Leaf-2 [Barry_Boehm]
27 RDP Reliable Data Protocol [RFC908][Bob_Hinden]
28 IRTP Internet Reliable Transaction [RFC938][Trudy_Miller]
29 ISO-TP4 ISO Transport Protocol Class 4 [RFC905][<mystery contact>]
30 NETBLT Bulk Data Transfer Protocol [RFC969][David_Clark]
31 MFE-NSP MFE Network Services Protocol [Shuttleworth, B., "A Documentary of MFENet, a National Computer Network", UCRL-52317, Lawrence Livermore Labs, Livermore, California, June 1977.][Barry_Howard]
32 MERIT-INP MERIT Internodal Protocol [Hans_Werner_Braun]
33 DCCP Datagram Congestion Control Protocol [RFC4340]
34 3PC Third Party Connect Protocol [Stuart_A_Friedberg]
35 IDPR Inter-Domain Policy Routing Protocol [Martha_Steenstrup]
36 XTP XTP [Greg_Chesson]
37 DDP Datagram Delivery Protocol [Wesley_Craig]
38 IDPR-CMTP IDPR Control Message Transport Proto [Martha_Steenstrup]
39 TP++ TP++ Transport Protocol [Dirk_Fromhein]
40 IL IL Transport Protocol [Dave_Presotto]
41 IPv6 IPv6 encapsulation [RFC2473]
42 SDRP Source Demand Routing Protocol [Deborah_Estrin]
43 IPv6-Route Routing Header for IPv6 Y [Steve_Deering]
44 IPv6-Frag Fragment Header for IPv6 Y [Steve_Deering]
45 IDRP Inter-Domain Routing Protocol [Sue_Hares]
46 RSVP Reservation Protocol [RFC2205][RFC3209][Bob_Braden]
47 GRE Generic Routing Encapsulation [RFC2784][Tony_Li]
48 DSR Dynamic Source Routing Protocol [RFC4728]
49 BNA BNA [Gary Salamon]
50 ESP Encap Security Payload Y [RFC4303]
51 AH Authentication Header Y [RFC4302]
52 I-NLSP Integrated Net Layer Security TUBA [K_Robert_Glenn]
53 SWIPE IP with Encryption [John_Ioannidis]
54 NARP NBMA Address Resolution Protocol [RFC1735]
55 MOBILE IP Mobility [Charlie_Perkins]
56 TLSP Transport Layer Security Protocol using Kryptonet key management [Christer_Oberg]
57 SKIP SKIP [Tom_Markson]
58 IPv6-ICMP ICMP for IPv6 [RFC2460]
59 IPv6-NoNxt No Next Header for IPv6 [RFC2460]
60 IPv6-Opts Destination Options for IPv6 Y [RFC2460]
61 any host internal protocol [Internet_Assigned_Numbers_Authority]
62 CFTP CFTP [Forsdick, H., "CFTP", Network Message, Bolt Beranek and Newman, January 1982.][Harry_Forsdick]
63 any local network [Internet_Assigned_Numbers_Authority]
64 SAT-EXPAK SATNET and Backroom EXPAK [Steven_Blumenthal]
65 KRYPTOLAN Kryptolan [Paul Liu]
66 RVD MIT Remote Virtual Disk Protocol [Michael_Greenwald]
67 IPPC Internet Pluribus Packet Core [Steven_Blumenthal]
68 any distributed file system [Internet_Assigned_Numbers_Authority]
69 SAT-MON SATNET Monitoring [Steven_Blumenthal]
70 VISA VISA Protocol [Gene_Tsudik]
71 IPCV Internet Packet Core Utility [Steven_Blumenthal]
72 CPNX Computer Protocol Network Executive [David Mittnacht]
73 CPHB Computer Protocol Heart Beat [David Mittnacht]
74 WSN Wang Span Network [Victor Dafoulas]
75 PVP Packet Video Protocol [Steve_Casner]
76 BR-SAT-MON Backroom SATNET Monitoring [Steven_Blumenthal]
77 SUN-ND SUN ND PROTOCOL-Temporary [William_Melohn]
78 WB-MON WIDEBAND Monitoring [Steven_Blumenthal]
79 WB-EXPAK WIDEBAND EXPAK [Steven_Blumenthal]
80 ISO-IP ISO Internet Protocol [Marshall_T_Rose]
81 VMTP VMTP [Dave_Cheriton]
82 SECURE-VMTP SECURE-VMTP [Dave_Cheriton]
83 VINES VINES [Brian Horn]
84 TTP Transaction Transport Protocol [Jim_Stevens]
84 IPTM Internet Protocol Traffic Manager [Jim_Stevens]
85 NSFNET-IGP NSFNET-IGP [Hans_Werner_Braun]
86 DGP Dissimilar Gateway Protocol [M/A-COM Government Systems, "Dissimilar Gateway Protocol Specification, Draft Version", Contract no. CS901145, November 16, 1987.][Mike_Little]
87 TCF TCF [Guillermo_A_Loyola]
88 EIGRP EIGRP [Cisco Systems, "Gateway Server Reference Manual", Manual Revision B, January 10, 1988.][Guenther_Schreiner]
89 OSPFIGP OSPFIGP [RFC1583][RFC2328][RFC5340][John_Moy]
90 Sprite-RPC Sprite RPC Protocol [Welch, B., "The Sprite Remote Procedure Call System", Technical Report, UCB/Computer Science Dept., 86/302, University of California at Berkeley, June 1986.][Bruce Willins]
91 LARP Locus Address Resolution Protocol [Brian Horn]
92 MTP Multicast Transport Protocol [Susie_Armstrong]
93 AX.25 AX.25 Frames [Brian_Kantor]
94 IPIP IP-within-IP Encapsulation Protocol [John_Ioannidis]
95 MICP Mobile Internetworking Control Pro. [John_Ioannidis]
96 SCC-SP Semaphore Communications Sec. Pro. [Howard_Hart]
97 ETHERIP Ethernet-within-IP Encapsulation [RFC3378]
98 ENCAP Encapsulation Header [RFC1241][Robert_Woodburn]
99 any private encryption scheme [Internet_Assigned_Numbers_Authority]
100 GMTP GMTP [[RXB5]]
101 IFMP Ipsilon Flow Management Protocol [Bob_Hinden][November 1995, 1997.]
102 PNNI PNNI over IP [Ross_Callon]
103 PIM Protocol Independent Multicast [RFC4601][Dino_Farinacci]
104 ARIS ARIS [Nancy_Feldman]
105 SCPS SCPS [Robert_Durst]
106 QNX QNX [Michael_Hunter]
107 A/N Active Networks [Bob_Braden]
108 IPComp IP Payload Compression Protocol [RFC2393]
109 SNP Sitara Networks Protocol [Manickam_R_Sridhar]
110 Compaq-Peer Compaq Peer Protocol [Victor_Volpe]
111 IPX-in-IP IPX in IP [CJ_Lee]
112 VRRP Virtual Router Redundancy Protocol [RFC5798]
113 PGM PGM Reliable Transport Protocol [Tony_Speakman]
114 any 0-hop protocol [Internet_Assigned_Numbers_Authority]
115 L2TP Layer Two Tunneling Protocol [RFC3931][Bernard_Aboba]
116 DDX D-II Data Exchange (DDX) [John_Worley]
117 IATP Interactive Agent Transfer Protocol [John_Murphy]
118 STP Schedule Transfer Protocol [Jean_Michel_Pittet]
119 SRP SpectraLink Radio Protocol [Mark_Hamilton]
120 UTI UTI [Peter_Lothberg]
121 SMP Simple Message Protocol [Leif_Ekblad]
122 SM Simple Multicast Protocol [Jon_Crowcroft][draft-perlman-simple-multicast]
123 PTP Performance Transparency Protocol [Michael_Welzl]
124 ISIS over IPv4 [Tony_Przygienda]
125 FIRE [Criag_Partridge]
126 CRTP Combat Radio Transport Protocol [Robert_Sautter]
127 CRUDP Combat Radio User Datagram [Robert_Sautter]
128 SSCOPMCE [Kurt_Waber]
129 IPLT [[Hollbach]]
130 SPS Secure Packet Shield [Bill_McIntosh]
131 PIPE Private IP Encapsulation within IP [Bernhard_Petri]
132 SCTP Stream Control Transmission Protocol [Randall_R_Stewart]
133 FC Fibre Channel [Murali_Rajagopal][RFC6172]
134 RSVP-E2E-IGNORE [RFC3175]
135 Mobility Header Y [RFC6275]
136 UDPLite [RFC3828]
137 MPLS-in-IP [RFC4023]
138 manet MANET Protocols [RFC5498]
139 HIP Host Identity Protocol Y [RFC5201]
140 Shim6 Shim6 Protocol Y [RFC5533]
141 WESP Wrapped Encapsulating Security Payload [RFC5840]
142 ROHC Robust Header Compression [RFC5858]
143-252 Unassigned [Internet_Assigned_Numbers_Authority]
253 Use for experimentation and testing Y [RFC3692]
254 Use for experimentation and testing Y [RFC3692]
255 Reserved [Internet_Assigned_Numbers_Authority]

 Checksum: 체크섬입니다. 위에서 설명했으므로 생략합니다.

 Source, Destination IP Address: 각각 송신지와 수신지의 IP 주소입니다. IPv4에서는 32비트 크기입니다.

 IP Header Option: IP 헤더의 부가적인 옵션입니다. 이는 선택사항입니다. 8비트 옵션+8비트 옵션+가변 데이터로 구성되어 있으며 8비트 옵션은 copy(1비트)+class(2비트)+option number(5비트)로 구성되어 있습니다.

 - copy: 0이면 데이터 조각 중 첫 번째 패킷에만 이 옵션이 붙음을 나타냅니다. 1이면 모든 패킷에 이 옵션이 붙음을 나타냅니다.
 - class: 00이면 네트워크 제어용, 10이면 디버그용, 나머지는 미정입니다.
 - option number: 곧 이어지는 옵션 데이터의 내용을 아래와 같이 세분화됩니다

  • 00000: class=0일 때 end of option list(옵션 목록 끝)을 나타냅니다.
  • 00001: class=0일 때 no operation(동작 없음)을 나타냅니다.
  • 00011: class=0일 때 loose source routing(느슨한 소스 라우팅)을 나타냅니다.
  • 00111: class=0일 때 record route(경로 기록)을 나타냅니다.
  • 01001: class=0일 때 strict source routing(엄격한 소스 라우팅)을 나타냅니다.
  • 00100: class=1일 때 timestamp(타임 스탬프)를 나타냅니다.