[AIX 네트워크 관리 10] TCP/IP (4) 패킷 추적, 인터페이스 머리글, 네트워크 계층(ARP·ICMP·IP)
https://archive.horanglab.com/posts/aix-net-tcpip-4
핵심 정리
- 패킷 추적:
iptrace는 네트워크 인터페이스 수준에서 패킷을 잡고,ipreport는 그 결과를 16진·ASCII로 보여 주며,trpt는 TCP 전송 프로토콜 수준에서 시각·TCP 상태·순서까지 더 자세히 보여 줍니다. - 이더넷 프레임 머리글은 DA(6)·SA(6)·Type(2, IP 0800, ARP 0806)이며, 토큰링 MAC 머리글은 AC·FC·DA·SA·RI(최대 18바이트), LLC 머리글은 DSAP·SSAP(x'aa')·CONTROL(UI x'03', XID x'AF', TEST x'E3')·PROT_ID·TYPE입니다.
- ARP는 같은 LAN에서 IP 주소를 하드웨어 주소로 바꿉니다. 커널이 표를 관리하며 항목은 20분, 미완성 항목은 3분 뒤 지워집니다. 영구 항목은
arp -s … pub. SLIP·SOC 같은 점대점 연결에는 쓰지 않습니다. - ICMP는 IP의 오류·제어 메시지(echo, destination unreachable, source quench, redirect, time exceeded 등)를 처리하며, IP를 신뢰성 있게 만들지는 않습니다. API는 없습니다.
- IP는 비연결·비신뢰 패킷 배달입니다. 머리글은 Version(4), 길이, TOS, 전체 길이(인터페이스마다
ifconfig·smit chinet으로 설정), 식별·플래그·조각 오프셋, TTL(기본 255), 프로토콜, 체크섬, 주소, 옵션(소스 라우팅, 경로 기록, 타임스탬프 등)입니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (내용이 같음) |
| 원문 | Networks and communication management — 5.3판 9198쪽, 6.1판 135142쪽 |
| 관련 명령어 | iptrace, ipreport, trpt, arp, ifconfig, smit chinet |
| 관련 RFC | RFC 791(IP), RFC 1100(Official Internet Protocols), RFC 1010(Assigned Numbers) |
패킷 추적
패킷 추적은 패킷이 계층을 거쳐 목적지까지 가는 경로를 확인하는 과정입니다.
iptrace 명령은 네트워크 인터페이스 수준의 패킷 추적을 합니다. ipreport 명령은 패킷 추적 결과를 16진수와 ASCII 형식으로 출력합니다. trpt 명령은 TCP의 전송 프로토콜 수준 패킷 추적을 합니다. trpt 명령의 출력은 시각, TCP 상태, 패킷 순서 정보까지 더 자세합니다.
영어 원문
Packet tracing
Packet tracing is the process by which you can verify the path of a packet through the layers to its destination.
The iptrace command performs network interface level packet tracing. The ipreport command issues output on the packet trace in both hexadecimal and ASCII format. The trpt command performs transport protocol level packet tracking for the TCP. The trpt command output is more detailed, including information on time, TCP state, and packet sequencing.
네트워크 인터페이스 패킷 머리글
네트워크 인터페이스 계층에서는 나가는 데이터에 패킷 머리글을 붙입니다.
네트워크 인터페이스 구조의 계층은 위(소프트웨어)부터 네트워크 계층, 네트워크 인터페이스 계층, 장치 드라이버, 그리고 (하드웨어) 네트워크 어댑터 카드나 연결이며, 데이터는 양방향으로 흐릅니다.
SOFTWARE Network Layer
Network Interface Layer
Device Driver
HARDWARE Network Adapter Card/Connection
그림 8. 네트워크 인터페이스 구조를 거치는 패킷 흐름(원문 그림을 글자로 다시 그림)
그다음 패킷은 네트워크 어댑터를 거쳐 알맞은 네트워크로 보내집니다. 패킷은 목적지에 닿기 전에 여러 게이트웨이를 거칠 수 있습니다. 목적지 네트워크에서 패킷의 머리글을 떼어 내고 데이터를 알맞은 호스트로 보냅니다.
다음은 흔한 네트워크 인터페이스 몇 가지의 패킷 머리글 정보입니다.
이더넷 어댑터 프레임 머리글
이더넷 어댑터의 IP나 ARP 프레임 머리글은 다음 세 필드로 이루어집니다.
표 55. 이더넷 어댑터 프레임 머리글
| 필드 | 길이 | 정의 |
|---|---|---|
| DA | 6바이트 | 목적지 주소 |
| SA | 6바이트 | 출발지 주소. 이 필드의 비트 0이 1이면 라우팅 정보(RI)가 있음을 나타냅니다. |
| Type | 2바이트 | 패킷이 IP인지 ARP인지 지정합니다. 유형 번호 값은 아래와 같습니다. |
Type 필드 번호
| 프로토콜 | 값 |
|---|---|
| IP | 0800 |
| ARP | 0806 |
토큰링 프레임 머리글
토큰링 어댑터의 MAC(medium access control) 머리글은 다섯 필드로 이루어집니다.
표 56. 토큰링 MAC 머리글
| 필드 | 길이 | 정의 |
|---|---|---|
| AC | 1바이트 | 접근 제어(access control). 이 필드 값 x'00'은 머리글 우선순위 0을 줍니다. |
| FC | 1바이트 | 필드 제어(field control). 이 필드 값 x'40'은 LLC(Logical Link Control) 프레임을 지정합니다. |
| DA | 6바이트 | 목적지 주소 |
| SA | 6바이트 | 출발지 주소. 이 필드의 비트 0이 1이면 라우팅 정보(RI)가 있음을 나타냅니다. |
| RI | 18바이트 | 라우팅 정보. 올바른 필드는 아래에서 설명합니다. |
MAC 머리글에는 각각 2바이트인 라우팅 정보 필드 두 개, 곧 라우팅 제어(RC)와 세그먼트 번호가 있습니다. 제한 브로드캐스트의 받는 쪽을 지정하는 데 세그먼트 번호를 8개까지 쓸 수 있습니다. RC 정보는 RI 필드의 바이트 0과 1에 들어 있습니다. RC 필드의 처음 두 비트 설정은 다음 뜻입니다.
| 비트 | 뜻 |
|---|---|
| 비트 (0) = 0 | RI 필드에 지정한 비브로드캐스트 경로를 씁니다. |
| 비트 (0) = 1 | RI 필드를 만들고 모든 링에 브로드캐스트합니다. |
| 비트 (1) = 0 | 모든 브리지를 거쳐 브로드캐스트합니다. |
| 비트 (1) = 1 | 제한된 브리지를 거쳐 브로드캐스트합니다. |
LLC(logical link control) 머리글은 다음 LLC 머리글 표처럼 다섯 필드로 이루어집니다.
표 57. 802.3 LLC 머리글
| 필드 | 길이 | 정의 |
|---|---|---|
| DSAP | 1바이트 | 목적지 서비스 접근점. 이 필드 값은 x'aa'입니다. |
| SSAP | 1바이트 | 출발지 서비스 접근점. 이 필드 값은 x'aa'입니다. |
| CONTROL | 1바이트 | LLC 명령과 응답을 정합니다. 가능한 세 값은 아래에서 설명합니다. |
PROT_ID |
3바이트 | 프로토콜 ID. 예약 필드이며 값은 x'0'입니다. |
| TYPE | 2바이트 | 패킷이 IP인지 ARP인지 지정합니다. |
CONTROL 필드 값
토큰링 제어 필드에는 번호 없는 정보 프레임, 교환 식별 프레임, 시험 프레임이 있습니다. 값은 다음과 같습니다.
| 값 | 뜻 |
|---|---|
| x'03' | UI(Unnumbered Information) 프레임. 토큰링 어댑터 데이터를 네트워크로 전송하는 일반적인(순서 없는) 방식입니다. 순서는 TCP/IP가 매깁니다. |
| x'AF' | XID(Exchange identification) 프레임. 보내는 호스트의 특성을 전달합니다. |
| x'E3' | 시험(Test) 프레임. 받은 데이터를 되돌려 보내 전송 경로 시험을 지원합니다. |
802.3 프레임 머리글
802.3 어댑터의 MAC 머리글은 다음 MAC 머리글 표처럼 두 필드로 이루어집니다.
표 58. 802.3 MAC 머리글
| 필드 | 길이 | 정의 |
|---|---|---|
| DA | 6바이트 | 목적지 주소 |
| SA | 6바이트 | 출발지 주소. 이 필드의 비트 0이 1이면 라우팅 정보(RI)가 있음을 나타냅니다. |
802.3의 LLC 머리글은 토큰링 MAC 머리글의 것과 같습니다.
영어 원문
Network Interface packet headers
At the Network Interface layer, packet headers are attached to outgoing data.
This illustration shows bi-directional data flow through the layers of the Network Interface Structure. From the top (software) they are the Network Layer, Network Interface Layer, Device Driver, and the (hardware) Network Adapter Card or Connection.
Packets are then sent through the network adapter to the appropriate network. Packets can pass through many gateways before reaching their destinations. At the destination network, the headers are stripped from the packets and the data is sent to the appropriate host.
The following section contains packet header information for several of the more common network interfaces.
Ethernet adapter frame headers
An Internet Protocol (IP) or Address Resolution Protocol (ARP) frame header for the Ethernet adapter is composed of these three fields.
Table 55. Ethernet adapter frame header
| Field | Length | Definition |
|---|---|---|
| DA | 6 bytes | Destination address. |
| SA | 6 bytes | Source address. If bit 0 of this field is set to 1, it indicates that routing information (RI) is present. |
| Type | 2 bytes | Specifies whether the packet is IP or ARP. The type number values are listed below. |
Type field numbers
- IP — 0800
- ARP — 0806
Token-Ring frame headers
There are five fields that comprise the medium access control (MAC) header for the token-ring adapter. Network Layer
Network Interface Layer
Device Driver
Network Adapter Card/Connection SOFTWARE
HARDWARE
Figure 8. Packet flow through Network Interface Structure
Table 56. Token-ring MAC header
| Field | Length | Definition |
|---|---|---|
| AC | 1 byte | Access control. The value in this field x'00' gives the header priority 0. |
| FC | 1 byte | Field control. The value in this field x'40' specifies the Logical Link Control frame. |
| DA | 6 bytes | Destination address. |
| SA | 6 bytes | Source address. If bit 0 of this field is set to 1, it indicates that routing information (RI) is present. |
| RI | 18 bytes | Routing information. The valid fields are discussed below. |
The MAC header consists of two routing information fields of two bytes each: routing control (RC) and segment numbers. A maximum of eight segment numbers can be used to specify recipients of a limited broadcast. RC information is contained in bytes 0 and 1 of the RI field. The settings of the first two bits of the RC field have the following meanings:
- bit (0) = 0 — Use the nonbroadcast route specified in the RI field.
- bit (0) = 1 — Create the RI field and broadcast to all rings.
- bit (1) = 0 — Broadcast through all bridges.
- bit (1) = 1 — Broadcast through limited bridges.
The logical link control (LLC) header is composed of five fields, as shown in the following LLC header table.
Table 57. 802.3 LLC header
| Field | Length | Definition |
|---|---|---|
| DSAP | 1 byte | Destination service access point. The value in this field is x'aa'. |
| SSAP | 1 byte | Source service access point. The value in this field is x'aa'. |
| CONTROL | 1 byte | Determines the LLC commands and responses. The three possible values for this field are discussed below. |
PROT_ID |
3 bytes | Protocol ID. This field is reserved. It has a value of x'0'. |
| TYPE | 2 bytes | Specifies whether the packet is IP or ARP. |
| Control field values: |
The token-ring control fields include an unnmubered information frame, an exchange identification frame, and a test frame. Their values are described here.
- x'03' — Unnumbered Information (UI) frame. This is the normal, or unsequenced, way in which token-ring adapter data is transmitted through the network. TCP/IP sequences the data.
- x'AF' — Exchange identification (XID) frame. This frame conveys the characteristics of the sending host.
- x'E3' — Test frame. This frame supports testing of the transmission path, echoing back the data that is received.
802.3 frame headers
The MAC header for the 802.3 adapter is composed of two fields, as shown in this MAC header table.
Table 58. 802.3 MAC header
| Field | Length | Definition |
|---|---|---|
| DA | 6 bytes | Destination address. |
| SA | 6 bytes | Source address. If bit 0 of this field is set to 1, it indicates that routing information (RI) is present. |
The LLC header for 802.3 is the same as for Token-Ring MAC header.
인터넷 네트워크 수준 프로토콜
인터넷 네트워크 수준 프로토콜은 기계와 기계 사이의 통신을 처리합니다.
곧 이 계층이 TCP/IP 라우팅을 구현합니다. 이 프로토콜들은 전송 계층에서 (목적지 기계의 네트워크 주소와 함께) 패킷 전송 요청을 받아, 패킷을 데이터그램 형식으로 바꾸고, 더 처리하도록 네트워크 인터페이스 계층으로 내려보냅니다.
TCP/IP 프로토콜 묶음의 계층은 위부터 응용 프로그램으로 이루어진 응용 계층, UDP와 TCP가 있는 전송 계층, 네트워크 (하드웨어) 인터페이스가 있는 네트워크 계층, 물리 네트워크가 있는 하드웨어 계층입니다(그림 9. TCP/IP 프로토콜 묶음의 네트워크 계층).
TCP/IP는 RFC 1100(Official Internet Protocols)을 따르는 데 필요한 프로토콜과, 인터넷 공동체의 호스트가 흔히 쓰는 다른 프로토콜을 제공합니다.
참고: TCP/IP의 인터넷 네트워크, 버전, 소켓, 서비스, 프로토콜 번호 사용도 RFC 1010(Assigned Numbers)을 따릅니다.
ARP(Address Resolution Protocol)
첫 번째 네트워크 수준 프로토콜은 ARP(Address Resolution Protocol)입니다. ARP는 인터넷 주소를 LAN의 고유한 하드웨어 주소로 동적으로 바꿉니다.
ARP의 동작을 설명하려고 노드 X와 Y를 생각해 봅니다. 노드 X가 Y와 통신하려는데 X와 Y가 서로 다른 LAN에 있으면, X와 Y는 브리지, 라우터, 게이트웨이를 거쳐 IP 주소로 통신합니다. LAN 안에서는 노드가 낮은 수준의 하드웨어 주소로 통신합니다.
같은 LAN의 같은 세그먼트에 있는 노드는 ARP로 다른 노드의 하드웨어 주소를 알아냅니다. 먼저 노드 X가 노드 Y의 하드웨어 주소를 묻는 ARP 요청을 브로드캐스트합니다. ARP 요청에는 X의 IP 주소와 하드웨어 주소, Y의 IP 주소가 들어 있습니다. Y는 ARP 요청을 받으면 자기 ARP 캐시(IP 주소를 하드웨어 주소로 빨리 바꾸는 데 씀)에 X 항목을 넣고, Y의 IP 주소와 하드웨어 주소가 든 ARP 응답을 X에게 바로 보냅니다. 노드 X는 Y의 ARP 응답을 받으면 자기 ARP 캐시에 Y 항목을 넣습니다.
X에 Y의 ARP 캐시 항목이 생기면 노드 X는 다시 ARP를 쓰지 않고 Y에게 패킷을 바로 보낼 수 있습니다(Y의 ARP 캐시 항목이 지워지면 다시 ARP로 Y에게 연락합니다).
대부분의 프로토콜과 달리 ARP 패킷의 머리글은 형식이 고정되어 있지 않습니다. 대신 다음처럼 여러 네트워크 기술에 쓸 수 있도록 메시지가 설계되어 있습니다.
- 이더넷 LAN 어댑터(이더넷과 802.3 프로토콜 모두 지원)
- 토큰링 네트워크 어댑터
- FDDI(Fiber Distributed Data Interface) 네트워크 어댑터
그러나 SLIP(Serial Line Interface Protocol)과 SOC(Serial Optical Channel Converter)는 점대점 연결이므로 ARP가 주소를 바꾸지 않습니다.
커널이 변환 표를 관리하며, 사용자나 응용 프로그램은 ARP를 바로 쓸 수 없습니다. 응용 프로그램이 인터넷 패킷을 인터페이스 드라이버 가운데 하나로 보내면 드라이버가 알맞은 주소 매핑을 요청합니다. 매핑이 표에 없으면 요청한 인터페이스 드라이버를 거쳐 LAN의 호스트들에게 ARP 브로드캐스트 패킷을 보냅니다.
ARP 매핑 표의 항목은 20분 뒤에 지워지고, 미완성 항목은 3분 뒤에 지워집니다. ARP 매핑 표에 영구 항목을 만들려면 pub 매개변수와 함께 arp 명령을 씁니다.
arp -s 802.3 host2 0:dd:0:a:8s:0 pub
ARP를 지원하는 호스트가 ARP 요청 패킷을 받으면, 요청한 시스템의 IP 주소와 하드웨어 주소를 적어 두고 필요하면 자기 매핑 표를 갱신합니다. 받는 호스트의 IP 주소가 요청한 주소와 맞지 않으면 요청 패킷을 버립니다. IP 주소가 맞으면 요청한 시스템에 응답 패킷을 보냅니다. 요청한 시스템은 새 매핑을 저장하고, 기다리던 비슷한 인터넷 패킷을 보내는 데 씁니다.
ICMP(Internet Control Message Protocol)
두 번째 네트워크 수준 프로토콜은 ICMP(Internet Control Message Protocol)입니다. ICMP는 모든 IP 구현에 꼭 있어야 하는 부분입니다. ICMP는 IP의 오류와 제어 메시지를 처리합니다.
이 프로토콜은 게이트웨이와 호스트가 패킷을 보낸 기계에 문제 보고를 보내게 합니다. ICMP는 다음을 합니다.
- 목적지가 살아 있고 닿을 수 있는지 시험합니다.
- 데이터그램 머리글의 매개변수 문제를 보고합니다.
- 시계 동기화와 전송 시간 추정을 합니다.
- 인터넷 주소와 서브넷 마스크를 얻습니다.
참고: ICMP는 IP의 기본 지원을 마치 상위 프로토콜처럼 씁니다. 그러나 실제로 ICMP는 IP의 필수 부분이며 모든 IP 모듈이 구현해야 합니다.
ICMP는 통신 환경의 문제에 관한 피드백을 주지만 IP를 신뢰성 있게 만들지는 않습니다. 곧 ICMP는 IP 패킷이 믿을 만하게 배달되거나, IP 패킷이 배달되지 않거나 잘못 배달될 때 ICMP 메시지가 출발지 호스트로 돌아가는 것을 보장하지 않습니다.
ICMP 메시지는 다음과 같은 상황에서 보낼 수 있습니다.
- 패킷이 목적지에 닿을 수 없을 때
- 게이트웨이 호스트에 패킷을 전달할 버퍼 용량이 없을 때
- 게이트웨이가 호스트에 더 짧은 경로로 트래픽을 보내라고 안내할 수 있을 때
TCP/IP는 여러 ICMP 메시지 유형을 보내고 받습니다(아래 ICMP 메시지 유형 참고). ICMP는 커널에 들어 있으며, 이 프로토콜에 대한 응용 프로그래밍 인터페이스(API)는 없습니다.
ICMP 메시지 유형
ICMP는 다음 메시지 유형을 보내고 받습니다.
| 메시지 유형 | 설명 |
|---|---|
| echo request | 목적지가 살아 있고 닿을 수 있는지 시험하려고 호스트와 게이트웨이가 보냅니다. |
| information request | 호스트와 게이트웨이가 자기가 붙은 네트워크의 인터넷 주소를 얻으려고 보냅니다. IP 목적지 주소의 네트워크 부분을 0으로 해서 보냅니다. |
| timestamp request | 목적지 기계에 현재 시각 값을 돌려 달라고 요청할 때 보냅니다. |
| address mask request | 호스트가 자기 서브넷 마스크를 알려고 보냅니다. 게이트웨이 주소를 알면 게이트웨이로 보내고, 모르면 브로드캐스트합니다. |
| destination unreachable | 게이트웨이가 IP 데이터그램을 배달할 수 없을 때 보냅니다. |
| source quench | 데이터그램이 게이트웨이나 호스트가 처리할 수 있는 것보다 빨리 도착할 때, 버리는 기계가 원래 출발지에 보내는 속도를 늦춰 달라고 보냅니다. |
| redirect message | 게이트웨이가 어떤 호스트가 최적이 아닌 경로를 쓰고 있음을 감지하면 보냅니다. |
| echo reply | echo request를 받은 기계가 요청을 보낸 기계에 응답으로 보냅니다. |
| information reply | 게이트웨이가 네트워크 주소 요청에 응답해, IP 데이터그램의 출발지와 목적지 필드를 모두 지정해 보냅니다. |
| timestamp reply | 현재 시각 값과 함께 보냅니다. |
| address mask reply | 서브넷 마스크를 요청한 기계에 보냅니다. |
| parameter problem | 호스트나 게이트웨이가 데이터그램 머리글에서 문제를 찾았을 때 보냅니다. |
| time exceeded | 다음이 참일 때 보냅니다. 각 IP 데이터그램에는 게이트웨이마다 1씩 줄어드는 TTL 카운터(홉 수)가 있습니다. 게이트웨이가 홉 수가 0이 된 데이터그램을 버립니다. |
| Internet Timestamp | 경로를 따라 타임스탬프를 기록하는 데 씁니다. |
IP(Internet Protocol)
세 번째 네트워크 수준 프로토콜은 IP(Internet Protocol)로, 인터넷에 신뢰성 없는 비연결 패킷 배달을 제공합니다.
IP는 정보 패킷을 하나하나 독립적으로 다루므로 비연결(connectionless)입니다. 배달을 보장하지 않으므로, 곧 보내는 호스트·받는 호스트·중간 호스트의 확인 응답을 요구하지 않으므로 신뢰성이 없습니다(unreliable).
IP는 네트워크 인터페이스 수준 프로토콜과의 인터페이스를 제공합니다. 네트워크의 물리 연결은 머리글과 데이터가 있는 프레임으로 정보를 전송합니다. 머리글에는 출발지 주소와 목적지 주소가 들어 있습니다. IP는 물리 프레임과 비슷한 정보가 든 인터넷 데이터그램을 씁니다. 데이터그램에도 데이터의 출발지와 목적지 IP 주소가 든 머리글이 있습니다.
IP는 인터넷으로 보내는 모든 데이터의 형식을 정합니다.
그림 10은 일반적인 IP 패킷 머리글의 처음 32비트를 보여 주며, 아래 표가 각 필드를 설명합니다.
0 4 8 16 19 31
+-------+-------+---------------+-------------------------------+
|Version|Length |Type of Service| Total Length |
+-------+-------+---------------+-----+-------------------------+
| Identification |Flags| Fragment Offset |
+---------------+---------------+-----+-------------------------+
| Time to Live | Protocol | Header Checksum |
+---------------+---------------+-------------------------------+
| Source Address |
| Destination Address |
| Options ... |
+---------------------------------------------------------------+
그림 10. IP 패킷 머리글(필드 이름을 바탕으로 다시 그림)
IP 머리글 필드 정의
| 필드 | 설명 |
|---|---|
| Version | 쓰는 IP의 버전. 현재 IP 프로토콜 버전은 4입니다. |
| Length | 데이터그램 머리글의 길이(32비트 워드 단위) |
| Type of Service | 그 패킷에 원하는 우선 처리(precedence), 지연, 처리량, 신뢰성의 종류를 지정하는 하위 필드 다섯 개가 들어 있습니다(인터넷이 이 요청을 보장하지는 않습니다). 기본 설정은 일반 우선 처리, 보통 지연, 보통 처리량, 보통 신뢰성입니다. 지금 인터넷에서는 이 필드를 대체로 쓰지 않습니다. 이 IP 구현은 IP 규격 RFC 791(Internet Protocol)의 요구 사항을 따릅니다. |
| Total Length | 머리글과 데이터를 포함한 데이터그램의 길이(옥텟 단위). 게이트웨이에서 패킷을 조각내고 목적지에서 다시 합치는 기능이 제공됩니다. IP 패킷의 전체 길이는 인터페이스마다 Web-based System Manager(wsm), ifconfig 명령, SMIT 빠른 경로 smit chinet으로 구성할 수 있습니다. 구성 데이터베이스에 영구히 설정하려면 Web-based System Manager나 SMIT를 쓰고, 실행 중인 시스템의 값을 설정하거나 바꾸려면 ifconfig 명령을 씁니다. |
| Identification | 데이터그램을 식별하는 고유 정수 |
| Flags | Identification 필드와 함께 데이터그램 조각내기를 제어합니다. 조각 플래그는 데이터그램을 조각낼 수 있는지와 현재 조각이 마지막인지 지정합니다. |
| Fragment Offset | 원래 데이터그램에서 이 조각의 오프셋(8옥텟 단위) |
| Time to Live | 데이터그램이 인터넷에 머물 수 있는 시간. 잘못 라우팅된 데이터그램이 인터넷에 끝없이 남지 않게 합니다. 기본값은 255초입니다. |
| Protocol | 상위 프로토콜 유형 |
| Header Checksum | 머리글 값의 무결성을 보장하려고 계산한 수 |
| Source Address | 보내는 호스트의 인터넷 주소 |
| Destination Address | 받는 호스트의 인터넷 주소 |
| Options | 네트워크 시험과 디버깅을 제공합니다. 모든 데이터그램에 필요하지는 않습니다(옵션 종류는 아래 표). |
Options 필드의 옵션
| 옵션 | 설명 |
|---|---|
| End of Option List | 옵션 목록의 끝을 나타냅니다. 각 옵션 끝마다가 아니라 마지막 옵션 끝에 씁니다. 옵션의 끝이 IP 머리글의 끝과 맞지 않을 때만 써야 합니다. 옵션이 데이터그램 길이를 넘으면 End of Option List를 씁니다. |
| No Operation | 옵션 사이의 정렬을 맞춥니다. 예를 들어 다음 옵션의 시작을 32비트 경계에 맞춥니다. |
| Loose Source and Record Route | 인터넷 데이터그램의 출발지가 게이트웨이가 데이터그램을 목적지로 전달하는 데 쓸 라우팅 정보를 주고, 경로 정보를 기록하게 합니다. 느슨한 소스 경로이므로, 게이트웨이나 호스트 IP는 경로의 다음 주소에 닿으려고 중간 게이트웨이를 몇 개든 거치는 어떤 경로든 쓸 수 있습니다. |
| Strict Source and Record Route | 인터넷 데이터그램의 출발지가 게이트웨이가 데이터그램을 목적지로 전달하는 데 쓸 라우팅 정보를 주고, 경로 정보를 기록하게 합니다. 엄격한 소스 경로이므로, 게이트웨이나 호스트 IP는 경로에 지정된 다음 게이트웨이나 호스트에 닿으려면 데이터그램을 소스 경로의 다음 주소로 바로, 그리고 다음 주소가 가리키는 직접 연결 네트워크로만 보내야 합니다. |
| Record Route | 인터넷 데이터그램의 경로를 기록하는 방법을 줍니다. |
| Stream Identifier | 스트림 개념을 지원하지 않는 네트워크를 거쳐 스트림 식별자를 실어 나르는 방법을 줍니다. |
| Internet Timestamp | 경로를 따라 타임스탬프를 기록합니다. |
나가는 패킷에는 자동으로 IP 머리글이 앞에 붙습니다. 들어오는 패킷은 상위 프로토콜로 보내기 전에 IP 머리글을 뗍니다. IP 프로토콜은 인터넷 네트워크에서 호스트의 보편적인 주소 지정을 제공합니다.
영어 원문
Internet network-level protocols
The Internet network-level protocols handle machine-to-machine communication.
In other words, this layer implements TCP/IP routing. These protocols accept requests to send packets (along with the network address of the destination machine) from the Transport layer, convert the packets to datagram format, and send them down to the Network Interface layer for further processing.
This illustration shows the various layers of the TCP/IP Suite of Protocols. From the top, the application layer consists of the application. The transport layer contains UDP and TCP. The network layer contains the network (hardware) interface. And finally, the hardware layer contains the physical network.
TCP/IP provides the protocols that are required to comply with RFC 1100, Official Internet Protocols, as well as other protocols commonly used by hosts in the Internet community.
Note: The use of Internet network, version, socket, service, and protocol numbers in TCP/IP also complies with RFC 1010, Assigned Numbers.
Address Resolution Protocol
The first network-level protocol is the Address Resolution Protocol (ARP). ARP dynamically translates Internet addresses into the unique hardware addresses on local area networks. Figure 9. Network layer of the TCP/IP Suite of Protocols
To illustrate how ARP works, consider two nodes, X and Y. If node X wishes to communicate with Y, and X and Y are on different local area networks (LANs), X and Y communicate through bridges, routers, or gateways, using IP addresses. Within a LAN, nodes communicate using low-level hardware addresses.
Nodes on the same segment of the same LAN use ARP to determine the hardware address of other nodes. First, node X broadcasts an ARP request for node Y's hardware address. The ARP request contains X's IP and hardware addresses, and Y's IP address. When Y receives the ARP request, it places an entry for X in its ARP cache (which is used to map quickly from IP address to hardware address), then responds directly to X with an ARP response containing Y's IP and hardware addresses. When node X receives Y's ARP response, it places an entry for Y in its ARP cache.
Once an ARP cache entry exists at X for Y, node X is able to send packets directly to Y without resorting again to ARP (unless the ARP cache entry for Y is deleted, in which case ARP is reused to contact Y).
Unlike most protocols, ARP packets do not have fixed-format headers. Instead, the message is designed to be useful with a variety of network technologies, such as:
Ethernet LAN adapter (supports both Ethernet and 802.3 protocols)
Token-ring network adapter
Fiber Distributed Data Interface (FDDI) network adapter
However, ARP does not translate addresses for Serial Line Interface Protocol (SLIP) or Serial Optical Channel Converter (SOC), since these are point-to-point connections.
The kernel maintains the translation tables, and the ARP is not directly available to users or applications. When an application sends an Internet packet to one of the interface drivers, the driver requests the appropriate address mapping. If the mapping is not in the table, an ARP broadcast packet is sent through the requesting interface driver to the hosts on the local area network.
Entries in the ARP mapping table are deleted after 20 minutes; incomplete entries are deleted after 3 minutes. To make a permanent entry in the ARP mapping tables, use the arp command with the pub parameter:
arp -s 802.3 host2 0:dd:0:a:8s:0 pub
When any host that supports ARP receives an ARP request packet, the host notes the IP and hardware addresses of the requesting system and updates its mapping table, if necessary. If the receiving host IP address does not match the requested address, the host discards the request packet. If the IP address does match, the receiving host sends a response packet to the requesting system. The requesting system stores the new mapping and uses it to transmit any similar pending Internet packets.
Internet Control Message Protocol
The second network-level protocol is the Internet Control Message Protocol (ICMP). ICMP is a required part of every IP implementation. ICMP handles error and control messages for IP.
This protocol allows gateways and hosts to send problem reports to the machine sending a packet. ICMP does the following:
Tests whether a destination is alive and reachable
Reports parameter problems with a datagram header
Performs clock synchronization and transit time estimations
Obtains Internet addresses and subnet masks
Note: ICMP uses the basic support of IP as if it were a higher-level protocol. However, ICMP is actually an integral part of IP and must be implemented by every IP module.
ICMP provides feedback about problems in the communications environment, but does not make IP reliable. That is, ICMP does not guarantee that an IP packet is delivered reliably or that an ICMP message is returned to the source host when an IP packet is not delivered or is incorrectly delivered.
ICMP messages might be sent in any of the following situations:
When a packet cannot reach its destination
When a gateway host does not have the buffering capacity to forward a packet
When a gateway can direct a host to send traffic on a shorter route
TCP/IP sends and receives several ICMP message types (see “Internet Control Message Protocol message types”). ICMP is embedded in the kernel, and no application programming interface (API) is provided to this protocol.
Internet Control Message Protocol message types:
ICMP sends and receives these message types.
- echo request — Sent by hosts and gateways to test whether a destination is alive and reachable.
- information request — Sent by hosts and gateways to obtain an Internet address for a network to which they are attached. This message type is sent with the network portion of IP destination address set to a value of 0.
- timestamp request — Sent to request that the destination machine return its current value for time of day.
- address mask request — Sent by host to learn its subnet mask. The host can either send to a gateway, if it knows the gateway address, or send a broadcast message.
- destination unreachable — Sent when a gateway cannot deliver an IP datagram.
- source quench — Sent by discarding machine when datagrams arrive too quickly for a gateway or host to process, in order to request that the original source slow down its rate of sending datagrams.
- redirect message — Sent when a gateway detects that some host is using a nonoptimum route.
- echo reply — Sent by any machine that receives an echo request in reply to the machine which sent the request.
- information reply — Sent by gateways in response to requests for network addresses, with both the source and destination fields of the IP datagram specified.
- timestamp reply — Sent with current value of time of day.
- address mask reply — Sent to machines requesting subnet masks.
- parameter problem — Sent when a host or gateway finds a problem with a datagram header.
- time exceeded — Sent when the following are true: • Each IP datagram contains a time-to-live counter (hop count), which is decremented by each gateway. • A gateway discards a datagram because its hop count has reached a value of 0.
- Internet Timestamp — Used to record the time stamps through the route.
Internet Protocol
The third network-level protocol is the Internet Protocol (IP), which provides unreliable, connectionless packet delivery for the Internet.
IP is connectionless because it treats each packet of information independently. It is unreliable because it does not guarantee delivery, meaning, it does not require acknowledgments from the sending host, the receiving host, or intermediate hosts.
IP provides the interface to the network interface level protocols. The physical connections of a network transfer information in a frame with a header and data. The header contains the source address and the
destination address. IP uses an Internet datagram that contains information similar to the physical frame. The datagram also has a header containing Internet Protocol addresses of both source and destination of the data.
IP defines the format of all the data sent over the Internet.
This illustration shows the first 32 bits of a typical IP packet header. Table below lists the various entities.
IP header field definitions
- Version — Specifies the version of the IP used. The current version of the IP protocol is 4.
- Length — Specifies the datagram header length, measured in 32-bit words.
- Type of Service — Contains five subfields that specify the type of precedence, delay, throughput, and reliability desired for that packet. (The Internet does not guarantee this request.) The default settings for these five subfields are routine precedence, normal delay, normal throughput, and normal reliability. This field is not generally used by the Internet at this time. This implementation of IP complies with the requirements of the IP specification, RFC 791, Internet Protocol.
- Total Length — Specifies the length of the datagram including both the header and the data measured in octets. Packet fragmentation at gateways, with reassembly at destinations, is provided. The total length of the IP packet can be configured on an interface-by-interface basis with the Web-based System Manager, wsm, the ifconfig command, or the System Management Interface Tool (SMIT) fast path,
smit chinet. Use Web-based System Manager or SMIT to set the values permanently in the configuration database; use the ifconfig command to set or change the values in the running system. - Identification — Contains a unique integer that identifies the datagram.
- Flags — Controls datagram fragmentation, along with the Identification field. The Fragment Flags specify whether the datagram can be fragmented and whether the current fragment is the last one.
- Fragment Offset — Specifies the offset of this fragment in the original datagram measured in units of 8 octets.
- Time to Live — Specifies how long the datagram can remain on the Internet. This keeps misrouted datagrams from remaining on the Internet indefinitely. The default time to live is 255 seconds.
- Protocol — Specifies the high-level protocol type.
- Header Checksum — Indicates a number computed to ensure the integrity of header values.
- Source Address — Specifies the Internet address of the sending host.
- Destination Address — Specifies the Internet address of the receiving host.
Figure 10. Internet Protocol packet header
- Options — Provides network testing and debugging. This field is not required for every datagram. End of Option List Indicates the end of the option list. It is used at the end of the final option, not at the end of each option individually. This option should be used only if the end of the options would not otherwise coincide with the end of the IP header. End of Option List is used if options exceed the length of the datagram. No Operation Provides alignment between other options; for example, to align the beginning of a subsequent option on a 32-bit boundary. Loose Source and Record Route Provides a means for the source of an Internet datagram to supply routing information used by the gateways in forwarding the datagram to a destination and in recording the route information. This is a loose source route: the gateway or host IP is allowed to use any route of any number of other intermediate gateways in order to reach the next address in the route. Strict Source and Record Route Provides a means for the source of an Internet datagram to supply routing information used by the gateways in forwarding the datagram to a destination and in recording the route information. This is a strict source route: In order to reach the next gateway or host specified in the route, the gateway or host IP must send the datagram directly to the next address in the source route and only to the directly connected network that is indicated in the next address. Record Route Provides a means to record the route of an Internet datagram. Stream Identifier Provides a way for a stream identifier to be carried through networks that do not support the stream concept. Internet Timestamp Provides a record of the time stamps through the route.
Outgoing packets automatically have an IP header prefixed to them. Incoming packets have their IP header removed before being sent to the higher-level protocols. The IP protocol provides for the universal addressing of hosts in the Internet network.