[AIX 네트워크 관리 26] TCP/IP (20) IP over Fibre Channel, IPoIB, iSCSI 이니시에이터·타깃, SCTP
https://archive.horanglab.com/posts/aix-net-tcpip-20
핵심 정리
- IP over Fibre Channel(5200-03 이후): FC 스위치와 2Gb FC 어댑터가 필요합니다.
smit dev→ FC Adapter → FC Network Protocol Device → Enable a FC Network Device 뒤cfgmgr로fcX인터페이스를 만들고smit tcpip으로 IP를 줍니다. - IPoIB: ICM 드라이버(
smitty icm)와 IB 장치(lsdev -C에서 iba)가 필요하고, 인터페이스는 PKEY(기본 0xFFFF)·Q_Key(기본 0x1E)의 브로드캐스트 멀티캐스트 그룹에 들어가야 만들어집니다.mkiba -i ib0 -p 1 -A iba0 -a 주소 …나smitty inet, ARP는arp -t ib. - iSCSI 이니시에이터: SMIT Devices → iSCSI에서 Initiator Name과 Discovery Policy(file·odm·isns·slp, iSCSI 부팅은 odm)를 정하고
/etc/iscsi/targets나mkiscsi로 타깃을 정의한 뒤cfgmgr -l iscsi0. 인증은 CHAP(MD5)만, 타깃당 LUN 128개 검증, iSCSI 볼륨 그룹은 부팅 때 자동 활성화하지 말고 비iSCSI 장치에 걸치지 않습니다. - 성능: large send·흐름 제어·점보 프레임, rfc1323,
tcp_sendspace·tcp_recvspace262144,sb_max1048576, MTU 9000, 필요하면tcp_nagle_limit=0. 소프트웨어 타깃(devices.tmiscsw.rte)은 SMIT로 프로토콜 장치·타깃·LUN을 만들고 CHAP은 autosecrets, ACL은 access_lists에 적습니다. - SCTP(RFC 4960)는 신뢰성 있는 연결 지향이면서 메시지 지향이며, 멀티스트림·멀티호밍·쿠키 4방향 핸드셰이크(INIT, INIT-ACK, COOKIE-ECHO, COOKIE-ACK)를 씁니다. AIX는 UDP 스타일 API(
SOCK_SEQPACKET,IPPROTO_SCTP)를 지원하고 커널 확장은sctpctrl로 다룹니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (6.1에서 iSCSI 발견 정책 odm·isns·slp와 소프트웨어 타깃, SCTP 서브루틴이 더해짐) |
| 원문 | Networks and communication management — 5.3판 280289쪽, 6.1판 382395쪽 |
| 파일·파일 세트 | devices.common.ibm.fc, devices.pci.df1000f7, devices.common.IBM.ib, /etc/iscsi/targets, devices.tmiscsw.rte, /etc/tmiscsi/autosecrets, /etc/tmiscsi/access_lists, /usr/lib/libsctp.a |
| 관련 명령어 | cfgmgr, ifconfig, mkiba, arp -t ib, smitty icm, mkiscsi, lsattr, no, fsck, sctpctrl |
AIX 5L Version 5.2 with the 5200-03 Recommended Maintenance package부터 물리 파이버 채널 연결로 IP 패킷을 보낼 수 있습니다.
시스템을 IP over Fibre Channel을 쓰도록 구성하면 네트워크 활동은 이더넷이나 토큰링 어댑터를 쓰는 것과 똑같이 동작합니다.
IP over Fibre Channel을 쓰려면 시스템에 파이버 채널 스위치와, 2 Gigabit Fibre Channel Adapter for 64-bit PCI Bus나 2 Gigabit Fibre Channel PCI-X Adapter가 있어야 합니다.
또 다음 파일 세트가 설치되어 있어야 합니다.
devices.common.ibm.fcdevices.pci.df1000f7devices.pci.df1080f9devices.pci.df1000f9
영어 원문
Internet Protocol over Fibre Channel
Beginning with AIX 5L Version 5.2 with the 5200-03 Recommended Maintenance package, IP packets can be sent over a physical fibre-channel connection.
After a system is configured to use IP over Fibre Channel, its network activity will function just as if an Ethernet or Token-Ring adapter were being used.
In order to use IP over Fibre Channel, your system must have a Fibre Channel switch and either the 2 Gigabit Fibre Channel Adapter for 64-bit PCI Bus or the 2 Gigabit Fibre Channel PCI-X Adapter.
In addition, the following filesets must be installed:
devices.common.ibm.fcdevices.pci.df1000f7devices.pci.df1080f9devices.pci.df1000f9
IP over Fibre Channel 구성
IP over Fibre Channel을 켜고 구성하는 절차입니다.
먼저 Fibre Channel IP 장치 드라이버를 켜야 합니다. 켠 뒤 cfgmgr 명령을 실행해 파이버 채널 인터페이스를 만듭니다. 인터페이스가 만들어지면 네트워크 속성(IP 주소, 네트워크 마스크, 이름 서버, 게이트웨이 등)을 할당합니다.
기본으로 Fibre Channel IP 장치는 켜져 있지 않습니다. 이 장치를 켜려면 다음 단계를 따릅니다.
- 명령행에
smit dev를 입력합니다. - FC Adapter를 고릅니다.
- FC Network Protocol Device를 고릅니다.
- Enable a FC Network Device를 고릅니다.
- 켤 어댑터를 고릅니다.
- cfgmgr 명령으로 파이버 채널 인터페이스를 만듭니다.
어댑터를 켠 뒤에는 그 위에 IP를 구성해야 합니다. IP를 구성하려면 다음 단계를 따릅니다.
- 명령행에
smit tcpip을 입력합니다. - Minimum Configuration & Startup을 고릅니다.
- 구성할 인터페이스를 고릅니다. 여기서는
fcx이며 x는 인터페이스의 부 번호(minor number)입니다. - 필요한 속성을 모두 할당합니다.
IP 속성을 할당한 뒤 명령행에 다음 명령을 입력해 변경이 적용되었는지 확인합니다.
ifconfig -a
구성이 성공했다면 결과 가운데 다음과 비슷한 내용이 보입니다.
fc1: flags=e000843 <UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,PSEG,CHAIN>
inet 11.11.11.18 netmask 0xffffff00 broadcast 11.11.11.255
또 다음 명령을 실행할 수 있습니다.
ifconfig fc x
여기서 x는 인터페이스의 부 번호입니다.
영어 원문
Configuring IP over Fiber Channel
This procedure leads you through an enablement and configuration of IP over Fibre Channel.
The Fibre Channel IP device driver must first be enabled. Following the enablement, the cfgmgr command will be run to create the Fibre Channel interface. After the interface is created, the network attributes (such as its IP address, Network Mask, Nameserver, and Gateway) will be assigned.
By default, the Fibre Channel IP device is not enabled. To enable this device, follow these steps:
From the command line, type
smit dev.Select FC Adapter.
Select FC Network Protocol Device.
Select Enable a FC Network Device.
Select the adapter that is going to be enabled.
Use the cfgmgr command to create the Fibre Channel interface.
After the adapter has been enabled, IP needs to be configured over it. Follow these steps to configure IP:
From the command line, type
smit tcpip.Select Minimum Configuration & Startup.
Select the interface that you want to configure. In this case, it will be
fcx, where x is the minor number of the interface.Assign all required attributes.
After the IP attributes have been assigned, verify that the changes took place by tying the following command at the command line:
ifconfig -a
If your configuration was successful, you will see results similar to the following among the results:
fc1: flags=e000843 <UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,PSEG,CHAIN>
inet 11.11.11.18 netmask 0xffffff00 broadcast 11.11.11.255
Additionally, you can run the following command:
ifconfig fc x
where x is the minor number of the interface.
IP over InfiniBand(IPoIB)
IP 패킷을 InfiniBand(IB) 인터페이스로 보낼 수 있습니다. 이 전송은 네트워크 인터페이스로 IP 패킷을 IB 패킷에 캡슐화해 이루어집니다.
IP over IB를 쓰려면 InfiniBand 연결 관리자(ICM) 드라이버와 IB 장치를 시스템에 적어도 하나 설치하고 구성해야 합니다. IB 장치가 이미 설치되어 있는지 보려면 lsdev -C 출력을 grep으로 iba를 걸러 봅니다. IB 인터페이스가 든 파일 세트 이름은 devices.common.IBM.ib입니다. devices.chrp.IBM.lhca 파일 세트는 지금 지원되는 어댑터 파일 세트의 예입니다.
ICM 드라이버 구성은 InfiniBand Communication Manager 드라이버 구성을 봅니다.
InfiniBand 인터페이스(IB IF)를 만들려면 IB IF가 사용자가 준 PKEY(주지 않으면 기본 PKEY = 0xFFFF)와 사용자가 준 Q_Key(주지 않으면 기본 Q_Key = 0x1E)로 기존 broadcast-multicast 그룹에 들어갈 수 있어야 합니다. broadcast-multicast 그룹은 인터페이스가 브로드캐스트와 ARP 패킷을 보내려면 들어가야 하는 멀티캐스트 그룹입니다. 그런 그룹이 없거나 인터페이스가 만들 수 없으면 IB IF 생성이 실패합니다.
IB IF는 명령행이나 SMIT로 만들거나 바꿀 수 있습니다. IB IF를 만드는 데 필요한 매개변수는 다음과 같습니다.
- 인터페이스 이름
- 어댑터 이름
- 포트 번호
- 인터페이스 IP 주소
IB IF를 바꾸는 매개변수는 다음과 같습니다.
- 인터넷 주소
- 네트워크 마스크
- MTU 크기(원하는 MTU에서 IB 헤더 4바이트를 뺀 값)
- 상태
- 송수신 큐 크기(기본 4000)
- 멀티캐스트 Queue Key
- 슈퍼 패킷 켜기·끄기
명령행에서 IB IF를 만드는 명령의 예입니다.
$ /usr/sbin/mkiba -i ib0 -p 1 -A iba0 -a 1.2.3.8 [-P -1 -S "up" -m "255.255.254.0" -M 2044]
각 옵션의 뜻은 다음과 같습니다.
| 옵션 | 뜻 |
|---|---|
-M 2044 |
최대 전송 단위(MTU) |
-m "255.255.254.0" |
네트워크 마스크 |
-p 1 |
포트 번호(주지 않으면 1) |
-A iba0 |
IB 장치 이름 |
-a 1.2.3.8 |
인터페이스 IP 주소 |
-i ib0 |
인터페이스 이름 |
-P -1 |
파티션 키(주지 않으면 PKEY). 인터페이스를 만든 뒤에는 PKEY를 바꿀 수 없으며, 기본이 아닌 PKEY는 네트워크 관리자에게 받아야 합니다. |
-S "up" |
인터페이스 상태 |
-q 8000 |
수신과 송신 큐 크기(각각) |
-Q 0x1E |
멀티캐스트 그룹에 할당된 멀티캐스트 Queue Key(주지 않으면 Q_KEY = 0x1E) |
-k "on" |
슈퍼 패킷. 인터페이스의 TCP/IP MTU를 64K로 할 수 있게 합니다. 동작하려면 원격 호스트에서도 켜야 합니다. |
SMIT에서 IB IF를 만드는 명령의 예입니다.
$ smitty inet
Network Interface Selection 메뉴가 나오면 다음 절차를 따릅니다.
- Add a Network Interface나 Change / Show Characteristics of a Network Interface를 고릅니다. Add a Network Interface 메뉴가 나옵니다.
- Add a Network Interface 메뉴에서 Add an IB Network Interface를 고릅니다. Add an IB Network Interface 메뉴가 나옵니다.
- Add an IB Network Interface 메뉴에서 필요한 것을 바꾸고 Enter를 누릅니다.
영어 원문
Internet Protocol over InfiniBand (IPoIB)
Internet protocol (IP) packets can be sent over an InfiniBand (IB) interface. This transport is accomplished by encapsulating IP packets of IB packets using a network interface.
In order to use IP over IB, you must install and configure the InfiniBand connection manager (ICM) driver and at least one IB device in the system. To see if an IB device is already installed, run the lsdev -C | grep iba command. The name of the fileset containing the IB interface is: devices.common.IBM.ib. The devices.chrp.IBM.lhca fileset is an example of a currently supported adapter fileset.
To configure an ICM driver, refer to Configuring an InfiniBand Communication Manager driver.
In order to create the InfiniBand interface (IB IF), the IB IF must be able to join an existing broadcast-multicast group with a user-provided PKEY (or a default PKEY = 0xFFFF is used if the user did not provide one) and a user provided Q_Key (or a default Q_Key = 0x1E is used if the user did not provide one). A broadcast-multicast group is a multicast group that the interface must join in order to send broadcast and ARP packets. If such a broadcast-multicast group does not exist, or can not be created by the interface, the creation of the IB IF will fail.
You can create or change an IB IF using the command-line interface or the SMIT user interface. The parameters required to create an IB IF are the following:
interface name
adapter name
port number
interface IP address
The following parameters are for changing the IB IF:
internet address
network mask
MTU size (equal to the MTU desired, less 4 bytes for the IB header)
state
Send and Receive queue size (default is 4000)
Multicast Queue Key
Super packet on or off
The following is an example of the command used to create an IB IF from the command line:
$ /usr/sbin/mkiba -i ib0 -p 1 -A iba0 -a 1.2.3.8 [-P -1 -S "up" -m "255.255.254.0" -M 2044]
where:
-M 2044— Maximum transmit unit.-m "255.255.254.0"— Net mask.-p 1— Port number (defaults to 1 if not provided).-A iba0— IB device name.-a 1.2.3.8— IF IP address.-i ib0— Interface name.-P -1— Partition key (defaults to PKEY if not provided. After the interface is created, PKEY cannot be changed; the user must obtain a non-default PKEY from the network administrator.)-S "up"— Interface state.-q 8000— Receive and Transmit Queues size (each).-Q 0x1E— Multicast Queue Key assigned to the Multicast group (defaults toQ_KEY= 0x1E if not provided).-k "on"— Superpacket will allow the interface TCP/IP MTU to be 64K. It has to be enabled in the remote host also to be able to work.
The following is an example of the command used to create an IB IF from the SMIT user interface:
$ smitty inet
After the Network Interface Selection menu is displayed, follow this procedure:
Select Add a Network Interface or Change / Show Characteristics of a Network Interface. The Add a Network Interface menu displays.
In the Add a Network Interface menu, select Add an IB Network Interface. The Add an IB Network Interface menu displays.
In the Add an IB Network Interface menu, make the necessary changes and press Enter.
ARP 항목 만들기·보기·더하기·지우기와 ARP 타이머 바꾸기
ARP(Address Resolution Protocol) 항목이 있으면 같은 멀티캐스트 그룹에 있지 않은 인터페이스끼리도 통신할 수 있습니다.
ARP 항목은 arp -t ib 명령으로 직접 만들 수 있습니다.
모든 ARP 항목을 보려면 arp -t ib -a 명령을 실행합니다. 특정 개수의 ARP 항목만 보려면 개수를 지정할 수 있습니다. 예를 들어 arp -t ib -a 5는 ARP 항목 5개를 보여 줍니다.
다음 명령은 ARP 항목을 더합니다.
$ arp -t ib -s IB interface name dlid < 16 bits DLID > dqp
16 bits hex Destination Queue Pair Number
ipaddr < Destination IP Address >
여기서
- DLID: Destination Local ID입니다.
- DGID: Destination Global ID입니다.
다음 명령은 ARP 항목을 지웁니다.
$ arp -t ib -d IP Address
다음은 완료된 ARP 항목과 완료되지 않은 ARP 항목의 타이머 값을 바꿉니다. 이 값은 일정 시간이 지난 뒤 ARP 항목을 지우는 데 씁니다.
arp -t ib -i < number in complete minutes to remove incomplete ARP entries >
-c < number in complete minutes to remove complete ARP entries >
지금 완료되지 않은 ARP 항목을 지우는 기본 시간은 3분입니다. 완료된 ARP 항목의 기본 시간은 24시간입니다. 값을 바꿔야 한다면, 명령을 실행하면 지금 구성된(또는 정의 상태인) 모든 인터페이스의 값만 바뀝니다. 새 인터페이스를 구성하면 명령을 다시 실행해야 합니다. 값은 ODM에서도 바뀝니다.
ifconfig 명령으로 특정 인터페이스 하나의 값을 동적으로 바꿀 수 있습니다.
To change the incomplete ARP entry timer
ifconfig ib0 inc_timer 4
ifconfig ib0 com_timer 60
영어 원문
Creating, displaying, adding, deleting ARP entries and modifying ARP timers
An Address Resolution Protocol (ARP) entry allows an interface to communicate with another interface even if they are not in the same multicast group.
An ARP entry can be created manually using the arp -t ib command.
To display all ARP entries, run the$ arp -t ib -a command. If you want to display a specific number of ARP entries, you can specify the number. For example, $ arp -t ib -a 5 displays 5 ARP entries.
The following command adds an ARP entry:
$ arp -t ib -s IB interface name dlid < 16 bits DLID > dqp
16 bits hex Destination Queue Pair Number
ipaddr < Destination IP Address >
where:
- DLID — is the Destination Local ID.
- DGID — is the Destination Global ID.
The following command removes an ARP entry:
$ arp -t ib -d IP Address
The following modify the ARP entry’s timer values for complete and incomplete ARP entries. These values are used to remove the ARP entries after a period of time:
arp -t ib -i < number in complete minutes to remove incomplete ARP entries >
-c < number in complete minutes to remove complete ARP entries >
The current default time for incomplete ARP entries to be removed is 3 minutes. For complete ARP entries, the default time is 24 hours. If the values need to be changed, the execution of the command will
change only the values for all the current interfaces configured (or in defined state). If new interfaces are configured, the command must be executed again. The values are also changed in ODM.
The values can be changed dynamically to one specific interface by running the ifconfig command:
To change the incomplete ARP entry timer
ifconfig ib0 inc_timer 4
ifconfig ib0 com_timer 60
InfiniBand 인터페이스 매개변수 바꾸기
IB IF의 매개변수는 SMIT나 명령행 명령으로 바꿉니다.
SMIT로 IB IF의 매개변수를 바꾸려면 다음과 같이 합니다.
smitty inet명령을 실행합니다. Network Interface Selection 메뉴가 나옵니다.- Network Interface Selection 메뉴에서 Change / Show Characteristics of a Network Interface를 고릅니다. Available Network Interfaces 메뉴가 나옵니다.
- Available Network Interfaces 메뉴에서 InfiniBand Interface를 고릅니다. Change / Show an IB Interface 메뉴가 나옵니다.
- 원하는 매개변수를 바꿉니다.
명령행에서 IB IF 매개변수를 바꾸려면 ifconfig 명령을 실행합니다. 다음 명령은 명령행에서 IB IF 매개변수를 바꿉니다.
$ ifconfig ib0 [ib_port port number mtu maximum transmission unit p_key
16 bits hex partition key ib_adapter InfiniBand adapter name netmask
dotted decimals ]
$ ifconfig ib0 inc_timer 3 com_timer 60
inc_timer는 완료되지 않은 ARP 항목이 만료되는 시간(분)입니다. 기본값은 2분입니다.com_timer는 완료된 ARP 항목이 만료되는 시간(분)입니다. 기본값은 24시간입니다.
영어 원문
Changing the parameters of an InfiniBand interface
To change the parameters of an IB IF, use the SMIT user interface or command-line commands.
To change the parameters of an IB IF using SMIT:
Run the
$smitty inet command. The Network Interface Selection menu displays.In the Network Interface Selection menu, select Change / Show Characteristics of a Network Interface. The Available Network Interfaces menu displays.
In the Available Network Interfaces menu, select InfiniBand Interface. The Change / Show an IB Interface menu displays.
Change the desired parameters.
To change the IB IF parameters at the command line, run the $ ifconfig command. The following command changes the IB IF parameters from the command line:
$ ifconfig ib0 [ib_port port number mtu maximum transmission unit p_key
16 bits hex partition key ib_adapter InfiniBand adapter name netmask
dotted decimals ]
$ ifconfig ib0 inc_timer 3 com_timer 60
inc_timeris the time in minutes that an incomplete ARP entry will expire. Default is 2 mintues.com_timeris the time in minutes that a complete ARP entry will expire. Default is 24 hours.
InfiniBand Communication Manager 드라이버 구성
InfiniBand Communication Manager를 구성하는 절차입니다.
smitty icm명령을 실행합니다. InfiniBand Communication Manager 메뉴가 나옵니다.- InfiniBand Communication Manager 메뉴에서 Add an InfiniBand Communication Manager를 고릅니다.
- Add an InfiniBand Communication Manager 메뉴에서 Add an InfiniBand Communication Manager를 고릅니다. Name of IB Communication Manager to Add 메뉴가 나옵니다.
- Name of IB Communication Manager to Add 메뉴에서 management icm InfiniBand를 고릅니다.
- 기본값을 쓰거나 필요한 매개변수를 바꾼 뒤 Enter를 누릅니다.
영어 원문
Configuring an InfiniBand Communication Manager driver
Use this procedure to configure an InfiniBand Communication Manager.
Run the
$smitty icm command. The InfiniBand Communication Manager menu displays.In the InfiniBand Communication Manager menu, select Add an InfiniBand Communication Manager.
In the Add an InfiniBand Communication Manager menu, select Add an InfiniBand Communication Manager. The Name of IB Communication Manager to Add menu displays.
In the Name of IB Communication Manager to Add menu, select management icm InfiniBand.
Use the defaults or change any necessary parameters, and then press Enter.
iSCSI 소프트웨어 이니시에이터와 소프트웨어 타깃
iSCSI 소프트웨어 이니시에이터는 AIX가 이더넷 네트워크 어댑터에서 TCP/IP로 저장 장치에 접근하게 합니다. (6.1) iSCSI 소프트웨어 타깃은 AIX가 RFC 3720에 정의된 iSCSI 프로토콜로 로컬 저장소를 내보내 다른 iSCSI 이니시에이터가 접근하게 합니다.
흔히 SAN over IP 기술이라고 부르는 iSCSI 기술을 쓰면 IP 네트워크 위에 스토리지 영역 네트워크를 둘 수 있습니다. iSCSI는 SCSI 정보를 TCP/IP로 캡슐화해 이더넷과 기가비트 이더넷 네트워크로 나를 수 있게 하는 개방형 표준 기반 방식입니다. iSCSI를 쓰면 기존 이더넷 네트워크로 위치와 전혀 관계없이 SCSI 명령과 데이터를 옮길 수 있습니다. iSCSI 솔루션은 다음처럼 서로 다르지만 긴밀히 관련된 구성 요소를 씁니다.
- 이니시에이터: 클라이언트에 있는 장치 드라이버입니다. SCSI 명령을 캡슐화해 IP 네트워크로 대상 장치까지 보냅니다.
- 타깃 소프트웨어: IP 네트워크로 캡슐화된 SCSI 명령을 받습니다. 구성 지원과 스토리지 관리 지원도 제공할 수 있습니다.
- 타깃 하드웨어: 내장 저장소가 있는 스토리지 어플라이언스일 수 있습니다. 자체 내부 저장소가 없는 게이트웨이나 브리지 제품일 수도 있습니다.
영어 원문
iSCSI software initiator and software target
The iSCSI software initiator enables AIX to access storage devices using TCP/IP on Ethernet network adapters. The iSCSI software target enables AIX to export local storage to be accessed by other iSCSI initiators using the iSCSI protocol that is defined in the RFC 3720.
The use of iSCSI technology, often referred to as SAN over IP technology, allows the deployment of storage area networking over an IP network. iSCSI is an open, standards-based approach by which SCSI information is encapsulated by TCP/IP to allow its transport over Ethernet and gigabit Ethernet networks. iSCSI allows an existing Ethernet network to transfer SCSI commands and data with total location independence. iSCSI solutions use the following different, but integrally related, components:
Initiators These are the device drivers that reside on the client. They encapsulate SCSI commands and route them over the IP network to the target device.
Target software
The software receives the encapsulated SCSI commands over the IP network. The software can also provide configuration support and storage-management support.
- Target hardware The hardware can be a storage appliance that contains embedded storage. The hardware can also be a gateway or bridge product that contains no internal storage of its own.
iSCSI 소프트웨어 이니시에이터 구성
소프트웨어 이니시에이터는 다음 절차처럼 SMIT로 구성합니다.
Devices를 고릅니다.
iSCSI를 고릅니다.
Configure iSCSI Protocol Device를 고릅니다.
Change / Show Characteristics of an iSCSI Protocol Device를 고릅니다.
Initiator Name 값이 올바른지 확인합니다. Initiator Name 값은 iSCSI 타깃이 로그인 때 씁니다.
참고: 소프트웨어를 설치할 때 기본 이니시에이터 이름이 할당됩니다. 사용자가 로컬 네트워크 이름 규칙에 맞게 바꿀 수 있습니다.
Maximum Targets Allowed 필드는 구성할 수 있는 iSCSI 타깃의 최대 수입니다. 이 수를 줄이면 구성 중 iSCSI 프로토콜 드라이버에 미리 할당하는 네트워크 메모리 양도 줄어듭니다.
(6.1) Discovery Policy 필드로 iSCSI 타깃을 발견하는 방법을 구성합니다. iSCSI 이니시에이터 소프트웨어는 다음 4가지 발견 방법을 지원합니다.
file: 타깃 정보가 구성 파일에 저장됩니다.odm: 타깃 정보가 ODM(Object Data Manager) 객체에 저장됩니다. iSCSI 디스크를 부트 디스크나 rootvg 부팅의 일부로 쓸 때는 odm 발견 방법을 써야 합니다. Adding a statically-discovered iSCSI target into ODM을 봅니다.isns: 타깃 정보가 iSNS(Internet Storage Name Service) 서버에 저장되고 iSCSI 이니시에이터 구성 중에 자동으로 가져옵니다.slp: 타깃 정보가 SLP(Service Location Protocol) 서비스 에이전트나 디렉터리 에이전트에 저장되고 iSCSI 이니시에이터 구성 중에 자동으로 가져옵니다.
소프트웨어 이니시에이터를 구성한 뒤 다음을 합니다.
- 발견 정책이 file이면
/etc/iscsi/targets파일을 편집해 장치 구성 중에 필요한 iSCSI 타깃을 넣습니다. 파일에서 주석이 아닌 각 줄이 iSCSI 타깃 하나를 나타냅니다. 자세한 정보는 Files Reference의 targets File을 봅니다. 발견 정책이 odm이면 mkiscsi 명령이나 smit 화면으로 ODM에 타깃 정의를 만듭니다. 자세한 정보는 Adding a statically-discovered iSCSI target into ODM을 봅니다. 발견 정책이 isns나 slp면 iSNS나 SLP 서버가 올바르게 구성되어 있고 iSCSI 이니시에이터가 접근할 수 있는지 확인합니다. iSCSI 장치를 구성하려면 올바르게 구성된 네트워크 인터페이스로 iSCSI 타깃에 닿을 수 있어야 합니다. iSCSI 소프트웨어 이니시에이터는 10/100 이더넷 LAN에서도 동작하지만, 다른 네트워크 트래픽과 분리된 기가비트 이더넷 네트워크에서 쓰도록 설계되었습니다. - 타깃을 정의한 뒤 다음 명령을 입력합니다.
cfgmgr -l iscsi0
이 명령은 소프트웨어 이니시에이터 드라이버를 다시 구성합니다.
이 명령으로 드라이버가 /etc/iscsi/targets 파일에 나열된 타깃과 통신을 시도하고, 찾은 타깃의 LUN마다 새 hdisk를 정의합니다. 자세한 정보는 Commands Reference, Volume 1의 cfgmgr 명령 설명을 봅니다.
참고: 알맞은 디스크가 정의되지 않으면 이니시에이터, 타깃, iSCSI 게이트웨이의 구성이 올바른지 검토한 뒤 cfgmgr 명령을 다시 실행합니다.
iSCSI 소프트웨어 이니시에이터 장치의 매개변수를 더 구성하려면 SMIT를 다음과 같이 씁니다.
- Devices를 고릅니다.
- Fixed Disk를 고릅니다.
보통의 소프트웨어 이니시에이터 장치는 다음과 비슷하게 보입니다.
hdisk2 Available Other iSCSI Disk Drive
iSCSI 디스크가 command tag queuing과 제어 바이트의 NACA=1을 지원하면 디스크의 큐 깊이 설정을 더 큰 값으로 바꾸는 것을 생각합니다. 더 큰 값이 장치 성능을 높이는 데 도움이 될 수 있습니다. 최적 큐 깊이 설정은 드라이브의 실제 큐 크기를 넘을 수 없습니다. 큐 깊이를 드라이브의 큐 크기보다 크게 설정하면 성능이 떨어질 수 있습니다. 드라이브의 큐 크기는 드라이브 문서를 봅니다.
영어 원문
Configuring iSCSI software initiator
The software initiator is configured using SMIT as shown in this procedure.
Select Devices.
Select iSCSI.
Select Configure iSCSI Protocol Device.
Select Change / Show Characteristics of an iSCSI Protocol Device
Verify that the Initiator Name value is correct. The Initiator Name value is used by the iSCSI Target during login.
Note: A default initiator name is assigned when the software is installed. This initiator name can be changed by the user to match local network naming conventions.
The Maximum Targets Allowed field corresponds to the maximum number of iSCSI targets that can be configured. If you reduce this number, you also reduce the amount of network memory pre-allocated for the iSCSI protocol driver during configuration.
Configure the iSCSI discovery method by using the Discovery Policy field to discover the iSCSI targets. The iSCSI initiator software supports the following 4 discovery methods:
file The information about targets is stored in a configuration file.
odm The information about targets is stored in the Object Data Manager (ODM) objects. When using an iSCSI disk as a boot disk or as part of the rootvg boot, the odm discovery method must be used. See Adding a statically-discovered iSCSI target into ODM. isns The information about targets is stored on an Internet Storage Name Service (iSNS) server and automatically retrieved during the iSCSI initiator configuration. slp The information about targets is stored on a Service Location Protocol (SLP) service agent or directory agent and automatically retrieved during the iSCSI initiator configuration.
After the software initiator is configured, do the following:
If the discovery policy is file, edit the
/etc/iscsi/targetsfile to include the iSCSI targets needed during device configuration. Each uncommented line in the file represents an iSCSI target. For more information, see targets File in Files Reference. If the discovery policy is odm, use the mkiscsi command or smit panels to create the target definitions in ODM. For more information, see Adding a statically-discovered iSCSI target into ODM. If the discovery policy is isns or slp, ensure that the iSNS or SLP server is properly configured and accessible by the iSCSI initiator. iSCSI device configuration requires that the iSCSI targets can be reached through a properly configured network interface. Although the iSCSI software initiator can work using a 10/100 Ethernet LAN, it is designed for use with a gigabit Ethernet network that is separate from other network traffic.After defining the targets, type the following command:
cfgmgr -l iscsi0
This reconfigures the software initiator driver.
This command causes the driver to attempt to communicate with the targets listed in the /etc/iscsi/targets file, and to define a new hdisk for each LUN on the targets that are found. For more information, see the cfgmgr command description in Commands Reference, Volume 1.
Note: If the appropriate disks are not defined, review the configuration of the initiator, the target, and any iSCSI gateways to ensure correctness, and then rerun the cfgmgr command.
If you want to further configure parameters for iSCSI software initiator devices, use SMIT as follows:
Select Devices.
Select Fixed Disk.
A typical software initiator device look similar to the following:
hdisk2 Available Other iSCSI Disk Drive
If the iSCSI disk supports command tag queuing and NACA=1 in the control byte, consider changing the queue depth setting of the disk to a larger value. A larger value may help improve device performance. The optimal queue depth setting cannot exceed the actual queue size on the drive. Setting the queue depth to a value larger then the drive's queue size would possibly degrade performance. To determine the drive's queue size consult the drive's documentation.
iSCSI 소프트웨어 타깃 구성(6.1)
iSCSI 소프트웨어 타깃 드라이버는 AIX가 iSCSI 타깃 장치 하나나 여럿으로 동작하게 합니다. iSCSI 타깃 드라이버는 iSCSI 프로토콜과 TCP/IP로 AIX에 연결하는 iSCSI 이니시에이터에게 로컬 디스크, 논리 볼륨, 로컬 파일을 내보냅니다.
각 타깃 장치에는 iSCSI Qualified Name과, 가상 iSCSI 타깃에 연결하는 이니시에이터가 쓸 수 있는 LUN(논리 장치 번호) 묶음이 있습니다. 각 타깃 장치에 대해 타깃 드라이버가 들어오는 연결을 받는 데 쓸 네트워크 인터페이스와 TCP/IP 포트 번호를 지정할 수 있습니다.
참고: iSCSI 타깃 파일 세트가 설치되어 있어야 합니다. 파일 세트 이름은 devices.tmiscsw.rte이며 AIX Expansion pack에 들어 있습니다.
iSCSI 타깃 드라이버를 구성하려면 다음 단계를 마칩니다.
다음 SMIT 경로로 iSCSI 타깃 드라이버 인스턴스 하나를 만듭니다. 이 인스턴스는 다른 iSCSI 객체를 담는 컨테이너 역할을 합니다. Devices > iSCSI > iSCSI Target Device > iSCSI Target Protocol Device > Add an iSCSI Target Protocol Device
iSCSI 타깃 드라이버가 할당하는 가상 iSCSI 타깃마다 iSCSI 타깃 장치를 하나씩 만듭니다. 다음 SMIT 경로로 각 iSCSI 타깃 장치를 만듭니다. Devices > iSCSI > iSCSI Target Device > iSCSI Targets > Add an iSCSI Targets
다음 SMIT 경로로 각 타깃 장치에 LUN을 하나 이상 정의합니다.
Devices > iSCSI > iSCSI Target Device > iSCSI Target LUNs참고: LUN은 가상 타깃에 연결하는 이니시에이터가 접근할 수 있습니다. iSCSI 타깃에서 각 LUN은 미리 정의한 논리 볼륨, 물리 볼륨, 로컬 파일 시스템에 미리 만든 파일 가운데 하나와 연결할 수 있습니다. iSCSI 타깃 논리 장치와 연결된 물리 볼륨은 iSCSI 타깃 드라이버를 실행하는 AIX 시스템이 다른 방법으로 쓸 수 없습니다.
이 단계로 보통 구성이 끝납니다. 그러나 CHAP(Challenge Handshake Authentication Protocol)을 쓰거나, 어떤 이니시에이터가 어떤 LUN에 접근할 수 있는지 ACL(Access Control List)로 나타낸다면 타깃 구성을 마치는 단계가 하나 더 필요합니다.
- 이니시에이터의 CHAP 인증을 쓴다면
/etc/tmiscsi/autosecrets파일을 편집해 이니시에이터가 로그인하는 데 쓰는 비밀을 더합니다./etc/tmiscsi/autosecrets파일에는 타깃마다 항목이 하나씩 있습니다. 각 항목의 형식은target_name chap_name chap_secret입니다. - 어떤 이니시에이터가 어떤 LUN에 접근할 수 있는지 ACL로 나타낸다면
/etc/tmiscsi/access_lists파일을 편집해 타깃마다 항목을 하나씩 더합니다. 각 항목의 형식은 target_name이나 "target_name과 lun_name을 세로 막대로 이은 것" 뒤에iSCSI_name, iSCSI_name, ...을 적는 것입니다.
관련 정보: /etc/tmiscsi/autosecrets, /etc/tmiscsi/access_lists, /etc/tmiscsi/isns_servers
영어 원문
Configuring the iSCSI software target
The iSCSI software target driver enables AIX to act as one iSCSI target device or as several iSCSI target devices. The iSCSI target driver exports local disks, logical volumes, or local files to iSCSI initiators that connect to AIX using the iSCSI protocol and TCP/IP.
Each target device has an iSCSI Qualified Name and a set of logical unit numbers (LUNs) that are available to initiators that connect to the virtual iSCSI target. For each target device, you can specify which network interface and which TCP/IP port numbers the target driver can use to accept incoming connections.
Note: You need to have the iSCSI target fileset installed. The fileset name is devices.tmiscsw.rte and the fileset is contained on the AIX Expansion pack.
To configure an iSCSI target driver, complete the following steps:
- Create a single instance of the iSCSI target driver using the following SMIT path. This instance acts as a container for the other iSCSI objects. Devices > iSCSI > iSCSI Target Device > iSCSI Target Protocol Device > Add an iSCSI Target
Protocol Device
Create one iSCSI target device for each virtual iSCSI target that is allocated by the iSCSI target driver. Use the following SMIT path to create each iSCSI target device: Devices > iSCSI > iSCSI Target Device > iSCSI Targets > Add an iSCSI Targets
Define one or more LUNs for each target device using the following SMIT path:
Note: The LUNs are accessible by initiators that connect to a virtual target. On the iSCSI target, each LUN can be associated with either a previously defined logical volume, with a physical volume, or with a file previously created on a local file system. Any physical volume that is associated with an iSCSI target logical unit cannot be used in any other way by the AIX system that is running the iSCSI target driver.
Devices > iSCSI > iSCSI Target Device > iSCSI Target LUNs
This step generally completes the configuration. However, if you are using Challenge Handshake Authentication Protocol (CHAP), or if you are using Access Control Lists (ACLs) to indicate which initiators can access which LUNs, an additional step is required to complete the target configuration.
If you are using CHAP authentication of the initiators, edit the
/etc/tmiscsi/autosecretsfile and add the secrets used by the initiators to log in. The/etc/tmiscsi/autosecretsfile contains one entry per target. Each entry has the following format:target_namechap_namechap_secretIf you are using ACLs to indicate which initiators can access which LUNs, edit the
/etc/tmiscsi/access_listsfile and add one entry per target. Each entry has the following format:target_name|lun_nameiSCSI_name,iSCSI_name,...
Related information
/etc/tmiscsi/autosecrets /etc/tmiscsi/access_lists /etc/tmiscsi/isns_servers
iSCSI 소프트웨어 이니시에이터 고려 사항
iSCSI 소프트웨어 이니시에이터를 다룰 때 다음을 생각합니다.
타깃 발견: (6.1) iSCSI 소프트웨어 이니시에이터는 다음 4가지 타깃 발견 방식을 지원합니다.
file: 텍스트 파일로 각 타깃을 구성합니다.odm: ODM 객체로 각 타깃을 구성합니다. iSCSI 디스크를 부트 디스크나 rootvg 부팅의 일부로 쓸 때는 odm 발견 방법을 써야 합니다.isns: 각 타깃이 iSNS 서버 하나 이상에 등록됩니다.slp: 각 타깃이 SLP 서비스 에이전트나 디렉터리 에이전트 하나 이상에 등록됩니다.
(5.3판은 "iSCSI 인바운드 타깃 발견을 구현하지 않으며 각 타깃은 텍스트 파일로 구성한다", "IPv6 주소 지정은 구현되지 않았다"고 적었습니다.)
iSCSI 인증: 이니시에이터 인증 구성에는 CHAP(MD5)만 쓸 수 있습니다. 타깃 인증은 구현되지 않았습니다.
구성된 LUN 수: iSCSI 소프트웨어 이니시에이터로 검증한 최대 LUN 수는 iSCSI 타깃당 128개입니다. 소프트웨어 이니시에이터는 iSCSI 타깃마다 TCP 연결 하나를 씁니다(iSCSI 세션당 연결 하나). 이 TCP 연결을 한 타깃에 구성된 모든 LUN이 함께 씁니다. 소프트웨어 이니시에이터의 TCP 소켓 송신과 수신 공간은 모두 시스템 소켓 버퍼 최댓값으로 설정됩니다. 최댓값은
sb_max네트워크 옵션으로 정하며 기본값은 1 MB입니다.볼륨 그룹: iSCSI 장치로 볼륨 그룹을 만들 때 구성 문제와 오류 로그 항목을 피하려면 다음 지침을 따릅니다.
- iSCSI 장치로 만든 볼륨 그룹은 재부팅 뒤 비활성 상태가 되도록 구성합니다. iSCSI 장치가 구성된 뒤 iSCSI 기반 볼륨 그룹을 직접 활성화합니다. 그런 다음 연결된 파일 시스템을 마운트합니다. 볼륨 그룹은 iSCSI 소프트웨어 드라이버와 다른 부팅 단계에서 활성화됩니다. 그래서 부팅 과정에서 iSCSI 볼륨 그룹을 활성화할 수 없습니다.
- 볼륨 그룹을 iSCSI가 아닌 장치에 걸치지 않습니다.
I/O 실패: iSCSI 타깃 장치와의 연결이 끊기면 I/O 실패가 일어납니다. I/O 실패와 파일 시스템 손상을 막으려면, 활성 iSCSI 타깃과의 연결을 오래 끊을 일을 하기 전에 모든 I/O 활동을 멈추고 iSCSI 기반 파일 시스템을 마운트 해제합니다. 응용 프로그램이 iSCSI 장치로 I/O를 하려는 동안 iSCSI 타깃과의 연결이 끊기면 결국 I/O 오류가 일어납니다. 밑의 iSCSI 장치가 계속 사용 중이라 iSCSI 기반 파일 시스템을 마운트 해제하지 못할 수도 있습니다. 활성 iSCSI 타깃과의 연결이 끊겨 I/O 실패가 일어나면 파일 시스템 정비를 해야 합니다. 파일 시스템 정비는 fsck 명령으로 합니다.
관련 정보: Adding a statically-discovered iSCSI target into ODM
iSCSI 보안 고려 사항
/etc/iscsi 디렉터리, /etc/tmiscsi 디렉터리와 그 안의 파일은 파일 권한과 소유권으로 권한 없는 사용자에게서 보호됩니다.
CHAP 비밀은 /etc/iscsi/targets 파일과 /etc/tmiscsi/autosecrets 파일에 평문으로 저장됩니다.
참고: 이 파일들의 원래 파일 권한과 소유권을 바꾸지 않습니다.
iSCSI 성능 고려 사항
iSCSI에서 최고 성능을 얻으려면 다음 구성을 설정합니다.
- AIX 기가비트 이더넷 어댑터와 iSCSI 타깃 인터페이스의 TCP Large Send, TCP 송수신 흐름 제어, 점보 프레임 기능을 켭니다.
- AIX 시스템에서 iSCSI I/O 처리량이 최대가 되도록 네트워크 옵션과 인터페이스 매개변수를 다음과 같이 조정합니다.
- RFC 1323 네트워크 옵션을 켭니다.
tcp_sendspace,tcp_recvspace,sb_max,mtu_size네트워크 옵션과 네트워크 인터페이스 옵션을 알맞은 값으로 설정합니다. iSCSI 소프트웨어 이니시에이터의 최대 전송 크기는 256 KB입니다.tcp_sendspace와tcp_recvspace의 시스템 최댓값이 262144바이트로 설정되어 있다고 하면, 기가비트 이더넷 인터페이스를 구성하는 ifconfig 명령은 다음과 같을 수 있습니다.
ifconfig en2 10.1.2.216 mtu 9000 tcp_sendspace 262144 tcp_recvspace 262144
sb_max네트워크 옵션을 적어도 524288, 되도록 1048576으로 설정합니다.mtu_size를 9000으로 설정합니다.- 일부 iSCSI 타깃은 최고 성능을 위해 TCP Nagle 알고리즘을 꺼야 합니다. no 명령으로
tcp_nagle_limit매개변수를0으로 설정하면 Nagle 알고리즘이 꺼집니다.
참고: 네트워크 옵션 설정은 Commands Reference, Volume 4의 no 명령 설명을 봅니다.
자세한 정보와 추가 조정 매개변수는 TCP and UDP performance tuning을 봅니다.
영어 원문
iSCSI software initiator considerations
Consider the following when dealing with iSCSI software initiators.
- Target discovery The iSCSI software initiator supports the following 4 forms of target discovery:
file A text file is used to configure each target.
odm ODM objects are used to configure each target. When using an iSCSI disk as a boot disk or as part of the rootvg boot, the odm discovery method must be used.
isns Each target is registered in one or more Internet Storage Name Service (iSNS) servers.
slp Each target is registered in one or more Service Location Protocol (SLP) service agents or directory agents.
iSCSI Authentication Only CHAP (MD5) can be used to configure Initiator authentication. Target authentication is not implemented.
Number of configured LUNs The maximum number of configured LUNs tested using the iSCSI software initiator is 128 per iSCSI target. The software initiator uses a single TCP connection for each iSCSI target (one connection per iSCSI session). This TCP connection is shared among all LUNs that are configured for a target. The software initiator's TCP socket send and receive space are both set to the system socket buffer maximum. The maximum is set by the
sb_maxnetwork option. The default is 1 MB.Volumes Groups To avoid configuration problems and error log entries when you create volume groups using iSCSI devices, follow these guidelines: – Configure volume groups that are created using iSCSI devices to be in an inactive state after reboot. After the iSCSI devices are configured, manually activate the iSCSI-backed volume groups. Then, mount any associated file systems. Volume groups are activated during a different boot phase than the iSCSI software driver. For this reason, it is not possible to activate iSCSI volume groups during the boot process. – Do not span volume groups across non-iSCSI devices.
I/O Failures If connectivity to iSCSI target devices is lost, I/O failures occur. To prevent I/O failures and file system corruption, stop all I/O activity and unmount iSCSI backed file systems before doing anything that will cause long term loss of connectivity to active iSCSI targets. If a loss of connectivity to iSCSI targets occurs while applications are attempting I/O activities with iSCSI devices, I/O errors will eventually occur. It might not be possible to unmount iSCSI backed file systems because the underlying iSCSI device stays busy. File system maintenance must be performed if I/O failures occur due to loss of connectivity to active iSCSI targets. To do file system maintenance, run the fsck command.
Related information
Adding a statically-discovered iSCSI target into ODM
iSCSI security considerations
The /etc/iscsi directory, the /etc/tmiscsi directory, and the files in those directories are protected from non-privileged users through file permission and ownership.
CHAP secrets are saved in the /etc/iscsi/targets file and the /etc/tmiscsi/autosecrets file in clear text.
Note: Do not to change the original file permission and ownership of these files.
iSCSI performance considerations
Set the following configurations to get the best performance from iSCSI.
To ensure the best performance:
Enable the TCP Large Send, TCP send and receive flow control, and Jumbo Frame features of the AIX Gigabit Ethernet Adapter and the iSCSI Target interface.
Tune network options and interface parameters for maximum iSCSI I/O throughput on the AIX system as follows: – Enable the RFC 1323 network option. – Set up the
tcp_sendspace,tcp_recvspace,sb_max, andmtu_sizenetwork options and network interface options to appropriate values. The iSCSI Software Initiator's maximum transfer size is 256 KB. Assuming that the system maximums fortcp_sendspaceandtcp_recvspaceare set to 262144 bytes, an ifconfig command used to configure a gigabit Ethernet interface might look like the following:
ifconfig en2 10.1.2.216 mtu 9000 tcp_sendspace 262144 tcp_recvspace 262144
– Set the sb_max network option to at least 524288, and preferably 1048576. – Set the mtu_size to 9000. – For some iSCSI targets, the TCP Nagle algoritm must be disabled for best performance. Use the no command to set the tcp_nagle_limit parameter to 0, which will disable the Nagle algorithm.
Note: For information on setting network options, see the no command description in Commands Reference, Volume 4.
For more information and additional tuning parameters, see TCP and UDP performance tuning.
iSCSI 소프트웨어 타깃 고려 사항(6.1)
iSCSI 소프트웨어 타깃을 정의하고 LUN을 내보낼 때 다음을 생각합니다.
- 각 가상 타깃의 IQN(iSCSI Qualified Name)은 소프트웨어 타깃을 정의할 때 SMIT에서 지정합니다. SMIT 화면은 이름 형식을 제한하지 않습니다. 그러나 일부 iSCSI 이니시에이터는 IQN을 iSCSI 프로토콜이 정의한 형식으로 지정해야 합니다. 이름 형식이 틀리면 이니시에이터가 타깃에 로그인해 타깃이 내보낸 디스크에 접근하지 못할 수 있습니다. iSCSI 타깃 장치의 현재 이름을 보려면 다음 단계를 마칩니다.
- 다음과 비슷한 명령을 실행합니다. 이 예에서는 iSCSI 타깃 장치가
target0이라고 가정합니다.
- 다음과 비슷한 명령을 실행합니다. 이 예에서는 iSCSI 타깃 장치가
lsattr -E -l target0
iscsi_name속성을 확인합니다.
- 내보낸 LUN에 대해 돌려주는 inquiry 데이터의 값은 다음과 같습니다.
Vendor ID: AIXProduct ID: iSCSI_VDASDANSI version number: 3
영어 원문
iSCSI software target considerations
Consider the following when you are defining an iSCSI software target and exporting logical unit numbers (LUNs):
- The iSCSI Qualified Name (IQN) of each virtual target is specified in SMIT when a software target is defined. The SMIT panel does not restrict the format of the name. However, some iSCSI initiators require that the IQN is specified in the format defined by the iSCSI protocol. Using an incorrect name format might prevent the initiator from logging to the target and accessing the disks exported by the target. To display the current name of an iSCSI target device, complete the following steps:
- Run a command similar to the following. For this example, assume the iSCSI target device is
target0.
lsattr -E -l target0
- Check the
iscsi_nameattribute.
- The inquiry data returned for an exported LUN has the following values: –
Vendor ID: AIX–Product ID: iSCSI_VDASD–ANSI version number: 3
SCTP(Stream Control Transmission Protocol)
SCTP는 TCP처럼 연결 지향 프로토콜이지만 UDP처럼 메시지 지향 데이터 전송을 제공합니다. (6.1) AIX 운영 체제는 RFC 4960을 따릅니다.
다음 표는 SCTP와 기존 전송 프로토콜인 TCP와 UDP 사이의 일반적인 동작 차이를 강조합니다.
표 84. TCP, UDP, SCTP의 차이
| 속성 | TCP | UDP | SCTP |
|---|---|---|---|
| 신뢰성 | 신뢰성 있음 | 신뢰성 없음 | 신뢰성 있음 |
| 연결 관리 | 연결 지향 | 비연결 | 연결 지향 |
| 전송 | 바이트 지향 | 메시지 지향 | 메시지 지향 |
| 흐름 제어 | 예 | 아니요 | 예 |
| 혼잡 제어 | 예 | 아니요 | 예 |
| 장애 허용 | 아니요 | 아니요 | 예 |
| 데이터 전달 | 엄격한 순서 | 순서 없음 | 부분 순서 |
| 보안 | 예 | 예 | 개선됨 |
대체로 SCTP는 VoIP(Voice over IP)처럼 신뢰성 있지만 메시지 지향인 데이터 전송이 필요한 응용 프로그램에 더 많은 유연성을 줄 수 있습니다. 이런 응용 프로그램에는 SCTP가 TCP나 UDP보다 알맞을 가능성이 큽니다.
- TCP는 신뢰성 있고 전송 순서를 엄격히 지키는 데이터 전달을 제공합니다. 신뢰성은 필요하지만 순서 없는 전달이나 부분 순서 전달을 견딜 수 있는 응용 프로그램에는 TCP가 head-of-line blocking 때문에 불필요한 지연을 일으킬 수 있습니다. SCTP는 연결 하나 안에 여러 스트림이라는 개념으로, 스트림 안에서는 엄격한 순서로 전달하면서 서로 다른 스트림의 데이터는 논리적으로 떼어 놓을 수 있습니다.
- SCTP는 바이트 지향인 TCP와 달리 메시지 지향입니다. TCP는 바이트 지향이므로 응용 프로그램이 메시지 경계를 유지하려면 자기 레코드 표시를 더해야 합니다.
- SCTP는 멀티호밍 기능으로 어느 정도 장애 허용을 제공합니다. 호스트가 같은 네트워크나 서로 다른 네트워크에 네트워크 인터페이스를 둘 이상 붙이고 있으면 멀티홈 호스트로 봅니다. SCTP 연결(association)은 멀티홈 호스트 두 대 사이에 맺을 수 있습니다. 이 경우 연결을 시작할 때 두 끝점의 모든 IP 주소를 교환하므로, 어떤 이유로 인터페이스 하나가 꺼져도 상대가 다른 인터페이스로 닿을 수 있는 한 각 끝점이 연결이 살아 있는 동안 이 주소 가운데 무엇이든 쓸 수 있습니다.
- SCTP는 TCP와 UDP에 없는 추가 보안 기능을 제공합니다. SCTP에서는 연결 설정 중 자원 할당을 쿠키 교환 메커니즘으로 클라이언트의 신원을 확인할 수 있을 때까지 미루므로 서비스 거부 공격의 가능성이 줄어듭니다.
영어 원문
Stream Control Transmission Protocol
Stream Transmission Control Protocol (SCTP) is a connection-oriented protocol, similar to TCP, but provides message-oriented data transfer, similar to UDP. The AIX operating system is compliant with RFC 4960.
The following table highlights the general differences in behavior between SCTP and existing transport protocols, TCP and UDP.
Table 84. Differences between TCP, UDP, and SCTP
| Attribute | TCP | UDP | SCTP |
|---|---|---|---|
| Reliability | Reliable | Unreliable | Reliable |
| Connection Management | Connection-oriented | Connectionless | Connection-oriented |
| Transmission | Byte-oriented | Message-oriented | Message-oriented |
| Flow Control | Yes | No | Yes |
| Congestion Control | Yes | No | Yes |
| Fault Tolerance | No | No | Yes |
| Data Delivery | Strictly Ordered | Unordered | Partially ordered |
| Security | Yes | Yes | Improved |
In general, SCTP may provide more flexibility for certain applications, like Voice over IP (VoIP), that require the reliable but message-oriented data transfer. For this category of applications, SCTP is most likely better-suited than TCP or UDP.
TCP provides reliable and strict order-of-transmission data delivery. For applications that need reliability, but can tolerate unordered or partially ordered data delivery, TCP may cause some unnecessary delay because of head-of-line blocking. With the concept of multiple streams within a single connection, SCTP can provide strictly ordered delivery within a stream while logically isolating data from different streams.
SCTP is message-oriented, unlike TCP, which is byte-oriented. Because of the byte-oriented nature of TCP, the application has to add its own record marking to maintain message boundaries.
SCTP provides some degree of fault tolerance by using the Multihoming feature. A host is considered multihomed when it has more than one network interface attached, either on the same or different networks. An SCTP association can be established between two multihomed hosts. In this case, all IP addresses of both endpoints are exchanged at association startup; this allows each endpoint to use any of these addresses over the life of the connection if one of the interfaces is down for any reason, as long as the peer is reachable through the alternate interfaces.
SCTP provides additional security features that TCP and UDP do not. In SCTP, resource allocation during association setup is delayed until the client's identity can be verified using a cookie exchange mechanism, thus reducing the possibility of Denial of Service attacks.
SCTP 연결 시작과 종료
SCTP 연결 시작과 종료 지침입니다.
SCTP 연결은 다음 순서로 이루어지는 4방향 핸드셰이크로 이루어집니다.
- 클라이언트가 서버에 INIT 신호를 보내 연결을 시작합니다.
- INIT 신호를 받으면 서버는 클라이언트에 INIT-ACK 응답을 보냅니다. 이 INIT-ACK 신호에는 상태 쿠키가 들어 있습니다. 이 상태 쿠키에는 MAC(Message Authentication Code)과 함께 쿠키를 만든 시각에 해당하는 타임스탬프, 상태 쿠키의 수명, 연결을 맺는 데 필요한 정보가 들어 있어야 합니다. MAC은 서버만 아는 비밀 키를 바탕으로 서버가 계산합니다.
- 이 INIT-ACK 신호를 받으면 클라이언트는 상태 쿠키를 그대로 되돌려 보내는 COOKIE-ECHO 응답을 보냅니다.
- 비밀 키로 상태 쿠키가 진짜인지 확인한 뒤 서버는 연결용 자원을 할당하고, COOKIE-ECHO 신호를 확인하는 COOKIE-ACK 응답을 보내고, 연결을 ESTABLISHED 상태로 옮깁니다.
SCTP는 SCTP 사용자의 요청에 따라 활성 연결을 정상 종료하는 것도 지원합니다. 다음 순서로 이벤트가 일어납니다.
- 클라이언트가 서버에 SHUTDOWN 신호를 보내, 연결을 닫을 준비가 되었음을 알립니다.
- 서버가 SHUTDOWN-ACK 확인을 보내 응답합니다.
- 클라이언트가 서버에 SHUTDOWN-COMPLETE 신호를 보냅니다.
SCTP는 SCTP 클라이언트의 요청이나 SCTP 스택의 오류로 활성 연결을 갑자기 닫는 것(ABORT 신호)도 지원합니다. 그러나 SCTP는 반쯤 열린(half open) 연결을 지원하지 않습니다. 프로토콜과 그 내부에 관한 자세한 정보는 RFC 4960에 있습니다.
위에서 설명한 SCTP와 기존 전송 프로토콜의 차이 말고도 SCTP는 다음 기능을 제공합니다.
- 스트림 안의 순서 있는 전달: SCTP에서 스트림은 끝점 사이에 전송되는 사용자 메시지의 순서열을 말합니다. SCTP 연결 하나는 여러 스트림을 지원할 수 있습니다. 연결을 설정할 때 사용자가 스트림 수를 지정할 수 있습니다. 실제 스트림 수는 상대와 협상한 뒤 정해집니다. 각 스트림 안에서는 데이터 전달 순서가 엄격히 유지됩니다. 그러나 스트림 사이의 데이터 전달은 독립적입니다. 그래서 한 스트림에서 데이터를 잃어도 다른 스트림의 데이터 전달을 막지 않습니다. 사용자 응용 프로그램은 논리적으로 독립된 데이터에 서로 다른 스트림을 쓸 수 있습니다. 특별한 옵션으로 데이터를 순서 없이 전달할 수도 있습니다. 긴급 데이터를 보낼 때 유용할 수 있습니다.
- 사용자 데이터 조각화: SCTP는 하위 계층에 넘기는 패킷 크기가 경로 MTU를 넘지 않도록 사용자 메시지를 조각낼 수 있습니다. 받을 때 조각을 완전한 메시지로 다시 모아 사용자에게 넘깁니다. 조각화는 네트워크 수준에서도 할 수 있지만, 전송 계층 조각화는 IP 계층 조각화보다 여러 이점이 있습니다. 네트워크에서 조각을 잃었을 때 메시지 전체를 다시 보내지 않아도 되고, 그렇지 않으면 IP 조각화를 해야 할 수도 있는 라우터의 부담을 줄이는 것 등입니다.
- 확인 응답과 혼잡 제어: 신뢰성 있는 데이터 전달에는 패킷 확인 응답이 필요합니다. SCTP는 보낸 패킷의 확인 응답을 정해진 시간 안에 받지 못하면 같은 패킷을 재전송합니다. SCTP는 TCP가 쓰는 것과 비슷한 혼잡 제어 알고리즘을 따릅니다. TCP처럼 누적 확인 응답을 쓰는 것 말고도, SCTP는 패킷을 선택적으로 확인할 수 있는 SACK(Selective Acknowledgment) 메커니즘을 씁니다.
- 청크 묶기: 청크에는 사용자 데이터나 SCTP 제어 정보가 들어갈 수 있습니다. 여러 청크를 같은 SCTP 헤더 아래 묶을 수 있습니다. 청크 묶기에는 보내는 쪽에서 청크를 SCTP 패킷으로 조립하고, 받는 쪽에서 패킷을 청크로 분해하는 일이 필요합니다.
- 패킷 검증: 각 SCTP 패킷에는 연결 시작 때 각 끝점이 정하는 검증 태그 필드가 있습니다. 연결이 살아 있는 동안 모든 패킷은 같은 검증 태그로 보냅니다. 연결이 살아 있는 동안 예상하지 않은 검증 태그의 패킷을 받으면 그 패킷은 버립니다. 또 네트워크에서의 데이터 손상을 더 잘 막도록 각 SCTP 패킷을 보내는 쪽이 CRC-32 체크섬을 설정해야 합니다. CRC-32 체크섬이 올바르지 않은 패킷은 버립니다.
- 경로 관리: 연결을 설정할 때 각 끝점은 자기가 가진 전송 주소 목록을 광고할 수 있습니다. 그러나 SCTP 연결에는 주 경로 하나만 정의되며 보통의 데이터 전송에 씁니다. 주 경로가 꺼지면 다른 전송 주소를 씁니다. 연결이 살아 있는 동안 모든 경로로 정기적으로 heartbeat를 보내 경로 상태를 감시합니다.
영어 원문
SCTP association startup and shutdown
SCTP association startup and shutdown guidelines are described here.
SCTP association is comprised of a four way handshake that takes place in the following order:
The client sends an INIT signal to the server to initiate an association.
On receipt of the INIT signal, the server sends an INIT-ACK response to the client. This INIT-ACK signal contains a state cookie. This state cookie must contain a Message Authentication Code (MAC),
along with a time stamp corresponding to the creation of the cookie, the life span of the state cookie, and the information necessary to establish the association. The MAC is computed by the server based on a secret key only known to it.
On receipt of this INIT-ACK signal, the client sends a COOKIE-ECHO response, which just echoes the state cookie.
After verifying the authenticity of the state cookie using the secret key, the server then allocates the resources for the association, sends a COOKIE-ACK response acknowledging the COOKIE-ECHO signal, and moves the association to ESTABLISHED state.
SCTP supports also graceful close of an active association upon request from the SCTP user. The following sequence of events occurs:
The client sends a SHUTDOWN signal to the server, which tells the server that the client is ready to close the connection.
The server responds by sending a SHUTDOWN-ACK acknowledgement.
The client then sends a SHUTDOWN-COMPLETE signal back to the server.
SCTP also supports abrupt close (ABORT signal) of an active association upon the request from the SCTP client or due to an error in the SCTP stack. However, SCTP does not support half open connections. More information about the protocol and its internals can be found in RFC 4960.
In addition to the differences specified above between SCTP and existing transport protocols, SCTP provides the following features:
Sequenced delivery within streams: A stream in SCTP context refers to a sequence of user messages that are transferred between endpoints. An SCTP association can support multiple streams. At the time of association setup, the user can specify the number of streams. The effective value of number of stream is fixed after negotiating with the peer. Within each stream the order of data delivery is strictly maintained. However across the streams data delivery is independent. Thus, the loss of data from one stream does not prevent data from being delivered in another stream. This allows a user application to use different streams for logically independent data. Data can also be delivered in an unordered fashion using a special option. This can be useful to send urgent data.
User data fragmentation: SCTP can fragment user messages to ensure that the packet size passed to the lower layer does not exceed the path MTU. At the time of receipt the fragments are reassembled into a complete message and passed to the user. Although fragmentation can also be performed at the network level, transport-layer fragmentation provides various advantages over IP-layer fragmentation. Some of these advantages including not having to re-send entire messages when fragments are lost in the network and reducing the burden on routers, which would otherwise possibly have to perform IP fragmentation.
Acknowledgment and Congestion Control: Packet acknowledgment is necessary for reliable data delivery. When SCTP does not get a acknowledgment for a packet it sends within a specified time, it triggers a retransmission of the same packet. SCTP follows congestion control algorithms similar to those used by TCP. In addition to using cumulative acknowledgements like TCP, SCTP uses Selective Acknowledgment (SACK) mechanism which allows it to acknowledge packets selectively.
Chunk bundling: A chunk may contain user data or SCTP control information. Multiple chunks can be bundled together under the same SCTP header. Chunk bundling requires assembly of chunks into SCTP packet at the sending end and subsequently disassembly of the packet into chunks at the receiver end.
Packet validation: Each SCTP packet has a verification tag field that is set during the time of association startup by each endpoint. All packets are sent with the same verification tag through the lifetime of the association. If, during the lifetime of the association, a packet is received with an unexpected verification tag, the packet is discarded. Also the CRC-32 checksum should be set by sender of each SCTP packet to provide increased protection for the data corruption in the network. Any packet received with an invalid CRC-32 checksum is discarded.
Path management: At the time of association setup, each endpoint may advertise the list of transport addresses it has. However only one primary path is defined for the SCTP association and is used for the normal data transfer. In case the primary path goes down, the other transport addresses are used. During the lifetime of the association, heartbeats are sent at regular interval through all the paths to monitor the status of the path.
SCTP 소켓 API
SCTP 소켓 API는 일관성, 접근성, 호환성을 특징으로 합니다.
SCTP 소켓 API는 다음 기능을 제공하도록 설계되었습니다.
- 기존 소켓 API와 일관성 유지
- 새 SCTP 기능에 접근하는 기반 제공
- 기존 TCP와 UDP 응용 프로그램 대부분을 조금만 바꿔 SCTP로 옮길 수 있는 호환성 제공
기존 TCP와 UDP 응용 프로그램을 쉽게 옮기도록 두 가지 스타일의 SCTP API가 정해졌습니다.
- UDP 스타일 API: 의미가 UDP 같은 비연결 프로토콜에 정의된 것과 비슷합니다.
- TCP 스타일 API: 의미가 TCP 같은 연결 지향 프로토콜에 정의된 것과 비슷합니다.
SCTP는 TCP 스타일과 UDP 스타일 소켓 API를 모두 정의해 쓸 수 있게 하지만, AIX 5.3에서는 UDP 스타일 API가 SCTP의 새 기능에 접근하는 데 더 유연하므로 UDP 스타일 소켓 구문만 지원합니다. UDP 스타일 API를 쓰는 보통의 서버는 연결이 살아 있는 동안 다음 순서로 호출합니다.
- socket()
- bind()
- listen()
- recvmsg()
- sendmsg()
- close()
보통의 클라이언트는 다음 순서로 소켓 API를 호출합니다.
- socket()
- sendmsg()
- recvmsg()
- close()
위 호출 순서로 만든 연결을 명시적으로 만든 연결이라고 합니다. 소켓을 만든 뒤 sendmsg(), recvmsg()나 sendto()와 recvto()를 호출하기만 해도 연결을 암묵적으로 만들 수 있습니다. 암묵적 연결에서는 bind()와 listen() 호출이 필요 없습니다. 이 시스템 호출들의 구문은 모두 UDP 소켓에서 쓰는 것과 비슷합니다. socket 서브루틴의 Type 필드는 SOCK_SEQPACKET, Protocol 필드는 IPPROTO_SCTP로 설정해야 합니다. 이 표준 소켓 API 말고도 SCTP는 새 API 두 개, sctp_peeloff()와 sctp_opt_info()를 제공합니다. SCTP용 소켓 API 사용에 관한 자세한 정보는 SCTP Socket API Draft에 있습니다. SCTP는 AIX 5.3에서 커널 확장으로 구현되었습니다. 사용자는 sctpctrl 명령으로 SCTP 커널 확장을 올리고 내릴 수 있습니다.
또 이 명령에 get과 set 같은 옵션을 써서 SCTP 커널 확장의 여러 통계와 조정 값을 보고 바꿀 수 있습니다. sctpctrl 명령에 관한 자세한 정보는 Commands Reference, Volume 5의 sctpctrl 명령 설명을 봅니다.
sctp_bindx 서브루틴(6.1)
소켓의 bind 주소를 더하거나 뺍니다.
라이브러리
/usr/lib/libsctp.a
구문
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/sctp.h>
int sctp_bindx(int sd, struct sockaddr * addrs, int addrcnt, int flags);
설명
sctp_bindx 서브루틴은 addrs 배열로 넘긴 bind 주소 묶음을 소켓 sd에 더하거나 뺍니다. addrcnt 매개변수는 배열의 주소 수이고, flags 매개변수는 주소를 더할지 뺄지 지정합니다.
소켓 sd가 IPv4 소켓이면 넘기는 주소는 IPv4 주소여야 합니다. 소켓 sd가 IPv6 소켓이면 넘기는 주소는 IPv4나 IPv6 주소일 수 있습니다.
addrs 매개변수는 소켓 주소 하나 이상의 배열을 가리키는 포인터입니다. 각 주소는 알맞은 구조체, 곧 struct sockaddr_in이나 struct sockaddr_in6에 들어 있습니다. 주소 길이를 구분하려면 주소 종류의 family를 써야 합니다. 호출자는 addrcnt로 배열의 주소 수를 지정합니다.
flags 매개변수는 SCTP_BINDX_ADD_ADDR나 SCTP_BINDX_REM_ADDR입니다. 응용 프로그램은 bind를 호출한 뒤 SCTP_BINDX_ADD_ADDR로 끝점에 주소를 더 연결할 수 있습니다. SCTP_BINDX_REM_ADDR는 SCTP가 주어진 주소를 연결에서 빼게 합니다. 호출자는 연결에서 모든 주소를 뺄 수 없습니다. 그러면 명령이 EINVAL 오류 코드로 실패합니다.
반환값
성공하면 sctp_bindx()는 0을 돌려줍니다. 실패하면 -1을 돌려주고 errno에 알맞은 오류 코드를 설정합니다.
오류 코드
- EINVAL: 포트나 주소가 올바르지 않거나, 연결에서 모든 주소를 빼려 했습니다.
- EOPNOTSUPP: 연결된(connected) 연결에 주소를 더하거나 빼려 했습니다.
sctp_getladdrs와 sctp_freeladdrs 서브루틴(6.1)
소켓에 로컬로 bind된 모든 주소를 돌려줍니다.
라이브러리
/usr/lib/libsctp.a
구문
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/sctp.h>
int sctp_getladdrs(int sd, sctp_assoc_t assoc_id, struct sockaddr **addrs);
void sctp_freeladdrs(struct sockaddr *addrs);
설명
sctp_getladdrs 서브루틴은 소켓에 로컬로 bind된 모든 주소를 돌려줍니다. 돌아올 때 addrs 매개변수는 각 로컬 주소에 맞는 종류의 sockaddr 구조체를 빽빽이 담은, 동적으로 할당된 배열을 가리킵니다. 메모리는 sctp_freeladdrs로 풀어야 합니다.
참고: 입출력 매개변수 addrs는 NULL이면 안 됩니다.
sd 매개변수가 IPv4 소켓이면 돌려주는 주소는 모두 IPv4 주소입니다. IPv6 소켓이면 IPv4와 IPv6 주소가 섞일 수 있습니다.
일대다(one-to-many) 소켓에서는 id 필드가 질의할 연결을 지정합니다. 일대일(one-to-one) 소켓에서는 id 필드를 무시합니다. id 필드가 0이면 특정 연결과 관계없이 로컬로 bind된 주소를 돌려줍니다.
sctp_freeladdrs 서브루틴은 sctp_getladdrs가 할당한 모든 자원을 풉니다.
반환값
성공하면 sctp_getladdrs는 소켓에 bind된 로컬 주소 수를 돌려줍니다. 소켓이 bind되지 않았으면 0을 돌려주며 *addrs 값은 정의되지 않습니다. 오류가 나면 -1을 돌려주며 *addrs 값은 정의되지 않습니다.
sctp_getpaddrs와 sctp_freepaddrs 서브루틴(6.1)
연결의 모든 상대 주소를 돌려줍니다.
라이브러리
/usr/lib/libsctp.a
구문
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/sctp.h>
int sctp_getpaddrs(int sd, sctp_assoc_t assoc_id, struct sockaddr **addrs);
void sctp_freepaddrs(struct sockaddr *addrs);
설명
sctp_getpaddrs 서브루틴은 연결의 모든 상대 주소를 돌려줍니다. 돌아올 때 addrs 매개변수는 각 주소에 맞는 종류의 sockaddr 구조체를 빽빽이 담은, 동적으로 할당된 배열을 가리킵니다. 메모리는 sctp_freepaddrs 서브루틴으로 풀어야 합니다.
참고: 입출력 매개변수 addrs는 NULL이면 안 됩니다.
sd 매개변수가 IPv4 소켓이면 돌려주는 주소는 모두 IPv4 주소입니다. IPv6 소켓이면 IPv4와 IPv6 주소가 섞일 수 있습니다. 일대다 소켓에서는 id 필드가 질의할 연결을 지정합니다. 일대일 소켓에서는 id 필드를 무시합니다.
sctp_freepaddrs 서브루틴은 sctp_getpaddrs가 할당한 모든 자원을 풉니다.
반환값
성공하면 sctp_getpaddrs는 연결의 상대 주소 수를 돌려줍니다. 이 소켓에 연결이 없으면 0을 돌려주며 *addrs 값은 정의되지 않습니다. 오류가 나면 -1을 돌려주며 *addrs 값은 정의되지 않습니다.
영어 원문
SCTP socket APIs
The features of SCTP socket APIs include consistency, accessibility, and compatibility.
SCTP Socket APIs were designed to provide the following features:
Maintain consistency with existing socket APIs
Provide a base for access to new SCTP Features
Provide compatibility so that most existing TCP and UDP applications can be migrated to SCTP with few changes
In order to facilitate easy migration of existing TCP and UDP applications, two different styles of SCTP APIs have been formulated:
UDP-Style API – Semantics are similar to that defined for connectionless protocols like UDP
TCP-Style API – Semantics are similar to that defined for connection-oriented protocols like TCP
Though SCTP allows for both TCP and UDP style of socket APIs to be defined and used, in AIX 5.3, only support for UDP-style socket syntax is provided because the UDP-style API provides more flexibility in accessing new features of SCTP. Using the UDP-style API a typical server uses the following sequence of calls during the lifetime of an association.
socket()
bind()
listen()
recvmsg()
sendmsg()
close()
A typical client uses the following sequence of socket API calls:
socket()
sendmsg()
recvmsg()
close()
The associations created using the above call sequence are called explicitly created associations. An association can be created implicitly after creating a socket, by simply calling sendmsg(), recvmsg() or sendto() and recvto(). In the case of implicit association, the bind() and listen() calls are not required. The syntax of all these system calls are similar to those used with UDP sockets. For the socket subroutine, the Type field should be set to SOCK_SEQPACKET and the Protocol field should be IPPROTO_SCTP. In addition to these standard socket APIs SCTP provides two new APIs: sctp_peeloff() and sctp_opt_info(). More information about the use of Socket API for SCTP can be found in the SCTP Socket API Draft. SCTP has been implemented as a kernel extension in AIX 5.3. A user can use the sctpctrl command to load and unload the SCTP kernel extension.
In addition, this command can also be used to view and change various other statistics and tunables of the SCTP kernel extension using different options like get and set. For more information on sctpctrl command see the sctpctrl command description in Commands Reference, Volume 5
sctp_bindx subroutine
Adds or removes bind address on a socket.
Library
/usr/lib/libsctp.a
Syntax
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/sctp.h>
int sctp_bindx(int sd, struct sockaddr * addrs, int addrcnt, int flags);
Description
The sctp_bindx subroutine adds or removes a set of bind addresses passed in the addrs array to or from the socket sd. The addrcnt parameter is the number of addresses in the array, and the flags parameter specifies if the addresses need to be added or removed.
If the socket sd is an IPv4 socket, the addresses passed must be IPv4 addresses. If the socket sd is an IPv6 socket, the addresses passed can be either IPv4 or IPv6 addresses.
The addrs parameter is a pointer to an array of one or more socket addresses. Each address is contained in its appropriate structure, that is, struct sockaddr_in or struct sockaddr_in6. The family of the address type must be used to distinguish the address length. The caller specifies the number of addresses in the array along with addrcnt.
The flags parameter can be either SCTP_BINDX_ADD_ADDR or SCTP_BINDX_REM_ADDR. An application can use SCTP_BINDX_ADD_ADDR to associate additional addresses with an endpoint after calling the bind command. The SCTP_BINDX_REM_ADDR parameter directs SCTP to remove the given addresses from the association. A caller might not remove all addresses from an association. The command fails resulting in the EINVAL error code.
Return values
Upon successful completion, the sctp_bindx() command returns 0. On failure, the sctp_bindx() command returns -1 and sets the errno parameter to the appropriate error code.
Error codes
- EINVAL — The EINVAL error code indicates that the port or address is invalid or the command is trying to remove all addresses from an association.
- EOPNOTSUPP — The EOPNOTSUPP error code indicates that the command is trying to add or remove addresses from a connected association.
sctp_getladdrs and sctp_freeladdrs subroutines
Returns all locally bound addresses on a socket.
Library
/usr/lib/libsctp.a
Syntax
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/sctp.h>
int sctp_getladdrs(int sd, sctp_assoc_t assoc_id, struct sockaddr **addrs);
void sctp_freeladdrs(struct sockaddr *addrs);
Description
The sctp_getladdrs subroutine returns all locally bound addresses on a socket. On return, the addrs parameter points to a dynamically allocated packed array of the sockaddr structures of the appropriate type for each local address. You must use the sctp_freeladdrs parameter to free the memory.
Note: The in or out parameter addrs must not be NULL.
If the sd parameter is an IPv4 socket, the addresses returned are all IPv4 addresses. If the sd parameter is an IPv6 socket, the addresses returned can be a mix of IPv4 or IPv6 addresses.
For one-to-many style sockets, the id field specifies the association to query. For one-to-one style sockets, the id field is ignored. If the id field is set to 0, the locally bound addresses are returned without regard to any particular association.
The sctp_freeladdrs subroutine frees all the resources allocated by the sctp_getladdrs subroutine.
Return value
On success, the sctp_getladdrs subroutine returns the number of local addresses bound to the socket. If the socket is unbound, 0 is returned and the value of the *addrs field is undefined. On error, the sctp_getladdrs subroutine returns -1, and the value of the *addrs field is undefined.
sctp_getpaddrs and sctp_freepaddrs subroutines
Returns all peer addresses in an association.
Library
/usr/lib/libsctp.a
Syntax
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/sctp.h>
int sctp_getpaddrs(int sd, sctp_assoc_t assoc_id, struct sockaddr **addrs);
void sctp_freepaddrs(struct sockaddr *addrs);
Description
The sctp_getpaddrs subroutine returns all the peer addresses in an association. On return, the addrs parameter points to a dynamically allocated packed array of the sockaddr structures of the appropriate type for each address. You must use the sctp_freepaddrs subroutine to free the memory.
Note: The in or out parameter addrs must not be NULL.
If the sd parameter is an IPv4 socket, the addresses returned are all IPv4 addresses. If the sd parameter is an IPv6 socket, the addresses returned can be a mix of IPv4 or IPv6 addresses. For one-to-many style sockets, the id field specifies the association to query. For one-to-one style sockets, the id field is ignored.
The sctp_freepaddrs subroutine frees all the resources allocated by the sctp_getpaddrs subroutine.
Return value
On success, the sctp_getpaddrs subroutine returns the number of peer addresses in the association. If there is no association on this socket, 0 is returned and the value of the *addrs field is undefined. On error, the sctp_getpaddrs subroutine returns -1, and the value of the *addrs field is undefined.