[AIX 네트워크 관리 11] TCP/IP (5) 전송 계층(UDP·RDS·TCP)과 응용 계층 프로토콜
https://archive.horanglab.com/posts/aix-net-tcpip-5
핵심 정리
- UDP는 IP 위에서 비연결 데이터그램 배달을 하며 배달·중복 방지를 보장하지 않습니다. 머리글은 출발지·목적지 포트, 길이, 체크섬입니다. 신뢰성이 필요하면 응용 프로그램이 직접 하거나 TCP를 씁니다.
- (6.1) RDS(Reliable Datagram Sockets)는 InfiniBand에서 순서·중복 없음을 보장하는 비연결 레코드 프로토콜로
AF_BYPASS도메인에 속합니다. RDSv3는 RDMA를 지원합니다.rdsctrl로rds_sendspace·rds_recvspace(기본 512KB, 최대 sendmsg 크기의 4배 이상 권장)·rds_mclustsize(기본 16KB, 클러스터 전체가 같아야 함)를 조정합니다. - TCP는 신뢰성 있는 스트림 배달로, 순서 번호와 ACK·재전송(왕복 시간에 따른 시간 초과), 창(window) 흐름 제어, 포트 다중화, 소켓 쌍으로 식별하는 연결을 제공합니다. 머리글의 Code 비트는 URG·ACK·PSH·RST·SYN·FIN입니다.
- 응용 계층: DOMAIN(named, 보통 UDP, 잘리면 TCP,
/etc/resolv.conf가 있으면 DNS), EGP(gated,/etc/gated.conf), FTP(익명 ftp 홈은 root 소유·쓰기 금지,anon.ftp스크립트), TELNET 옵션(BINARY, SUPPRESS GO_AHEAD, ECHO, TERM TYPE, NAWS 등), TFTP(UDP, 보안 없음), FINGER, HELLO, rexec·rlogin·rsh, WOL(매직 패킷), RIP(routed·gated), timed. - 할당 번호는 RFC 1010을 따르며
/etc/protocols와/etc/services에 있습니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (6.1에서 RDS over InfiniBand, Wake On LAN이 더해짐) |
| 원문 | Networks and communication management — 5.3판 98107쪽, 6.1판 142154쪽 |
| 파일 | /etc/resolv.conf, /etc/hosts, /etc/gated.conf, /etc/protocols, /etc/services, /usr/samples/tcpip/anon.ftp |
| 관련 명령어 | rdsctrl, ftp, ftpd, telnet, tftp, utftp, finger, wol, named, gated, routed, timed |
TCP/IP 전송 수준 프로토콜은 응용 프로그램이 다른 응용 프로그램과 통신하게 합니다.
TCP/IP 프로토콜 묶음의 계층은 위부터 응용 프로그램으로 이루어진 응용 계층, UDP와 TCP가 있는 전송 계층, 네트워크 (하드웨어) 인터페이스가 있는 네트워크 계층, 물리 네트워크가 있는 하드웨어 계층입니다(그림 11. TCP/IP 프로토콜 묶음의 전송 계층).
UDP(User Datagram Protocol)와 TCP는 인터넷 호스트 사이를 연결하는 기본 전송 수준 프로토콜입니다. 둘 다 프로그램이 다른 호스트의 응용 프로그램과 메시지를 주고받게 합니다. 응용 프로그램이 메시지를 보내라고 전송 계층에 요청하면, UDP와 TCP는 정보를 패킷으로 나누고, 목적지 주소가 든 패킷 머리글을 붙여, 더 처리하도록 네트워크 계층으로 보냅니다. TCP와 UDP 모두 호스트의 프로토콜 포트로 메시지의 구체적인 목적지를 식별합니다.
상위 프로토콜과 응용 프로그램은 데이터그램 연결에는 UDP를, 스트림 연결에는 TCP를 씁니다. 운영 체제의 소켓 인터페이스가 이 프로토콜들을 구현합니다.
UDP(User Datagram Protocol)
네트워크의 응용 프로그램이 다른 네트워크의 특정 응용 프로그램이나 프로세스에 메시지를 보내야 할 때가 있습니다. UDP는 인터넷 호스트의 응용 프로그램 사이에 데이터그램 방식의 통신을 제공합니다.
보내는 쪽은 어느 순간에 어떤 프로세스가 활성 상태인지 모르므로, UDP는 양의 정수로 식별하는 목적지 프로토콜 포트(곧 기계 안의 추상적인 목적지 지점)를 써서 호스트의 여러 목적지 가운데 하나로 메시지를 보냅니다. 프로토콜 포트는 받는 쪽 응용 프로그램이 가져갈 때까지 메시지를 큐에 받아 둡니다.
UDP는 데이터그램을 보낼 때 그 아래의 IP에 의존하므로 IP와 같은 비연결 메시지 배달을 제공합니다. 데이터그램 배달이나 중복 방지를 보장하지 않습니다. 그러나 UDP는 보내는 쪽이 메시지의 출발지와 목적지 포트 번호를 지정하게 하고, 데이터와 머리글 모두의 체크섬을 계산합니다. 이 두 기능으로 보내는 쪽과 받는 쪽 응용 프로그램이 메시지가 올바르게 배달되었는지 확인할 수 있습니다.
UDP 패킷 머리글의 처음 32비트에는 출발지 포트 번호와 목적지 포트 번호가, 다음 32비트에는 길이와 체크섬이 들어 있습니다.
0 16 31
+------------------+----------------+
| SOURCE PORT NUMBER | DESTINATION PORT NUMBER |
+------------------+----------------+
| LENGTH | CHECKSUM |
+------------------+----------------+
그림 12. UDP 패킷 머리글
UDP를 쓰면서 데이터그램의 믿을 만한 배달이 필요한 응용 프로그램은 자체 신뢰성 검사를 구현해야 합니다. 데이터 스트림의 믿을 만한 배달이 필요한 응용 프로그램은 TCP를 써야 합니다.
UDP 머리글 필드 정의
| 필드 | 설명 |
|---|---|
| Source Port Number | 정보를 보내는 프로토콜 포트의 주소 |
| Destination Port Number | 정보를 받는 프로토콜 포트의 주소 |
| Length | UDP 데이터그램의 길이(옥텟) |
| Checksum | IP와 같은 알고리즘으로 UDP 데이터그램을 검사합니다. |
UDP의 응용 프로그래밍 인터페이스(API)는 소켓 인터페이스가 제공하는 라이브러리 서브루틴의 모음입니다.
(6.1) InfiniBand의 RDS(Reliable Datagram Sockets)
RDS(Reliable Datagram Sockets)는 InfiniBand에서 순서를 지키고 중복이 없는 서비스를 제공하는 비연결 레코드 지향 프로토콜입니다. RDS는 소켓 API 가운데 UDP 부분을 그대로 드러냅니다.
RDS는 커널 TCP/IP 스택을 우회하는 프로토콜에 쓰는 AF_BYPASS 도메인에 속합니다.
AIX 운영 체제는 RDS 두 버전 RDSv2와 RDSv3을 제공합니다. RDSv3이 최신이며 RDMA(Remote Direct Memory Access)를 지원합니다.
RDS 소켓 만들기
RDS 소켓을 만들려면 응용 프로그램에 다음 줄을 넣어 socket() 시스템 호출을 부릅니다.
#include <sys/bypass.h>
include <net/rds_rdma.h> /* for RDSv3 only */
sock = socket (AF_BYPASS, SOCK_SEQPACKET,BYPASSPROTO_RDS);
BYPASSPROTO_RDS 프로토콜이 AF_BYPASS 계열에서 지원하는 유일한 신뢰 데이터그램 프로토콜이면 다음처럼 socket() 시스템 호출을 불러도 됩니다.
sock = socket (AF_BYPASS, SOCK_SEQPACKET,0);
시스템 호출
RDS는 다음 시스템 호출도 지원합니다: bind(), close(), getsockopt(), recvfrom(), recvmsg(), sendmsg(), sendto(), setsockopt().
RDSv3은 다음 시스템 호출도 지원합니다: connect(), read(), recv(), send(), write().
참고: RDS 소켓은 비연결이지만 RDSv3은 connect() 시스템 호출을 지원합니다. 다만 이때 connect()는 두 RDS 끝점 사이에 소켓 수준의 연결 개체를 만들지 않고, 소켓에 기본 목적지 끝점을 연결해 둘 뿐입니다. 그래서 RDS 소켓에는 listen(), accept(), shutdown() 시스템 호출을 지원하지 않습니다.
RDSv2의 rdsctrl 유틸리티
rdsctrl 유틸리티(/usr/sbin/rdsctrl)로 RDS 통계의 조정 값과 진단을 바꿉니다. RDSv2에서는 RDS를 적재한 뒤(bypassctrl load rds) 쓸 수 있습니다. 이 유틸리티에 관한 자세한 내용은 인수 없이 rdsctrl 명령을 실행해 봅니다.
통계: 여러 RDS 통계를 보려면 # rdsctrl stats 명령을, 통계를 초기화하려면 # rdsctrl stats reset 명령을 실행합니다.
조정 매개변수
다음 RDS 매개변수는 RDS를 적재한 뒤, RDS 응용 프로그램을 실행하기 전에 조정할 수 있습니다.
| 매개변수 | 설명 |
|---|---|
rds_sendspace |
흐름(flow)별 보내기 버퍼의 상한(high-water mark). 소켓마다 흐름이 여럿일 수 있습니다. 기본값은 524288바이트(512KB)이며 # rdsctrl set rds_sendspace=<바이트 값>으로 설정합니다. |
rds_recvspace |
소켓별 받기 버퍼의 흐름별 상한. 이 소켓에 흐름이 하나 늘 때마다 받기 상한이 이 값만큼 늘어납니다. 기본값은 524288바이트(512KB)이며 # rdsctrl set rds_recvspace=<바이트 값>으로 설정합니다. |
rds_mclustsize |
개별 메모리 클러스터의 크기이자 메시지 조각 크기. 기본값은 16384바이트(16KB)이며 늘 4096의 배수입니다. # rdsctrl set rds_mclustsize=<4096의 배수 바이트>로 설정합니다. |
참고: RDS 스트리밍 성능을 높이려면 rds_sendspace와 rds_recvspace 값이 가장 큰 RDS sendmsg() 크기의 4배 이상이어야 합니다. RDS는 메시지 네 개를 받을 때마다 ACK를 보냅니다. rds_recvspace가 메시지 크기의 4배 이상이 아니면 처리량이 아주 낮습니다.
주의: rds_mclustsize 값은 클러스터의 모든 시스템(노드)에서 같아야 합니다. 이 값을 바꾸면 성능에도 영향이 있습니다.
위 매개변수의 현재 값은 # rdsctrl get <매개변수> 명령으로 얻습니다. 모든 조정 값과 그 값의 목록은 # rdsctrl get 명령으로 봅니다.
RDSv3의 rdsctrl 유틸리티
RDSv3에서 rdsctrl 명령은 다음 옵션을 지원합니다.
help [<tunable name>]: 지정한 RDSv3 조정 값의 설명을 보여 줍니다. 조정 값을 지정하지 않으면 RDSv3이 지원하는 모든 조정 값과 각 설명을 보여 줍니다.set [-p] {<tunable name> = <value>}: 지정한 RDSv3 조정 값을 설정합니다. 권한 없는 사용자가 RDS 조정 값을 바꾸지 못하도록 필요한 권한이 있는지 확인하고, 새 값의 범위를 검사합니다.-p플래그는 재부팅 뒤에도 값이 유지되게 합니다.get [<tunable name>]: 물은 조정 값의 현재 값을 가져옵니다. 이름을 지정하지 않으면 모든 RDS 조정 값의 현재 값을 돌려줍니다.default [-p] [<tunable name>]: 조정 값을 기본값으로 되돌립니다. 이름을 지정하면 그 값만, 지정하지 않으면 모든 값을 되돌립니다.-p플래그로 재부팅 뒤에도 유지되게 할 수 있습니다.load: RDSv3 커널 확장을 (적재되어 있지 않으면) 적재합니다.unload: RDSv3 커널 확장을 내립니다.ras [-p] <minimal | normal | detail | maximal>: RDSv3의 AIX RAS 추적과 오류 검사 설정을 지정한 수준으로 맞춥니다. 내부적으로errctrl과ctctrl명령을 부릅니다.-p플래그는 재부팅 뒤에도 설정이 유지되게 합니다.ras extract: RDS의 RAS 오류·비오류 추적 버퍼 내용을 표준 출력으로 덤프합니다.info [<flags>]: rds-info 명령의 별칭입니다.ping [<IPv4 address>]: rds-ping 명령의 별칭입니다.conn <restart | kill> <source IP address> <destination IP address>: 지정한 RDS 연결을 다시 시작하거나(restart) 영구히 끝냅니다(kill). 연결은 로컬과 원격 노드의 IP 주소로 지정합니다. 다시 시작하면 그 아래의 InfiniBand 연결을 끊고 다시 맺으려 합니다. 끝내면(kill) 그 아래의 InfiniBand 연결을 끊고 해당 RDS 연결의 자원을 모두 해제합니다.trace start <trace file path> <maximum data captured per RDS fragment>: RDSv3 프로토콜의 회선 트래픽을 잡는 추적 세션을 시작합니다. RDSv3 메시지는 조각으로 전송되며, 보내거나 받는 RDS 조각마다 지정한 추적 파일에 추적 패킷으로 기록됩니다. 조각마다 페이로드를 지정한 바이트까지 잡습니다. 권한 있는 사용자만 RDS 트래픽을 추적할 수 있고, 한 번에 추적 세션 하나만 활성화할 수 있습니다.trace stop:trace start로 시작한 추적 세션을 끝내고 추적 파일을 닫습니다. 그 뒤trace report로 추적 파일의 텍스트 보고서를 만들 수 있습니다.trace report <trace file path>: 앞서 잡은 RDS 프로토콜 추적 파일의 텍스트 보고서를 표준 출력에 출력합니다.version: 지금 시스템에 적재된 RDS 프로토콜 버전을 출력합니다.
RDSv3 조정 값: RDSv3이 지원하는 조정 값 목록을 보려면 인수 없이 rdsctrl help 명령을 실행합니다.
RDMA API(RDSv3만)
RDS 소켓으로 RDMA를 다루는 프로그래밍 모델은 클라이언트/서버 모델입니다. RDMA 클라이언트는 지정한 RDMA 서버에서 RDMA 읽기나 쓰기 작업을 시작하는 응용 프로그램이고, RDMA 서버는 RDMA 데이터 전송을 처리하는 응용 프로그램입니다. RDMA 읽기는 클라이언트의 주소 공간에서 서버의 주소 공간으로, RDMA 쓰기는 서버의 주소 공간에서 클라이언트의 주소 공간으로 데이터를 전송합니다. 어느 경우든 데이터는 양쪽의 사용자 공간 메모리 사이에서 바로 전송되며, 어느 쪽에서도 커널 공간 메모리로 복사되지 않습니다.
RDMA 클라이언트 응용 프로그램은 응용 수준 요청을 RDMA 쿠키와 함께 RDMA 서버 응용 프로그램에 보내 RDMA 읽기나 쓰기를 시작할 수 있습니다. 응용 수준 요청에는 RDMA 읽기인지 쓰기인지와, RDMA 서버가 원격으로 읽거나 쓸 클라이언트 메모리 영역의 주소와 길이가 들어 있어야 합니다.
RDMA 클라이언트가 RDMA 서버에 RDMA 요청을 보내는 방법은 두 가지입니다.
첫째는 RDS 소켓에서 sendmsg() 시스템 호출로, 응용 수준 RDMA 요청과 함께 RDS_CMSG_RDMA_MAP 제어 메시지(rds_get_mr_args 구조체를 실음)를 보내는 것입니다. 클라이언트 쪽 AIX 커널은 RDS_CMSG_RDMA_MAP 제어 메시지를 처리하면서 (클라이언트 응용 프로그램 주소 공간의) 지정한 로컬 메모리 영역을 DMA 접근용으로 매핑하고 RDMA 쿠키를 만듭니다. 그다음 응용 수준 요청이 RDMA 쿠키와 함께 서버로 갑니다.
둘째는 두 단계입니다. 먼저 rds_get_mr_args 구조체를 넘겨 RDS_GET_MR 소켓 옵션으로 setsockopt() 시스템 호출을 부릅니다. 이 호출이 지정한 로컬 메모리 영역을 DMA 접근용으로 매핑하고 RDMA 쿠키를 돌려줍니다. 다음으로 sendmsg() 시스템 호출로 응용 수준 RDMA 요청과 함께 RDS_CMSG_RDMA_DEST 제어 메시지(첫 단계에서 얻은 RDMA 쿠키를 실음)를 보냅니다.
시스템 호출이 하나뿐인 첫째 방법이 둘인 둘째 방법보다 낫습니다.
RDMA 서버 응용 프로그램은 클라이언트의 응용 수준 RDMA 읽기 요청을 받을 때 RDS_CMSG_RDMA_DEST 제어 메시지(클라이언트의 RDMA 쿠키를 실음)도 함께 받습니다. 그러면 서버는 RDS_CMSG_RDMA_ARGS 제어 메시지(rds_rdma_args 구조체를 실음)와 함께 응용 수준 응답을 클라이언트에 보내 RDMA 읽기 작업을 시작합니다. 서버 쪽 AIX 커널은 RDS_CMSG_RDMA_ARGS 제어 메시지를 처리하면서 (서버 응용 프로그램 주소 공간의) 지정한 로컬 메모리 영역을 DMA 접근용으로 매핑하고 실제로 RDMA 읽기를 시작합니다. RDMA 읽기는 서버 쪽 InfiniBand 어댑터가 클라이언트 쪽 어댑터와 주고받으며, 소프트웨어 개입 없이 클라이언트 응용 프로그램 메모리에서 서버 응용 프로그램 메모리로 바로 데이터를 전송합니다. RDMA 읽기가 끝나면 서버 쪽 어댑터가 응용 수준 응답을 클라이언트에 보냅니다. 클라이언트 응용 프로그램은 이 응답으로 RDMA 읽기가 끝났음을 압니다.
참고: 클라이언트가 RDS_RDMA_USE_ONCE 플래그를 설정한 RDS_CMSG_RDMA_MAP 제어로 RDMA 작업을 요청하면, 클라이언트 주소 공간에서 DMA용으로 매핑한 메모리 영역은 클라이언트가 서버의 응용 수준 응답을 받을 때 자동으로 매핑이 풀립니다.
이 암묵적 DMA 매핑·해제 방식으로 RDMA 응용 프로그램을 쓰기는 쉬워지지만, AIX에서 메모리를 DMA용으로 등록하는 일은 비용이 큰 작업임을 알아야 합니다. 그래서 같은 메모리 영역을 RDMA로 여러 번 접근할 거라면 DMA 등록을 처음 한 번만 하는 편이 효율적입니다. 그러려면 클라이언트 응용 프로그램이 서버에 RDMA 요청을 보낼 때 RDS_RDMA_USE_ONCE 플래그를 설정하지 않은 RDS_CMSG_RDMA_MAP 제어 메시지를 씁니다. 그러면 이후 클라이언트 메모리의 같은 영역에 대한 RDMA 전송은 클라이언트가 다른 요청을 보내지 않아도 RDMA 서버 응용 프로그램이 시작할 수 있습니다. 마지막에 클라이언트 응용 프로그램은 RDS_FREE_MR 소켓 옵션으로 setsockopt() 시스템 호출을 불러 DMA 매핑한 메모리를 명시적으로 풀어야 합니다.
RDS 전용 소켓 옵션은 setsockopt()나 getsockopt() 시스템 호출의 level 매개변수에 SOL_RDS를 주어 지정합니다.
TCP(Transmission Control Protocol)
TCP는 인터넷 호스트 사이에 데이터의 믿을 만한 스트림 배달을 제공합니다.
UDP처럼 TCP도 그 아래의 IP로 데이터그램을 나르고, 프로세스 포트 사이에 연속된 데이터그램 스트림의 블록 전송을 지원합니다. UDP와 달리 TCP는 믿을 만한 메시지 배달을 제공합니다. 데이터가 받는 프로세스에 손상되거나, 사라지거나, 중복되거나, 순서가 뒤바뀌어 배달되지 않게 합니다. 이렇게 전송 신뢰성을 보장하므로 응용 프로그램 개발자는 소프트웨어에 통신 안전장치를 넣지 않아도 됩니다.
TCP의 동작 특성은 다음과 같습니다.
| 특성 | 설명 |
|---|---|
| 기본 데이터 전송(Basic Data Transfer) | TCP는 몇 바이트씩 세그먼트로 묶어 인터넷 시스템으로 전송함으로써 사용자 사이에 양방향으로 8비트 옥텟의 연속 스트림을 전송합니다. TCP 구현은 적어도 1024바이트의 세그먼트 크기를 허용합니다. 일반적으로 패킷을 언제 묶고 보낼지는 TCP가 알아서 정합니다. |
| 신뢰성(Reliability) | TCP는 인터넷에서 손상되거나, 사라지거나, 중복되거나, 순서가 뒤바뀐 데이터를 복구해야 합니다. 보내는 옥텟마다 순서 번호를 매기고 받는 TCP의 긍정 확인 응답(ACK)을 요구해 이 신뢰성을 얻습니다. 시간 초과 간격 안에 ACK를 받지 못하면 데이터를 다시 보냅니다. TCP 재전송 시간 초과 값은 왕복 시간을 바탕으로 연결마다 동적으로 정합니다. 받는 쪽에서는 순서 번호로 순서가 뒤바뀌어 받은 세그먼트를 바로잡고 중복을 없앱니다. 손상은 보내는 세그먼트마다 체크섬을 붙이고 받는 쪽에서 확인해 손상된 세그먼트를 버리는 것으로 처리합니다. |
| 흐름 제어(Flow Control) | TCP는 ACK마다 창(window)을 돌려줘, 마지막으로 잘 받은 세그먼트 뒤로 받아들일 수 있는 순서 번호의 범위를 나타내 보내는 데이터의 양을 조절합니다. 창은 보내는 쪽이 다음 허락을 받기 전에 보낼 수 있는 옥텟 수를 나타냅니다. |
| 다중화(Multiplexing) | TCP는 한 호스트 안의 여러 프로세스가 TCP 통신 기능을 동시에 쓰게 합니다. TCP는 호스트마다 포트 주소 묶음을 받습니다. 포트 번호를 네트워크 주소, 호스트 주소와 합쳐 각 소켓을 고유하게 식별합니다. 소켓 한 쌍이 각 연결을 고유하게 식별합니다. |
| 연결(Connections) | TCP는 데이터 스트림마다 어떤 상태 정보를 초기화하고 유지해야 합니다. 소켓, 순서 번호, 창 크기를 포함한 이 정보의 조합을 연결이라고 합니다. 각 연결은 양쪽을 식별하는 소켓 한 쌍으로 고유하게 지정됩니다. |
| 우선 처리와 보안(Precedence and Security) | TCP 사용자는 통신의 보안과 우선 처리를 지정할 수 있습니다. 이 기능이 필요 없으면 기본값을 씁니다. |
다음 TCP 패킷 머리글 그림이 이 특성들을 보여 줍니다.
0 16 31
+-------------------------------+-------------------------------+
| Source Port | Destination Port |
+-------------------------------+-------------------------------+
| Sequence Number |
+---------------------------------------------------------------+
| Acknowledgment Number |
+-------+----------+------------+-------------------------------+
| Data | Reserved | Code | Window |
| Offset| | | |
+-------+----------+------------+-------------------------------+
| Checksum | Urgent Pointer |
+-------------------------------+-------------------------------+
| Options ... |
+---------------------------------------------------------------+
그림 13. TCP 패킷 머리글(필드 이름을 바탕으로 다시 그림)
TCP 머리글 필드 정의
| 필드 | 설명 |
|---|---|
| Source Port | 출발지 응용 프로그램의 포트 번호 |
| Destination Port | 목적지 응용 프로그램의 포트 번호 |
| Sequence Number | 이 세그먼트의 첫 데이터 바이트의 순서 번호 |
| Acknowledgment Number | 받은 가장 높은 바이트의 위치 |
| Data Offset | 세그먼트에서 데이터 부분의 오프셋 |
| Reserved | 앞으로 쓰려고 예약 |
| Code | 세그먼트의 목적을 나타내는 제어 비트(아래 표) |
| Window | 목적지가 받아들일 데이터의 양 |
| Checksum | 세그먼트 머리글과 데이터의 무결성을 확인합니다. |
| Urgent Pointer | 가능한 한 빨리 배달할 데이터를 나타냅니다. 긴급 데이터가 끝나는 위치를 지정합니다. |
| Options | 옵션(아래 표) |
Code 비트
| 비트 | 뜻 |
|---|---|
| URG | Urgent pointer 필드가 유효함 |
| ACK | Acknowledgement 필드가 유효함 |
| PSH | 세그먼트가 PUSH를 요청함 |
| RTS | 연결을 리셋함(RST) |
| SYN | 순서 번호를 동기화함 |
| FIN | 보내는 쪽이 바이트 스트림의 끝에 닿음 |
Options
| 옵션 | 설명 |
|---|---|
| End of Option List | 옵션 목록의 끝을 나타냅니다. 각 옵션 끝마다가 아니라 마지막 옵션에 씁니다. 옵션의 끝이 TCP 머리글의 끝과 맞지 않을 때만 쓰면 됩니다. |
| No Operation | 옵션 사이의 경계를 나타냅니다. 다른 옵션 사이에 써서, 예를 들어 다음 옵션의 시작을 워드 경계에 맞출 수 있습니다. 보내는 쪽이 이 옵션을 쓴다는 보장이 없으므로 받는 쪽은 워드 경계에서 시작하지 않는 옵션도 처리할 수 있어야 합니다. |
| Maximum Segment Size | TCP가 받을 수 있는 최대 세그먼트 크기를 나타냅니다. 처음 연결 요청에서만 보냅니다. |
TCP의 응용 프로그래밍 인터페이스는 소켓 인터페이스가 제공하는 라이브러리 서브루틴의 모음입니다.
영어 원문
Internet Transport-Level Protocols
The TCP/IP transport-level protocols allow application programs to communicate with other application programs.
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. Figure 11. Transport layer of the TCP/IP Suite of Protocols.
User Datagram Protocol (UDP) and the TCP are the basic transport-level protocols for making connections between Internet hosts. Both TCP and UDP allow programs to send messages to and receive messages from applications on other hosts. When an application sends a request to the Transport layer to send a message, UDP and TCP break the information into packets, add a packet header including the destination address, and send the information to the Network layer for further processing. Both TCP and UDP use protocol ports on the host to identify the specific destination of the message.
Higher-level protocols and applications use UDP to make datagram connections and TCP to make stream connections. The operating system sockets interface implements these protocols.
User Datagram Protocol
Sometimes an application on a network needs to send messages to a specific application or process on another network. The UDP provides a datagram means of communication between applications on Internet hosts.
Because senders do not know which processes are active at any given moment, UDP uses destination protocol ports (or abstract destination points within a machine), identified by positive integers, to send messages to one of multiple destinations on a host. The protocol ports receive and hold messages in queues until applications on the receiving network can retrieve them.
Because UDP relies on the underlying IP to send its datagrams, UDP provides the same connectionless message delivery as IP. It offers no assurance of datagram delivery or duplication protection. However, UDP does allow the sender to specify source and destination port numbers for the message and calculates a checksum of both the data and header. These two features allow the sending and receiving applications to ensure the correct delivery of a message.
This illustration shows the first 32 bits of the UDP packet header. The first 16 bits contain the source port number and the length. The second 16 bits contain the destination port number and the checksum.
Applications that require reliable delivery of datagrams must implement their own reliability checks when using UDP. Applications that require reliable delivery of streams of data should use TCP.
UDP Header Field Definitions
- Source Port Number — Address of the protocol port sending the information.
- Destination Port Number — Address of the protocol port receiving the information.
- Length — Length in octets of the UDP datagram.
- Checksum — Provides a check on the UDP datagram using the same algorithm as the IP.
The applications programming interface (API) to UDP is a set of library subroutines provided by the sockets interface. SOURCE PORT NUMBER DESTINATION PORT NUMBER
LENGTH CHECKSUM
Figure 12. User Datagram Protocol (UDP) packet header
Reliable Datagram Sockets over InfiniBand
Reliable Datagram Sockets (RDS) is a connectionless and record-oriented protocol that provides an in-order and no-duplicate service over InfiniBand. RDS exposes the User Datagram Protocol (UDP) subset of the socket API.
The RDS is part of the AF_BYPASS domain that is used for protocols that bypass the kernel TCP/IP stack.
The AIX operating system provides two versions of RDS: RDSv2 and RDSv3. RDSv3 is the latest version and includes support for Remote Direct Memory Access (RDMA).
Creating an RDS socket: To create an RDS socket, invoke the socket() system call by adding the following lines to the application program:
#include <sys/bypass.h>
include <net/rds_rdma.h> /* for RDSv3 only */
sock = socket (AF_BYPASS, SOCK_SEQPACKET,BYPASSPROTO_RDS);
If the BYPASSPROTO_RDS protocol is the only reliable datagram protocol that is supported in the AF_BYPASS family, you can also call the socket() system call as follows:
sock = socket (AF_BYPASS, SOCK_SEQPACKET,0);
System calls
The RDS also supports the following system calls:
blind()
close()
getsockopt()
recvform()
recvmsg()
sendmsg()
sendto()
setsockopt()
In addition, RDSv3 also supports the following system calls:
connect()
read()
recv()
send()
write()
Note: Although RDS sockets are connectionless, the connect() system call is supported by RDSv3. However, in this case, connect() does not create a socket-level connection entity between two RDS endpoints. It merely associates a default destination endpoint with the socket. For this reason, the listen(), accept(), and shutdown() system calls are not supported for the RDS sockets.
The rdsctrl utility for RDSv2: Use the rdsctrl utility (/usr/sbin/rdsctrl) to change the tunables and the diagnostics for RDS statistics. For RDSv2, the utility can be used after RDS is loaded (bypassctrl load rds). For more information for this utility, run the rdsctrl command with no arguments.
Statistics
To display various RDS statistics, run the # rdsctrl stats command.
To reset the statistics, run the # rdsctrl stats reset command.
Tuning Parameters
The following RDS parameters can be tuned after RDS is loaded, but before an RDS application is run:
rds_sendspace
Specifies the high-water mark of the per-flow send buffer. Each socket might have multiple flow. The default value is 524288 bytes (512 KB). The value is set by using the following command: # rdsctrl set rds_sendspace= <value in bytes>.
rds_recvspace
Specifies the per-flow high-water mark of the per-socket receive buffer. For every additional flow to this socket, the receive high-water mark is increased by this value. The default value is 524288 bytes (512 KB). The value is set by using the following command: # rdsctrl set rds_recvspace= <value in bytes>.
Note: For increased RDS streaming performance, the values of the rds_sendspace parameter and the rds_recvspace parameter must be at least the value of the largest RDS sendmsg() size, multiplied by four. RDS sends an ACK for each set of four messages that are received. If the rds_recvspace is not at least four times larger than the message size, the throughput is very low.
rds_mclustsize
Specifies the size of the individual memory cluster, which is also the message fragment size. The default size is 16384 bytes (16 KB). The value, always a multiple of 4096, is set by using the following command: # rdsctrl set rds_mclustsize= <multiple of 4096, in bytes>.
Attention: The rds_mclustsize value must be the same on all systems (nodes) in the cluster. Changing this value also has performance implications.
The current values for the preceding parameters can be retrieved by using the # rdsctrl get <parameter> command.
To get the list of all tunables and their values, run the # rdsctrl get command.
The rdsctrl utility for RDSv3: For RDSv3, the rdsctrl command supports its options. These options are listed here:
- help [
<tunablename>] — The help option displays a descriptive message of the specified RDSv3 tunable. If no tunable is specified, this option displays the list of all the tunables that are supported for RDSv3, along with the description of each tunable. - set [-p]
{<tunablename> =<value>}— The set option sets the value of the specified RDSv3 tunable. It verifies that the user has the required privileges to prevent unauthorized users to change the RDS tunables. It also does range validation for the new tunable values. The-pflag makes the assignment permanent across reboot operations. - get [
<tunablename>] — The get option gets the current value of the queried tunable. When no name field is specified to this command, it returns the current value of all the available RDS tunables. - default [-p] [
<tunablename>] — The default option is used to reset a tunable to its default value. When the name field is specified, only that tunable is reset. If no name field is specified, this command resets all the tunables to their default values. This option also provides a way to make the change permanent across reboots by using the-pflag. - load — The load option loads the RDSv3 kernel extension (if it is not already loaded).
- unload — The unload option is used to unload the RDSv3 kernel extension.
- ras [-p]
<minimal|normal|detail|maximal> — The ras option sets the AIX operating system RAS tracing and error checking settings for RDSv3 to the specified level. Internally, this command calls the errctrl and ctctrl AIX operating system commands. The-pflag makes the settings persistent across reboot operations. - ras extract — The ras extract option dumps the contents of the RAS error and non-error trace buffers for RDS to standard output.
- info [
<flags>] — The info option is an alias for the rds-info command. - ping [
<IPv4 address>] — The ping option is an alias for the rds-ping command. - conn
<restart|kill><sourceIP address><destinationIP address> — The conn option restarts the specified RDS connection (restart suboption) or permanently ends the specified RDS connection (kill suboption). The RDS connection to be restarted or ended is specified by giving the IP addresses of the local and remote nodes for the connection. Restarting a connection drops the underlying InfiniBand connection and attempts to establish the connection again. In contrast, ending a connection (kill suboption) drops the underlying InfiniBand connection and deallocates all resources that are associated with the corresponding RDS connection. - trace start
<tracefile path><maximumdata captured per RDS fragment> — The trace start option initiates a tracing session to capture over-the-wire traffic for the RDSv3 protocol. The RDSv3 messages are transmitted in fragments. Each RDS fragment that is transmitted or received is captured as a trace packet in the specified trace file. For each RDS fragment, its payload is captured up to<maximumdata captured per RDS fragment> bytes. Only privileged users can trace RDS traffic and only one tracing session can be active at a time. - trace stop — The trace stop option ends a tracing session that was previously initiated by a trace start command. It closes the trace file that is associated with the tracing session. After this command, the trace report command can be used to generate a text report of the trace file.
- trace report
<tracefile path> — The trace report option prints a text report to standard output, from a previously captured RDS protocol trace file. - version — The version option prints the RDS protocol version that is currently loaded in the system.
- RDSv3 tunables: To see the list of tunables that are supported for RDSv3, run the command rdsctrl help
with no arguments.
RDMA API (RDSv3 only): The programming model for working on RDMA with RDS sockets is based on the client/server model. The RDMA client is the application that initiates an RDMA read or write operation from a specified RDMA server. The RDMA server is the application that processes the RDMA data transfer. An RDMA read operation is a data transfer from the client's address space to the server's address space, whereas an RDMA write operation is a data transfer from the server's address space to the client's address space. In either case, data is transferred directly between user-space memory on both sides, without being copied to kernel-space memory on either side.
An RDMA client application can initiate an RDMA read or write operation by sending an application-level request, along with an RDMA cookie, to an RDMA server application. The application-level request must specify whether the operation is an RDMA read or write operation as well as the address and length of the area of the client's memory to be remotely read or written by the RDMA server.
There are two methods for sending an RDMA request from the RDMA client to the RDMA server.
The first method is to send an RDS_CMSG_RDMA_MAP control message (carrying an rds_get_mr_args structure) along with the application-level RDMA request by using the sendmsg() system call on an RDS socket. The AIX operating system kernel at the client side processes the RDS_CMSG_RDMA_MAP control message by mapping the specified area of local memory (from the client application's address space), for DMA access, and generating an RDMA cookie. Then, the application-level request is sent to the server along with the RDMA cookie.
The second method consists of two steps. The first step is to call the setsockopt() system call with the RDS_GET_MR socket option, passing an rds_get_mr_args structure. This call maps the specified area of local memory for DMA access, and returns an RDMA cookie. The second step is to send an RDS_CMSG_RDMA_DEST control message (carrying the RDMA cookie that is obtained from the first step) along with the application-level RDMA request by using the sendmsg() system call.
The first method, which requires one system call, is preferred over the second method, which requires two system calls.
When the RDMA server application receives the application-level RDMA read request from the client, it also receives an RDS_CMSG_RDMA_DEST control message (carrying the RDMA cookie from the client). Then, the server initiates the RDMA read operation, by sending an application-level reply to the client along with an RDS_CMSG_RDMA_ARGS control message (carrying a rds_rdma_args structure). The AIX operating system kernel at the server side processes the RDS_CMSG_RDMA_ARGS control message, by mapping the specified area of local memory (from the server application's address space), for DMA access, and by physically starting the RDMA read operation. The RDMA read operation is performed by the server-side InfiniBand adapter, which interacts with the client-side InfiniBand adapter, to do the data transfer directly from the client application's memory to the server application's memory, without further software intervention. After the RDMA read operation is completed, the server-side adapter sends the application-level reply to the client. This is how the client application knows that its RDMA read operation has been completed.
Note: An RDMA operation is requested by the client by using an RDS_CMSG_RDMA_MAP control in which the RDS_RDMA_USE_ONCE flag is set. For this request, the area of memory that is mapped for DMA in the client's address space of memory is automatically unmapped for DMA, when the client receives the application-level reply from the server.
Although this implicit DMA mapping or unmapping mechanism makes it simpler to write RDMA applications, developers must be aware that registering memory for DMA on the AIX operating system is an expensive operation. Thus, if the same area of memory is going to be accessed by using RDMA multiple times, it is more efficient to do the DMA registration only the first time. To do this activity, a client application needs to use an RDS_CMSG_RDMA_MAP control message without the RDS_RDMA_USE_ONCE flag set when sending the RDMA request to the server. Then, subsequent RDMA transfers to the same area of the client's memory can be initiated by the RDMA server application without the client needing to send another request to the server. At the end, the client application would need to explicitly unmap the DMA-mapped memory by using the setsockopt() system call with the RDS_FREE_MR socket option.
RDS-specific socket options are specified by using SOL_RDS as the level parameter for the setsockopt() or getsockopt() system call.
Transmission Control Protocol
TCP provides reliable stream delivery of data between Internet hosts.
Like UDP, TCP uses Internet Protocol, the underlying protocol, to transport datagrams, and supports the block transmission of a continuous stream of datagrams between process ports. Unlike UDP, TCP provides reliable message delivery. TCP ensures that data is not damaged, lost, duplicated, or delivered out of order to a receiving process. This assurance of transport reliability keeps applications programmers from having to build communications safeguards into their software.
The following are operational characteristics of TCP:
- Basic Data Transfer — TCP can transfer a continuous stream of 8-bit octets in each direction between its users by packaging some number of bytes into segments for transmission through the Internet system. TCP implementation allows a segment size of at least 1024 bytes. In general, TCP decides when to block and forward packets at its own convenience.
- Reliability — TCP must recover data that is damaged, lost, duplicated, or delivered out of order by the Internet. TCP achieves this reliability by assigning a sequence number to each octet it transmits and requiring a positive acknowledgment (ACK) from the receiving TCP. If the ACK is not received within the time-out interval, the data is retransmitted. The TCP retransmission time-out value is dynamically determined for each connection, based on round-trip time. At the receiver, the sequence numbers are used to correctly order segments that may be received out of order and to eliminate duplicates. Damage is handled by adding a checksum to each segment transmitted, checking it at the receiver, and discarding damaged segments.
- Flow Control — TCP governs the amount of data sent by returning a window with every ACK to indicate a range of acceptable sequence numbers beyond the last segment successfully received. The window indicates an allowed number of octets that the sender may transmit before receiving further permission.
- Multiplexing — TCP allows many processes within a single host to use TCP communications facilities simultaneously. TCP receives a set of addresses of ports within each host. TCP combines the port number with the network address and the host address to uniquely identify each socket. A pair of sockets uniquely identifies each connection.
- Connections — TCP must initialize and maintain certain status information for each data stream. The combination of this information, including sockets, sequence numbers, and window sizes, is called a connection. Each connection is uniquely specified by a pair of sockets identifying its two sides.
- Precedence and Security — Users of TCP may indicate the security and precedence of their communications. Default values are used when these features are not needed.
The TCP Packet Header figure illustrates these characteristics.
This illustration shows what is contained in the TCP packet header. The individual entities are listed in the text below.
TCP header field definitions
Short descriptions of each of the Transmission Control Protocol (TCP) fields follow. Figure 13. Transmission Control Protocol (TCP) packet header
- Source Port — Identifies the port number of a source application program.
- Destination Port — Identifies the port number of a destination application program.
- Sequence Number — Specifies the sequence number of the first byte of data in this segment.
- Acknowledgment Number — Identifies the position of the highest byte received.
- Data Offset — Specifies the offset of data portion of the segment.
- Reserved — Reserved for future use.
- Code — Control bits to identify the purpose of the segment: URG Urgent pointer field is valid. ACK Acknowledgement field is valid. PSH Segment requests a PUSH. RTS Resets the connection. SYN Synchronizes the sequence numbers. FIN Sender has reached the end of its byte stream.
- Window — Specifies the amount of data the destination is willing to accept.
- Checksum — Verifies the integrity of the segment header and data.
- Urgent Pointer — Indicates data that is to be delivered as quickly as possible. This pointer specifies the position where urgent data ends.
- Options — End of Option List Indicates the end of the option list. It is used at the final option, not at the end of each option individually. This option needs to be used only if the end of the options would not otherwise coincide with the end of the TCP header. No Operation Indicates boundaries between options. Can be used between other options; for example, to align the beginning of a subsequent option on a word boundary. There is no guarantee that senders will use this option, so receivers must be prepared to process options even if they do not begin on a word boundary. Maximum Segment Size Indicates the maximum segment size TCP can receive. This is only sent in the initial connection request.
The applications programming interface to TCP consists of a set of library subroutines provided by the sockets interface.
인터넷 응용 수준 프로토콜
TCP/IP는 응용 프로그램 수준에서 상위 인터넷 프로토콜을 구현합니다.
TCP/IP 프로토콜 묶음의 계층은 위부터 응용 계층, 전송 계층(UDP, TCP), 네트워크 계층, 하드웨어 계층입니다(그림 14. TCP/IP 프로토콜 묶음의 응용 계층).
응용 프로그램이 다른 호스트의 응용 프로그램에 데이터를 보내야 하면, 전송을 준비하도록 정보를 전송 수준 프로토콜로 내려보냅니다.
공식 인터넷 응용 수준 프로토콜은 다음과 같습니다.
- 도메인 이름 프로토콜(Domain Name Protocol)
- EGP(Exterior Gateway Protocol)
- FTP(File Transfer Protocol)
- Name/Finger 프로토콜
- Telnet 프로토콜
- TFTP(Trivial File Transfer Protocol)
TCP/IP는 공식 인터넷 프로토콜은 아니지만 인터넷 공동체에서 응용 프로그램 수준에서 흔히 쓰는 다른 상위 프로토콜도 구현합니다.
- DCN(Distributed Computer Network) 로컬 네트워크 프로토콜
- 원격 명령 실행 프로토콜
- 원격 로그인 프로토콜
- 원격 셸 프로토콜
- Wake On LAN 프로토콜
- RIP(Routing Information Protocol)
- 시간 서버 프로토콜
TCP/IP는 이 응용 수준 프로토콜 가운데 어느 것에도 API를 제공하지 않습니다.
도메인 이름 프로토콜
도메인 이름 프로토콜(DOMAIN)은 도메인의 호스트 하나가 도메인 안의 다른 호스트에게 이름 서버 역할을 하게 합니다.
DOMAIN은 UDP나 TCP를 아래 프로토콜로 쓰며, 로컬 네트워크가 다른 도메인과 상관없이 자기 도메인 안의 호스트 이름을 정하게 합니다. 보통 DOMAIN 프로토콜은 UDP를 씁니다. 그러나 UDP 응답이 잘리면 TCP를 쓸 수 있습니다. TCP/IP의 DOMAIN 프로토콜은 둘 다 지원합니다.
DOMAIN 계층 이름 체계에서 로컬 리졸버 루틴은 named 데몬이 관리하는 로컬 이름 풀이 데이터베이스로 인터넷 이름과 주소를 풀 수 있습니다. 호스트가 요청한 이름이 로컬 데이터베이스에 없으면 리졸버 루틴이 원격 DOMAIN 이름 서버에 묻습니다. 어느 경우든 이름 풀이 정보를 얻을 수 없으면 리졸버 루틴은 /etc/hosts 파일로 이름을 풀려고 합니다.
참고: 로컬 파일 /etc/resolv.conf가 있으면 TCP/IP는 로컬 리졸버 루틴이 DOMAIN 프로토콜을 쓰도록 구성합니다. 이 파일이 없으면 로컬 리졸버 루틴이 /etc/hosts 데이터베이스를 쓰도록 구성합니다.
TCP/IP는 DOMAIN 프로토콜을 named 데몬과 리졸버 루틴에 구현하며, 이 프로토콜에 API를 제공하지 않습니다.
EGP(Exterior Gateway Protocol)
EGP는 자율 시스템의 외부 게이트웨이가 다른 자율 시스템의 외부 게이트웨이와 라우팅 정보를 나누게 하는 방식입니다.
자율 시스템
자율 시스템(autonomous system)은 한 관리 주체가 책임지는 네트워크와 게이트웨이의 묶음입니다.
게이트웨이가 같은 자율 시스템에 있으면 내부 이웃, 다른 자율 시스템에 있으면 외부 이웃입니다. EGP로 라우팅 정보를 주고받는 게이트웨이를 EGP 피어나 이웃이라고 합니다. 자율 시스템 게이트웨이는 EGP로 EGP 이웃에게 접근 정보를 줍니다.
EGP는 외부 게이트웨이가 다른 외부 게이트웨이에게 접근 정보 교환에 동의해 달라고 요청하게 하고, EGP 이웃이 응답하는지 계속 확인하며, 라우팅 갱신 메시지를 넘겨 EGP 이웃이 접근 정보를 주고받도록 돕습니다.
EGP는 외부 게이트웨이가 그 게이트웨이의 자율 시스템 안에서 완전히 닿을 수 있는 목적지 네트워크만 알리도록 제한합니다. 그래서 EGP를 쓰는 외부 게이트웨이는 EGP 이웃에게 정보를 넘기지만, 자기 자율 시스템 밖의 EGP 이웃에 관한 접근 정보는 알리지 않습니다.
EGP는 다른 프로토콜의 라우팅 갱신 메시지에 나오는 거리 지표를 해석하지 않습니다. EGP는 거리 필드로 경로가 있는지만 나타냅니다(값 255는 네트워크에 닿을 수 없다는 뜻입니다). 두 경로가 모두 한 자율 시스템 안에 있지 않으면 이 값으로 더 짧은 경로를 계산할 수 없습니다. 그래서 EGP는 라우팅 알고리즘으로 쓸 수 없으며, 외부 게이트웨이에서 어떤 네트워크로 가는 경로는 하나뿐입니다.
경로를 동적으로 다시 구성하는 인터넷 네트워크의 자율 시스템 안에서 쓸 수 있는 RIP(Routing Information Protocol)와 달리, EGP 경로는 /etc/gated.conf 파일에 미리 정해 둡니다. EGP는 IP를 아래 프로토콜로 가정합니다.
EGP 메시지 유형
| 메시지 유형 | 설명 |
|---|---|
| Neighbor Acquisition Request | 외부 게이트웨이가 서로 이웃이 되자고 요청할 때 씁니다. |
| Neighbor Acquisition Reply | 외부 게이트웨이가 이웃이 되자는 요청을 받아들일 때 씁니다. |
| Neighbor Acquisition Refusal | 외부 게이트웨이가 이웃이 되자는 요청을 거절할 때 씁니다. 거절 메시지에는 out of table space 같은 이유가 들어 있습니다. |
| Neighbor Cease | 외부 게이트웨이가 이웃 관계를 끝낼 때 씁니다. 끝내는 메시지에는 going down 같은 이유가 들어 있습니다. |
| Neighbor Cease Acknowledgment | 외부 게이트웨이가 이웃 관계를 끝내자는 요청을 확인할 때 씁니다. |
| Neighbor Hello | 외부 게이트웨이가 연결 상태를 확인할 때 씁니다. 한 게이트웨이가 Hello 메시지를 내고 다른 게이트웨이가 I Heard You 메시지를 냅니다. |
| I Heard You | 외부 게이트웨이가 Hello 메시지에 응답할 때 씁니다. 응답하는 게이트웨이의 접근 정보와, 닿을 수 없으면 You are unreachable because of problems with my network interface 같은 이유가 들어 있습니다. |
| NR Poll | 외부 게이트웨이가 이웃 게이트웨이에 다른 게이트웨이에 닿을 수 있는지 물을 때 씁니다. |
| Network Reachability | 외부 게이트웨이가 NR Poll 메시지에 답할 때 씁니다. 메시지의 게이트웨이마다 그 게이트웨이가 이웃을 거쳐 닿을 수 있는 주소 정보가 들어 있습니다. |
| EGP Error | 외부 게이트웨이가 체크섬이 틀리거나 필드 값이 잘못된 EGP 메시지에 응답할 때 씁니다. |
TCP/IP는 EGP 프로토콜을 gated 서버 명령에 구현하며, 이 프로토콜에 API를 제공하지 않습니다.
FTP(File Transfer Protocol)
FTP는 서로 다른 호스트 사이에 데이터를 전송하고, 두 외부 호스트 사이에 파일을 간접으로 전송하게 합니다.
FTP는 원격 디렉터리 나열, 현재 원격 디렉터리 바꾸기, 원격 디렉터리 만들기와 지우기, 한 번의 요청으로 여러 파일 전송 같은 작업을 제공합니다. FTP는 사용자와 계정 암호를 외부 호스트에 넘겨 전송을 안전하게 합니다. FTP는 주로 응용 프로그램이 쓰도록 설계되었지만 사용자 중심의 대화형 세션도 허용합니다.
FTP는 신뢰성 있는 스트림 배달(TCP/IP)로 파일을 보내고, Telnet 연결로 명령과 응답을 주고받습니다. FTP는 NETASCII, IMAGE, Local 8 같은 기본 파일 형식도 이해합니다.
TCP/IP는 FTP를 ftp 사용자 명령과 ftpd 서버 명령에 구현하며, 이 프로토콜에 API를 제공하지 않습니다.
익명 ftp 사용자와 디렉터리를 만들 때는 ftp와 anonymous 사용자의 홈 디렉터리(예: /u/ftp)가 root 소유이고 쓰기 권한이 없게(예: dr-xr-xr-x) 해야 합니다. 이 계정, 파일, 디렉터리를 만드는 데 /usr/samples/tcpip/anon.ftp 스크립트를 쓸 수 있습니다.
Telnet 프로토콜
Telnet 프로토콜(TELNET)은 터미널 장치와 터미널 중심 프로세스가 연결하는 표준 방법을 제공합니다.
TELNET은 원격 호스트에 로그인하게 하는 터미널 에뮬레이션 프로그램이 흔히 씁니다. 그러나 터미널 사이 통신과 프로세스 간 통신에도 쓸 수 있습니다. FTP 같은 다른 프로토콜도 프로토콜 제어 채널을 맺는 데 TELNET을 씁니다.
TCP/IP는 TELNET을 tn, telnet, tn3270 사용자 명령에 구현합니다. telnetd 데몬은 TELNET에 API를 제공하지 않습니다.
TCP/IP는 클라이언트와 서버가 협상하는 다음 TELNET 옵션을 지원합니다.
| 옵션 | 설명 |
|---|---|
| BINARY TRANSMISSION | (tn3270 세션에서 씀) 문자를 이진 데이터로 전송합니다. |
SUPPRESS GO_AHEAD |
(운영 체제는 GO-AHEAD 옵션을 억제함) 데이터를 보내는 쪽과 받는 쪽 사이의 연결에서 이 옵션이 유효하면 보내는 쪽이 GO_AHEAD 옵션을 보내지 않아도 됩니다. GO_AHEAD 옵션을 원하지 않으면 연결의 양쪽이 아마 양방향으로 억제할 것입니다. 이 동작은 방향마다 따로 이루어져야 합니다. |
| TIMING MARK | (인식하지만 부정 응답을 함) 앞서 보낸 데이터가 완전히 처리되었는지 확인합니다. |
| EXTENDED OPTIONS LIST | TELNET 옵션 목록을 256개 더 늘립니다. 이 옵션이 없으면 TELNET 옵션은 256개까지만 허용합니다. |
| ECHO | (사용자가 바꿀 수 있는 명령) 이미 받은 에코 데이터 문자를 원래 보낸 쪽으로 돌려 보냅니다. |
| TERM TYPE | 서버가 사용자 TELNET 프로그램에 연결된 터미널 종류를 알아내게 합니다. |
| SAK(Secure Attention Key) | 사용자와 시스템 사이의 안전한 통신에 필요한 환경을 마련합니다. |
| NAWS(Negotiate About Window Size) | 클라이언트와 서버가 창 크기를 동적으로 협상하게 합니다. 창 크기 바꾸기를 지원하는 응용 프로그램이 씁니다. |
참고: ISO 8859 라틴 코드 페이지를 구현하려면 TELNET은 이진 모드가 아닐 때도 8비트 문자 전송을 허용해야 합니다.
TFTP(Trivial File Transfer Protocol)
TFTP는 외부 호스트와 파일을 읽고 쓸 수 있습니다.
TFTP는 신뢰성 없는 UDP로 파일을 나르므로 보통 FTP보다 빠릅니다. FTP처럼 TFTP도 파일을 NETASCII 문자나 8비트 이진 데이터로 전송할 수 있습니다. FTP와 달리 TFTP는 외부 호스트의 디렉터리를 나열하거나 바꿀 수 없고, 암호 보호 같은 보안 장치도 없습니다. 또 공개 디렉터리에서만 데이터를 쓰거나 가져올 수 있습니다.
TCP/IP는 TFTP를 tftp와 utftp 사용자 명령, tftpd 서버 명령에 구현합니다. utftp 명령은 파이프에서 쓰는 tftp 명령의 한 형태입니다. TCP/IP는 이 프로토콜에 API를 제공하지 않습니다.
자세한 내용은 Commands Reference 5권의 tftp·utftp 명령과 tftpd 데몬 설명을 봅니다.
Name/Finger 프로토콜
Name/Finger 프로토콜(FINGER)은 finger 명령과 fingerd 데몬 사이의 인터페이스를 제공하는 응용 수준 인터넷 프로토콜입니다.
fingerd 데몬은 지정한 원격 호스트에 지금 로그인한 사용자의 정보를 돌려줍니다. 특정 호스트의 사용자를 지정해 finger 명령을 실행하면 그 사용자의 구체적인 정보를 얻습니다. FINGER 프로토콜은 원격 호스트와 요청하는 호스트 모두에 있어야 합니다. FINGER는 TCP를 아래 프로토콜로 씁니다.
참고: TCP/IP는 이 프로토콜에 API를 제공하지 않습니다.
자세한 내용은 Commands Reference 2권의 finger 명령과 fingerd 데몬 설명을 봅니다.
DCN 로컬 네트워크 프로토콜
gated 데몬이 DCN(Distributed Computer Network) 로컬 네트워크 프로토콜을 제공합니다.
로컬 네트워크 프로토콜(HELLO)은 자율 시스템 안에서 쓰도록 설계된 내부 게이트웨이 프로토콜입니다(자세한 내용은 위의 자율 시스템 참고). HELLO는 연결, 라우팅, 시간 관리 정보를 유지합니다. 네트워크의 각 기계가 시간 지연을 바탕으로 목적지까지의 가장 짧은 경로를 정하고, 그 목적지의 라우팅 정보를 동적으로 갱신하게 합니다.
자세한 내용은 Commands Reference 2권의 gated 데몬 설명을 봅니다.
원격 명령 실행 프로토콜
rexec 사용자 명령과 rexecd 데몬이 원격 명령 실행 프로토콜을 제공해, 사용자가 호환되는 원격 호스트에서 명령을 실행하게 합니다.
자세한 내용은 Commands Reference 4권의 rexec 명령과 rexecd 데몬 설명을 봅니다.
원격 로그인 프로토콜
rlogin 사용자 명령과 rlogind 데몬이 원격 로그인 프로토콜을 제공해, 사용자가 원격 호스트에 로그인해 터미널을 원격 호스트에 바로 연결된 것처럼 쓰게 합니다.
자세한 내용은 Commands Reference 4권의 rlogin 명령과 rlogind 데몬 설명을 봅니다.
원격 셸 프로토콜
rsh 사용자 명령과 rshd 데몬이 원격 명령 셸 프로토콜을 제공해, 사용자가 호환되는 외부 호스트에서 셸을 열고 명령을 실행하게 합니다.
자세한 내용은 Commands Reference 4권의 rsh 명령과 rshd 데몬 설명을 봅니다.
(6.1) Wake On LAN 프로토콜
WOL(Wake On LAN)은 지정한 서브넷의 지정한 주소(들)로 매직 패킷(Magic Packet)을 보내, 네트워크에 연결된 일시 중단(suspended) 상태의 호스트 하나 이상을 깨우게 합니다.
WOL 사용법은 Commands Reference 6권의 wol 명령 설명을 봅니다.
RIP(Routing Information Protocol)
RIP와 이를 구현한 routed·gated 데몬은 게이트웨이 홉을 바탕으로 라우팅 정보를 추적하고 커널 라우팅 표 항목을 유지합니다.
자세한 내용은 routed와 gated 데몬을 봅니다.
시간 서버 프로토콜
timed 데몬은 한 호스트의 시각을 다른 호스트의 시각과 맞추는 데 씁니다.
클라이언트/서버 개념을 바탕으로 합니다. 자세한 내용은 Commands Reference 5권의 timedc 명령과 timed 데몬 설명을 봅니다.
영어 원문
Internet Application-Level Protocols
TCP/IP implements higher-level Internet protocols at the application program level.
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. Figure 14. Application layer of the TCP/IP Suite of Protocols
When an application needs to send data to another application on another host, the applications send the information down to the transport level protocols to prepare the information for transmission.
The official Internet application-level protocols include:
Domain Name Protocol
Exterior Gateway Protocol
File Transfer Protocol
Name/Finger Protocol
Telnet Protocol
Trivial File Transfer Protocol
TCP/IP implements other higher-level protocols that are not official Internet protocols but are commonly used in the Internet community at the application program level. These protocols include:
Distributed Computer Network (DCN) Local-Network Protocol
Remote Command Execution Protocol
Remote Login Protocol
Remote Shell Protocol
Wake On LAN Protocol
Routing Information Protocol
Time Server Protocol
TCP/IP does not provide APIs to any of these application-level protocols.
Domain Name Protocol
The Domain Name Protocol (DOMAIN) allows a host in a domain to act as a name server for other hosts within the domain.
DOMAIN uses UDP or TCP as its underlying protocol and allows a local network to assign host names within its domain independently from other domains. Normally, the DOMAIN protocol uses UDP. However, if the UDP response is truncated, TCP can be used. The DOMAIN protocol in TCP/IP supports both.
In the DOMAIN hierarchical naming system, local resolver routines can resolve Internet names and addresses using a local name resolution database maintained by the named daemon. If the name requested by the host is not in the local database, the resolver routine queries a remote DOMAIN name server. In either case, if the name resolution information is unavailable, the resolver routines attempt to use the /etc/hosts file for name resolution.
Note: TCP/IP configures local resolver routines for the DOMAIN protocol if the local file /etc/resolv.conf exists. If this file does not exist, the TCP/IP configures the local resolver routines to use the /etc/hosts database.
TCP/IP implements the DOMAIN protocol in the named daemon and in the resolver routines and does not provide an API to this protocol.
Exterior Gateway Protocol
Exterior Gateway Protocol (EGP) is the mechanism that allows the exterior gateway of an autonomous system to share routing information with exterior gateways on other autonomous systems.
Autonomous systems:
An autonomous system is a group of networks and gateways for which one administrative authority has responsibility.
Gateways are interior neighbors if they reside on the same autonomous system and exterior neighbors if they reside on different autonomous systems. Gateways that exchange routing information using EGP are said to be EGP peers or neighbors. Autonomous system gateways use EGP to provide access information to their EGP neighbors.
EGP allows an exterior gateway to ask another exterior gateway to agree to exchange access information, continually checks to ensure that its EGP neighbors are responding, and helps EGP neighbors to exchange access information by passing routing update messages.
EGP restricts exterior gateways by allowing them to advertise only those destination networks reachable entirely within that gateway's autonomous system. Thus, an exterior gateway using EGP passes along information to its EGP neighbors but does not advertise access information about its EGP neighbors outside its autonomous system.
EGP does not interpret any of the distance metrics that appear in routing update messages from other protocols. EGP uses the distance field to specify whether a path exists (a value of 255 means that the network is unreachable). The value cannot be used to compute the shorter of two routes unless those routes are both contained within a single autonomous system. Therefore, EGP cannot be used as a routing algorithm. As a result, there will be only one path from the exterior gateway to any network.
In contrast to the Routing Information Protocol (RIP), which can be used within an autonomous system of Internet networks that dynamically reconfigure routes, EGP routes are predetermined in the /etc/gated.conf file. EGP assumes that IP is the underlying protocol.
EGP message types:
The various exterior gateway protocol (EGP) message types are defined here.
- Neighbor Acquisition Request — Used by exterior gateways to request to become neighbors of each other.
- Neighbor Acquisition Reply — Used by exterior gateways to accept the request to become neighbors.
- Neighbor Acquisition Refusal — Used by exterior gateways to deny the request to become neighbors. The refusal message includes reasons for refusal, such as
out of table space. - Neighbor Cease — Used by exterior gateways to cease the neighbor relationship. The cease message includes reasons for ceasing, such as
going down. - Neighbor Cease Acknowledgment — Used by exterior gateways to acknowledge the request to cease the neighbor relationship.
- Neighbor Hello — Used by exterior gateways to determine connectivity. A gateway issues a
Hellomessage and another gateway issues anI Heard Youmessage. - I Heard You — Used by exterior gateways to reply to a
Hellomessage. TheI Heard Youmessage includes the access of the answering gateway and, if the gateway is unreachable, a reason for lack of access, such asYou are unreachable because of problems with my network interface. - NR Poll — Used by exterior gateways to query neighbor gateways about their ability to reach other gateways.
- Network Reachability — Used by exterior gateways to answer the
NR Pollmessage. For each gateway in the message, theNetwork Reachabilitymessage contains information on the addresses that gateway can reach through its neighbors. - EGP Error — Used by exterior gateways to respond to EGP messages that contain bad checksums or have fields containing incorrect values.
- TCP/IP implements the EGP protocol in the gated server command and does not provide an API to this
protocol.
File Transfer Protocol
File Transfer Protocol (FTP) allows hosts to transfer data among dissimilar hosts, as well as files between two foreign hosts indirectly.
FTP provides for such tasks as listing remote directories, changing the current remote directory, creating and removing remote directories, and transferring multiple files in a single request. FTP keeps the transport secure by passing user and account passwords to the foreign host. Although FTP is designed primarily to be used by applications, it also allows interactive user-oriented sessions.
FTP uses reliable stream delivery (TCP/IP) to send the files and uses a Telnet connection to transfer commands and replies. FTP also understands several basic file formats including NETASCII, IMAGE, and Local 8.
TCP/IP implements FTP in the ftp user command and the ftpd server command and does not provide an applications programming interface (API) to this protocol.
When creating anonymous ftp users and directories please be sure that the home directory for users ftp and anonymous (for example, /u/ftp) is owned by root and does not allow write permissions (for example, dr-xr-xr-x). The script /usr/samples/tcpip/anon.ftp can be used to create these accounts, files and directories.
Telnet Protocol
The Telnet Protocol (TELNET) provides a standard method for terminal devices and terminal-oriented processes to interface.
TELNET is commonly used by terminal emulation programs that allow you to log into a remote host. However, TELNET can also be used for terminal-to-terminal communication and interprocess communication. TELNET is also used by other protocols (for example, FTP) for establishing a protocol control channel.
TCP/IP implements TELNET in the tn, telnet, or tn3270 user commands. The telnetd daemon does not provide an API to TELNET.
TCP/IP supports the following TELNET options which are negotiated between the client and server:
- BINARY TRANSMISSION (Used in tn3270 sessions) — Transmits characters as binary data.
- SUPPRESS
GO_AHEAD(The
operating system suppresses GO-AHEAD options.) Indicates that when in effect on a connection between a sender of data and the receiver of the data, the sender need not transmit a GO_AHEAD option. If the GO_AHEAD option is not desired, the parties in the connection will probably suppress it in both directions. This action must take place in both directions independently. TIMING MARK (Recognized, but has a negative response) Makes sure that previously transmitted data has been completely processed.
EXTENDED OPTIONS LIST Extends the TELNET option list for another 256 options. Without this option, the TELNET option allows only 256 options. ECHO (User-changeable command) Transmits echo data characters already received back to the original sender. TERM TYPE Enables the server to determine the type of terminal connected to a user TELNET program. SAK (Secure Attention Key) Establishes the environment necessary for secure communication between you and the system. NAWS (Negotiate About Window Size) Enables client and server to negotiate dynamically for the window size. This is used by applications that support changing the window size.
Note: TELNET must allow transmission of eight bit characters when not in binary mode in order to implement ISO 8859 Latin code page.
Trivial File Transfer Protocol
The Trivial File Transfer Protocol (TFTP) can read and write files to and from a foreign host.
Because TFTP uses the unreliable User Datagram Protocol to transport files, it is generally quicker than FTP. Like FTP, TFTP can transfer files as either NETASCII characters or as 8-bit binary data. Unlike FTP, TFTP cannot be used to list or change directories at a foreign host and it has no provisions for security like password protection. Also, data can be written or retrieved only in public directories.
TCP/IP implements TFTP in the tftp and utftp user commands and in the tftpd server command. The utftp command is a form of the tftp command for use in a pipe. TCP/IP does not provide an API to this protocol.
For more information, see the tftp or utftp command description and the tftpd daemon description in Commands Reference, Volume 5.
Name/Finger Protocol
The Name/Finger Protocol (FINGER) is an application-level Internet protocol that provides an interface between the finger command and the fingerd daemon.
The fingerd daemon returns information about the users currently logged in to a specified remote host. If you execute the finger command specifying a user at a particular host, you will obtain specific information about that user. The FINGER Protocol must be present at the remote host and at the requesting host. FINGER uses Transmission Control Protocol ( Transmission Control Protocol) as its underlying protocol.
Note: TCP/IP does not provide an API to this protocol.
For more information, see the finger command description and the fingerd daemon description in Commands Reference, Volume 2.
Distributed Computer Network Local-Network Protocol
The gated daemon provides the Distributed Computer Network (DCN) local network protocol.
Local-Network Protocol (HELLO) is an interior gateway protocol designed for use within autonomous systems. (For more information, see Autonomous systems.) HELLO maintains connectivity, routing, and time-keeping information. It allows each machine in the network to determine the shortest path to a destination based on time delay and then dynamically updates the routing information to that destination.
For more information, see the gated daemon description in Commands Reference, Volume 2.
Remote Command Execution Protocol
The rexec user command and the rexecd daemon provide the remote command execution protocol, allowing users to run commands on a compatible remote host.
For more information, see the rexec command description and the rexecd daemon description in Commands Reference, Volume 4.
Remote Login Protocol
The rlogin user command and the rlogind daemon provide the remote login protocol, allowing users to log in to a remote host and use their terminals as if they were directly connected to the remote host.
For more information, see the rlogin command description and the rlogind daemon description in Commands Reference, Volume 4.
Remote Shell Protocol
The rsh user command and the rshd daemon provide the remote command shell protocol, allowing users to open a shell on a compatible foreign host for running commands.
For more information, see the rsh command description and the rshd daemon description in Commands Reference, Volume 4.
Wake On LAN Protocol
Wake On LAN (WOL) allows you to wake up one or more hosts that are connected to a network in suspended mode by sending a Magic Packet to the specified address or addresses on the specified subnet.
For more information on using WOL, see the wol command description in the Commands Reference, Volume 6.
Routing Information Protocol
Routing Information Protocol (RIP) and the routed and gated daemons that implement it keep track of routing information based on gateway hops and maintain kernel-routing table entries.
For more information, see the routed and gated daemons.
Time Server Protocol
The timed daemon is used to synchronize one host with the time of other hosts.
It is based on the client/server concept. For more information, see the timedc command description and the timed daemon description in Commands Reference, Volume 5.
할당 번호
일반 네트워크 환경과 호환되도록 인터넷 버전, 네트워크, 포트, 프로토콜, 프로토콜 옵션에는 잘 알려진 번호가 할당되어 있습니다. 또 기계, 네트워크, 운영 체제, 프로토콜, 서비스, 터미널에는 잘 알려진 이름이 할당되어 있습니다.
TCP/IP는 RFC 1010(Assigned Numbers)에 정의된 할당 번호와 이름을 따릅니다.
IP는 IP 머리글에 사용 중인 일반 인터네트워크 프로토콜의 버전을 나타내는 4비트 필드를 정의합니다. IP의 이 버전 번호는 10진수로 4입니다. TCP/IP가 쓰는 할당 번호와 이름의 자세한 내용은 TCP/IP에 들어 있는 /etc/protocols와 /etc/services 파일을 봅니다. 할당 번호와 이름에 관한 더 자세한 내용은 RFC 1010과 /etc/services 파일을 봅니다.
영어 원문
Assigned Numbers
For compatibility with the general network environment, well-known numbers are assigned for the Internet versions, networks, ports, protocols, and protocol options. Additionally, well-known names are also assigned to machines, networks, operating systems, protocols, services, and terminals.
TCP/IP complies with the assigned numbers and names defined in RFC 1010, Assigned Numbers.
The Internet Protocol (IP) defines a 4-bit field in the IP header that identifies the version of the general Internetwork protocol in use. For IP, this version number in decimal is 4. For details on the assigned numbers and names used by TCP/IP, see /etc/protocols and /etc/services files included with TCP/IP. For further details on the assigned numbers and names, refer to RFC 1010 and the /etc/services file.