Content n n n Introduction UDP Header UDP

  • Slides: 52
Download presentation

Content n n n Introduction UDP Header UDP Checksum IP Fragmentation ICMP 도달불가 에러[단편화

Content n n n Introduction UDP Header UDP Checksum IP Fragmentation ICMP 도달불가 에러[단편화 요구] Traceroute를 이용한 Path MTU결정 UDP를 이용한 Path MTU발견 UDP와 ARP간의 상호 작용 UDP 데이터그램 크기의 최대값 ICMP 발신지 억제 에러 UDP 서버 설계 Summary 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 2

Introduction n Simple, datagram-oriented, transport layer protocol n 프로세스에 의한 output으로 하나의 UDP datagram을

Introduction n Simple, datagram-oriented, transport layer protocol n 프로세스에 의한 output으로 하나의 UDP datagram을 생성 l n stream-oriented protocol인 TCP와 다름 No reliability l 목적지에 도착을 보장하지 못함 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 3

UDP Header n n Port number l sending process와 receiving process 구별 l UDP와

UDP Header n n Port number l sending process와 receiving process 구별 l UDP와 TCP port는 IP로부터 구별 됨 (figure 1. 8) UDP length: UDP header+data의 길이 l 최소 크기 8 바이트(data가 0일 경우) l IP datagram total length - IP header length 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 4

UDP Header 16 -bit source port number 16 -bit destination port number 16 -bit

UDP Header 16 -bit source port number 16 -bit destination port number 16 -bit UDP length 16 -bit UDP checksum Data(if any) Figure 11. 2 UDP header 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 5

UDP Checksum n UDP header와 UDP data를 체크 l n IP checksum은 IP header만

UDP Checksum n UDP header와 UDP data를 체크 l n IP checksum은 IP header만 체크 IP header checksum과 유사하지만 차이점이 있음 l UDP datagram의 길이는 홀수일 수 있지만, checksum algorithm 은 16 -bit word • l 0값의 pad byte를 붙임으로서 해결 12 -byte pseudo-header 포함 • 데이터가 보내질 올바른 목적지를 2번 체크 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 6

UDP Checksum n UDP checksum 계산 필드 32 -bit source IP address zero 8

UDP Checksum n UDP checksum 계산 필드 32 -bit source IP address zero 8 -bit protocol 16 -bit UDP length 16 -bit source port number 16 -bit dest port number 16 -bit UDP length 16 -bit UDP checksum data Pad byte(0) 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 7

UDP Checksum n n TCP와 UDP는 헤더에 checksum을 가짐 l UDP는 optional, TCP는 mandatory

UDP Checksum n n TCP와 UDP는 헤더에 checksum을 가짐 l UDP는 optional, TCP는 mandatory l UDP는 optional이지만, 항상 checksum을 사용해야 함 tcpdump Output 1 0. 0 sun. 1900 > gemini. echo: udp 9 (UDP cksum=6 e 90) 2 0. 303755(0. 3038)gemini. echo > sun. 1900: udp 9 (UDP cksum =0) 3 17. 392480(17. 0887) sun. 1904 > aix. echo: udp 9 (UDP cksum=6 e 3 b) 4 17. 614371(0. 2219) axi. echo > sun. 1904: udp 9 (UDP cksum=6 e 3 b) 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 8

IP Fragmentation n Reassemble l l l n 몇몇 다른 네트워크 프로토콜은 최종 목적지가

IP Fragmentation n Reassemble l l l n 몇몇 다른 네트워크 프로토콜은 최종 목적지가 아닌 다음 hop 에서 reassemble하기도 함 목적지의 IP Layer가 수행 Fragmentation & Reassemble 목적 l n 최종 목적지에 도달 후, reassemble됨 처리 속도를 저하시키지 않는 범위에서 transport layer에서 transparency을 제공하기 위함 Fragmentation의 재 fragmentation이 가능 l IP header에 reassemble을 위한 정보를 유지 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 10

IP Fragmentation n IP header field l Identification field : 송신자가 전송하는 각 IP

IP Fragmentation n IP header field l Identification field : 송신자가 전송하는 각 IP 데이터그램에 대 하여 유일한 값을 포함, 번호는 해당 데이터그램의 각 단편에 복사 l Flags field • more fragment bit : fragment가 더 있다는 것을 의미하기 위함, 마 지막 fragment를 제외하고 각 fragment는 이 비트를 set • don’t fragment bit : IP는 datagram을 단편화하지 못함, 그러나 ICMP error를 본래 전송자에게 보냄 (ICMP error : fragmentation이 필요한데 don’t fragment bit가 set되 어 있음을 의미) l Fragment offset field : 해당 fragment의 offset을 나타냄 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 11

IP Fragmentation n Example l l l sock 프로그램을 이용해서 fragmentation이 일어날 때까지 datagram의

IP Fragmentation n Example l l l sock 프로그램을 이용해서 fragmentation이 일어날 때까지 datagram의 크기를 증가시킨다. Ethernet 의 MTU = 1500 bytes user data = 1500 - 20(IP header) - 8(UDP header) = 1472 bytes bsdi % sock -u -I -n 1 -w 1471 svr 4 discard bsdi % sock -u -I -n 1 -w 1472 svr 4 discard bsdi % sock -u -I -n 1 -w 1473 svr 4 discard bsdi % sock -u -I -n 1 -w 1474 svr 4 discard 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 13

IP Fragmentation n tcpdump output 1 0. 0 2 21. 008303 (21. 0083) 3

IP Fragmentation n tcpdump output 1 0. 0 2 21. 008303 (21. 0083) 3 50. 449704 (29. 4414) 4 50. 450040 ( 0. 0003) 5 75. 328650 (24. 8786) 6. 75. 328982 ( 0. 0003) l l l bsdi. 1112 >svr 4. discard: udp 1471 bsdi. 1114 >svr 4. discard: udp 1472 bsdi. 1116 >svr 4. discard: udp 1473 (frag 26304: 1480@0+) bsdi>svr 4: (frag 26304: 1@1480) bsdi. 1118>svr 4. discard: udp 1474 (frag 26313: 1480@0+) bsdi>svr 4: (frag 26313: 2@1480) line 1, 2 : not fragmented line 3, 4, 5, 6 : fragmented identification number : 26304, 26313 1480= 1472(user data)+8(UDP header) - excluding IP header ‘@’ 다음의 number : offset + : more fragment , if (not +) then last fragment 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 14

IP Fragmentation n 생성된 fragment의 크기는 마지막 fragment를 제외하고 8의 배수가 되어야 함 n

IP Fragmentation n 생성된 fragment의 크기는 마지막 fragment를 제외하고 8의 배수가 되어야 함 n 첫번째 fragment를 제외한 나머지는 프로토콜과 source, destination의 port number를 생략함 n terminology l IP datagram : IP Layer에서 종단간 전송의 단위 l packet : IP Layer와 Link layer간에 전달되는 데이터의 단위 packet은 하나의 IP datagram이 되거나 fragment가 될 수 있음 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 15

UDP datagram IP header UDP header 20 byte 8 byte UDP data (1473 bytes)

UDP datagram IP header UDP header 20 byte 8 byte UDP data (1473 bytes) IP header 1472 bytes packet 20 byte 1 byte packet Figure 11. 8 Example of UDP Fragmentation 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 16

ICMP Unreachable Error (Fragmentation Required) n router가 fragmentation이 필요한 datagram을 받은 경우, DF flag가

ICMP Unreachable Error (Fragmentation Required) n router가 fragmentation이 필요한 datagram을 받은 경우, DF flag가 set되어 있을 때 발생 n 목적지까지의 경로에서 가장 작은 MTU를 결정할 필요가 있는 프로그램은 이러한 error를 이용 l (path MTU discovery Mechanism) 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 17

Newer Format of ICMP Unreachble Error 0 7 8 type(3) 15 16 code(4) checksum

Newer Format of ICMP Unreachble Error 0 7 8 type(3) 15 16 code(4) checksum 8 bytes Unused (must be 0) 31 MTU of next-hop network IP header(including options) + first 8 bytes of original IP datagram data Figure 11. 9 ICMP unreachable error options)+first 8 bytes of original IP datagram data 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 18

MTU=1500 bsdi MTU=1500 SLIP sun netb MTU=552 MTU=1500 solaris MTU=? fragment ICMP echo ping

MTU=1500 bsdi MTU=1500 SLIP sun netb MTU=552 MTU=1500 solaris MTU=? fragment ICMP echo ping request fragment watch with tcpdump fragmentation Figure 11. 10 Systems being used to determine MTU of SLIP link from netb to sun 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 19

ICMP Unreachable Error (Fragmentation Required) n tcpdump output on bsdi 1 0. 0 2.

ICMP Unreachable Error (Fragmentation Required) n tcpdump output on bsdi 1 0. 0 2. 0. 000000 3. 0. 000000 (0. 0000) 4 0. 738400 5. 0. 748800 (0. 7384) (0. 0104) (0. 0000) l solaris > bsdi : icmp : echo request (DF) bsdi>solaris : icmp : echo reply (DF) sun>bsdi icmp : solaris unreachable need to frag, mtu = 0 (DF) Solaris 2. 2 는 대개 DF를 set 한다. 이는 path MTU discovery mechanism의 한 부 분이다. 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 20

MTU=1500 bsdi MTU=1500 SLIP sun MTU=552 netb solaris MTU=? ICMP echo request ICMP echo

MTU=1500 bsdi MTU=1500 SLIP sun MTU=552 netb solaris MTU=? ICMP echo request ICMP echo reply ICMP unreachable fragmentation required and DF set MTU=1500 ICMP echo request Figure 11. 12 Packets exchanged in example 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 21

Determining the path MTU using Traceroute n n path MTU discovery 성질이 없다고 해도,

Determining the path MTU using Traceroute n n path MTU discovery 성질이 없다고 해도, path MTU를 결정 하기 위해 traceroute version을 수정할 수 있다. example scenario l l DF set packet을 보냄 1번 packet의 크기 = sending interface의 MTU ICMP “can’t fragment” error를 받을 때 마다 packet의 크기를 줄임 만약 ICMP error를 보내는 router가 sending interface의 MTU를 포함하는 새로운 version을 보내면, 이 값을 사용할 것이다. 그 렇지 않으면, 다음 작은 MTU를 시도 • RFC 1191에서는 MTU의 수를 제한 -> 본 프로그램은 유사한 테이블을 갖 고 있어서 다음 작은 값으로 시도 l sun -> slip (SLIP link MTU = 295) 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 22

Determining the path MTU using Traceroute n traceroute output (sun -> slip) sun %

Determining the path MTU using Traceroute n traceroute output (sun -> slip) sun % traceroute. pmtu slip traceroute to slip (140. 252. 13. 65), 30 hop max outgoing MTU =1500 1 bsdi (140. 252. 13. 35) 15 ms 6 ms 2 bsdi (140. 252. 13. 35) 6 ms fragmentation required and DF set, trying new MTU = 1492 fragmentation required and DF set, trying new MTU = 1006 fragmentation required and DF set, trying new MTU = 576 fragmentation required and DF set, trying new MTU = 552 fragmentation required and DF set, trying new MTU = 544 fragmentation required and DF set, trying new MTU = 512 fragmentation required and DF set, trying new MTU = 508 fragmentation required and DF set, trying new MTU = 296 2 slip (140. 252. 13. 65) 377 ms 377 ms 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 23

Determining the path MTU using Traceroute n Modify ICMP code on bsdi n sun

Determining the path MTU using Traceroute n Modify ICMP code on bsdi n sun % traceroute. pmtu slip traceroute to slip (140. 252. 13. 65), 30 hop max outgoing MTU = 1500 1 2 bsdi (140. 252. 13. 35) 53 ms (140. 252. 13. 35) 6 ms 6 ms fragmentation required and DF set, Next hop MTU = 296 2 slip (140. 252. 13. 65) 377 ms 378 MS 377 MS n 올바른 MTU를 찾기 전에 8개의 다른 값으로 시도할 필요없다. n router는 제대로 된 값을 전달한다. 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 24

Path MTU Discovery with UDP n n UDP를 이용하는 application과 path MTU discovery mechanism

Path MTU Discovery with UDP n n UDP를 이용하는 application과 path MTU discovery mechanism 간의 상호작용을 알아본다. Example – application이 중간의 link에 대해서 상당히 큰 datagram을 write 한다 – solaris : source host, – sending data : solaris -> slip – size of data : 650 bytes – SLIP link MTU behind slip : 296 – – slip : destination host 268 byte (296 -20 -8) 이상되는 UDP datagram( DF set)은 router bsdi 가 ICMP error를 생성하게 한다. solaris % sock -u -i -n 10 -w 650 slip discard 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 25

run tcpdump here MTU=1500 slip SLIP MTU=296 bsdi MTU=296 MTU=1500 sun MTU=1500 SLIP MTU=552

run tcpdump here MTU=1500 slip SLIP MTU=296 bsdi MTU=296 MTU=1500 sun MTU=1500 SLIP MTU=552 netb MTU=1500 solaris MTU=1500 650 -byte UDP datagram with DF bit set ICMP can’t fragment error Figure 11. 13 Systems used for path MTU discovery using UDP 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 26

n tcpdump output on sun 1 0. 0 2 0. 004218 (0. 0042) bsdi>solaris:

n tcpdump output on sun 1 0. 0 2 0. 004218 (0. 0042) bsdi>solaris: icmp: solaris. 36196>slip. discard: udp 650 (DF) slip unreachable - need to frag, mtu=0 (DF) 3 4. 980528 (4. 9763) solaris. 36196>slip. discard: udp 650 (DF) 4 4. 984503 (0. 0040) bsdi>solaris: icmp: slip unreachable - need to frag, mtu=0 (DF) 5 9. 870407 (4. 9763) solaris. 36196>slip. discard: udp 650 (frag 47942: 552@0+) 6 9. 960056 (0. 0896) solaris>slip: (frag 47942: 106@552) 7 14. 940338 (4. 9763) solaris. 36196>slip. discard: udp 650 (DF) 8 14. 944466 (0. 0040) bsdi>solaris: icmp: slip unreachable - need to frag, mtu=0 (DF) 9 19. 890015 (4. 9763) solaris. 38196>slip. discard: udp 650 (frag 47944: 552@0+) 10 19. 950463 (0. 0604) solaris>slip: (frag 47944: 106@552) 19 44. 940485 (5. 0100) solaris. 36196>slip. discard: udp 650 (DF) 20 44. 944432 (0. 0040) bsdi>solaris: icmp: slip unreachable - need to frag, mtu=0 (DF) 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 27

Path MTU Discovery with UDP n tcpdump output on slip 1 2 3 4

Path MTU Discovery with UDP n tcpdump output on slip 1 2 3 4 0. 0 0. 304513 0. 334651 0. 0. 1320 l solaris. 38196>slip. discard: udp 650 (frag 47942: 272@0+) (0. 3045) solaris>slip: (frag 47942: 272@272+) (0. 0301) solaris>slip: (frag 47942: 8@544+) (0. 1320) solaris>slip: (frag 47942: 106@552) solaris는 fragmetation(x), but DF bit를 off 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 28

Path MTU Discovery with UDP n Modify router bsdi – return next-hop MTU(ICMP error)

Path MTU Discovery with UDP n Modify router bsdi – return next-hop MTU(ICMP error) 1 2 0. 004199 3 4 4. 950193 4. 954325 5 6 7 9. 779855 9. 930018 9. 990170 solaris. 37974>slip. discard: udp 650 (DF) (0. 0042) bsdi>solaris: icmp : slip unreachable - need to frag, mtu = 296 (DF) (4. 9460) solaris. 37974>slip. discard: udp 650 (DF) (0. 0041) bsdi>solaris: icmp : slip unreachable - need to frag, mtu = 296 (DF) (4. 8255) solaris. 37974>slip. discard: udp 650 (frag 35278: 272@0+) (0. 1502) solaris>slip: (frag 35278: 272 @272+) (0. 0602) solaris>slip: (frag 35278: 114 @544) source host가 fragmentation 실행 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 29

Interaction Between UDP and ARP n tcpdump output 1 2 0. 001234 (0. 0012)

Interaction Between UDP and ARP n tcpdump output 1 2 0. 001234 (0. 0012) arp who-has svr 4 tell bsdi 7 8 9 10 0. 008772 0. 009911 0. 011127 0. 011255 arp reply svr 4 is-at 0: 0: c 2: 9 b: 26 bsdi>svr 4: (frag 10863: 800@7400) arp reply svr 4 is-at 0: 0: c 2: 9 b: 26 n n (0. 0045) (0. 0011) (0. 0012) (0. 0041) reply가 돌아오기 전에 6개의 ARP request가 생성되었다. 이는 6개의 fragment는 빠르게 생성이 되었고 각각의 fragment에 의해서 ARP request가 생성되었다. last packet 만이 전송되었다. 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 31

Interaction Between UDP and ARP n n ICMP error는 전송되지 않았다. IP layer는 반드시

Interaction Between UDP and ARP n n ICMP error는 전송되지 않았다. IP layer는 반드시 첫번째 fragment가 도착할 때 timer를 start 시켜야 한다. l n timer가 종료될 때 까지 해당 datagram의 모든 fragment가 도 착하지 않았다면, 모든 fragment들은 discard될 것이다. l n “first” : first arrival fragment, not first fragment 그렇지 않으면 수신자의 buffer가 넘치게 되는 결과를 초래할 것이다. ICMP error가 전송되지 않은 이유 l l Berkely : timer가 종료되어, 모든 fragment를 거부 other : first fragment가 도착되지 않았기 때문 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 32

Maximum UDP Datagram Size n 이론상, IP datagram의 최대 크기는 65535 bytes l n

Maximum UDP Datagram Size n 이론상, IP datagram의 최대 크기는 65535 bytes l n lenth field : 16 bit -> 216 - 1 UDP datagram에서 User data의 최대 크기는 65507 bytes l 65507 = 65535 - IP header(20) - UDP header(8) 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 33

ICMP source Quench Error n 처리할 수 없을 정도로 빠르게 datagram을 받을 때, system(host

ICMP source Quench Error n 처리할 수 없을 정도로 빠르게 datagram을 받을 때, system(host or router)에 의해서 생성되기도 한다. l n 시스템의 buffer가 넘쳐서 datagram을 버릴지라도 “source quench”의 전송은 반드시 이루어져야 하는 아니다. Example l l bsdi -> sun : Ethernet, sun -> : SLIP link = 100 * Ethernet link 이기 때문에 sun의 버퍼가 쉽게 넘칠 것이다. 100개의 1024 -byte datagram을 전송 : bsdi -> sun -> solaris bsdi % sock -u -i -w 1024 -n 100 solaris discard 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 34

ICMP source Quench Error 0 7 8 type(4) 15 16 code(0) 31 checksum 8

ICMP source Quench Error 0 7 8 type(4) 15 16 code(0) 31 checksum 8 bytes Unused (must be 0) IP header(including options) + first 8 bytes of original IP dagagram data Figure 11. 18 ICMP source quench error 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 35

ICMP source Quench Error n tcpdump output 1 0. 0 27 28 29 30

ICMP source Quench Error n tcpdump output 1 0. 0 27 28 29 30 0. 11 173 0. 71 174 0. 71 정보통신연구실 (0. 00) (0. 01) (0. 00) (0. 06) (0. 00) bsdi. 1403 > solaris. discard: udp 1024 26 lines thar we don’t show bsdi. 1403>solaris. dicard: udp 1024 sun>bsdi: icmp: source quench bsdi. 1403>solaris. discard: udp 1024 sun>bsdi: icmp: source quench 142 lines thar we don’t show bsdi. 1403>solaris. discard: udp 1024 sun>bsdi: icmp: source quench 성균관 대학교 Sung. Kyun. Kwan Univ. 36

ICMP source Quench Error n n 26개의 datagram은 에러없이 전송, but 27번째 datagram부터 는

ICMP source Quench Error n n 26개의 datagram은 에러없이 전송, but 27번째 datagram부터 는 전송할 때마다 error 에러를 받는다. original tcpdump ouptut l n 26+(74(버려진 datagram)*2(line))=174 전송 시간 l l sun -> solaris(SLIP) : 9600 bits/sec 로 1024 byte 전송하는데 걸 리는 시간은 1초 조금 넘게 걸린다. bsdi->sun(Ethernet) : 100개의 datagram이 1초 이내에 sun에 도착 한다. (첫번째 datagram이 SLIP Link를 통과하기 전에) 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 37

UDP Server Design n UDP를 이용하는 서버의 설계 및 구현시 고려사항 l l l

UDP Server Design n UDP를 이용하는 서버의 설계 및 구현시 고려사항 l l l n 서버의 설계 및 구현은 대개 클라이언트 보다 어렵다. l n Client IP Address and Port Number Destination IP Address UDP Input Queue Restricting Local IP Address Restricting Foreign IP Address Multiple Recipients per Port O/S와의 interaction, 동시에 여러 클라이언트들을 처리 Protocol 특성이라는 측면에서 다룬다. 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 38

UDP Server Design n Client IP Address and Port Number l 서버에 클라이언트의 UDP

UDP Server Design n Client IP Address and Port Number l 서버에 클라이언트의 UDP datagram이 도착 • IP header = Source IP Addr. + Destination IP Addr. • UDP header = Source Port Num. + Destication Port Num l l 서버의 O/S는 Source IP Addr. 와 Port Num. 을 통해서, 도착한 메 시지의 발신지를 알 수 있다. 동시에 여러 클라이언트를 처리가능하게 한다. • Source Addr. 과 Port Num. 을 통해서 각각의 request에 대한 반복을 가능하게 한다. 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 39

UDP Server Design n Destination IP Address l l 몇몇 application들은 datagram이 어디로 전송되는지를

UDP Server Design n Destination IP Address l l 몇몇 application들은 datagram이 어디로 전송되는지를 알고자 한다. Host Requirement RFC • TFTP server는 반드시 Destination 주소가broadcast 주소로 된 datagram은 무시한다. l l 이는 O/S가 수신된 UDP datagram의 destination IP 주소를 Application에 넘기도록 요구한다. 모든 application이 이 기능을 제공하는 것은 아니다. 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 40

UDP Server Design n example of Input Queue overflow 서버 bsdi % sock -s

UDP Server Design n example of Input Queue overflow 서버 bsdi % sock -s -u -v -E -R 256 -r 256 -P 30 6666 from 140. 252. 13. 33, to 140. 252. 13. 63 : 111111 from sun, to broadcast address from 140. 252. 13. 34, to 140. 252. 13. 35 : 444444 from sun, to broadcast address 클라이언트 sun % sock -u -v 140. 252. 13. 63 6666 to Ethernet broadcat address connected on 140. 252. 13. 33. 1258 to 140. 252. 13. 6666 11111 11 bytes of data (with newline) 22222 10 bytes of data (with newline) 333333 12 bytes of data (with newline) 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 42

UDP Server Design 클라이어트 svr 4 % sock -u -v bsdi 6666 connected on

UDP Server Design 클라이어트 svr 4 % sock -u -v bsdi 6666 connected on 0. 0. 1042 to 140. 252. 13. 35. 6666 4444444 14 bytes of data (with newline) 55555555 16 bytes of data (with newline) 6666 9 bytes of data (with newline) n tcpdump output 1 0. 0 2 2. 499484 (2. 4992) 3 4. 959166 (2. 4600) 4 7. 607149 (2. 4992) 5 10. 079059 (2. 4719) 6 12. 415943 (2. 3369) 정보통신연구실 sun. 1252 > 140. 252. 13. 6666: UDP 11 svr 4. 1042 > bsdi. 6666: UDP 14 sun. 1252 > 140. 252. 13. 6666: UDP 10 svr 4. 1042 > bsdi. 6666: UDP 16 sun. 1252 > 140. 252. 13. 6666: UDP 12 svr 4. 1042 > bsdi. 6666: UDP 9 성균관 대학교 Sung. Kyun. Kwan Univ. 43

UDP Server Design l Input Queue Overflow 발생시, UDP는 application에 알리지 않 는다. •

UDP Server Design l Input Queue Overflow 발생시, UDP는 application에 알리지 않 는다. • 초과된 datagram들은 UDP에 의해서 거절된다. l datagram이 거절되었다는 것을 클라이언트에게 알리지 않는다. l UDP Input Queue는 FIFO(first-in, first-out) 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 44

UDP Server Design n Restricting Local IP Address l 대부분의 UDP 서버들은 UDP end

UDP Server Design n Restricting Local IP Address l 대부분의 UDP 서버들은 UDP end point를 생성할때, 자신들의 local IP 주소를 wildcard로 한다. • 서버의 port로 들어오는 UDP datagram은 어떤 local interface에서 든지 받아들여 진다. l Example sun % sock -u -s 7777 sun % netstat -a -n -f inet Active Internet Connections (including sercers) proto Recv-Q Send-Q Local Address (state) udp 0 0 *. 7777 *. * Foreign Address flag -a : reports on all network end points, -n : print IP addr. as decimal number -f net : report only TCP and UDP end point 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 45

UDP Server Design l 서버가 자신의 end point를 생성시, end point에 대한 local IP

UDP Server Design l 서버가 자신의 end point를 생성시, end point에 대한 local IP addr. 로 호스트의 local IP address 중 하나를 명시하는 것이 가 능. • if (destination addr. = specified local addr. ), incomming datagram이 end point에 pass 됨. l Example sun % sock -u -s 140. 252. 1. 29 7777 proto Recv-Q Send-Q Local Address (state) udp 0 0 *. 7777 tcpdump output 1 0. 0 2 0. 000822 (0. 0008) 정보통신연구실 Foreign Address *. * bsdi. 1723 > sun. 7777: UDP 13 sun > bsdi: icmp: sun udp port 7777 unreachable 성균관 대학교 Sung. Kyun. Kwan Univ. 46

UDP Server Design l 동일한 port에 다른 local IP addr. 를 갖는 Server •

UDP Server Design l 동일한 port에 다른 local IP addr. 를 갖는 Server • 대개, 동일한 port를 재사용한다 라는 것을 Application에 알려야 한다. l Example sun % sock -u -s 140. 252. 1. 29 8888 sun % sock -u -s -A 140. 252. 13. 33 8888 sun % sock -u -s -A 127. 0. 0. 1 8888 sun % sock -u -s -A 140. 252. 13. 63 8888 sun % sock -u -s -A 8888 proto Recv-Q Send-Q udp 0 udp 0 정보통신연구실 for SLIP link for Ethernet for loopback interface for Ethernet broadcasts everything else (wildcard IP address) Local Address Foreign Address 0 *. 8888 *. * 0 140. 252. 13. 63. 8888 *. * 0 127. 0. 0. 1. 8888 *. * 0 140. 252. 13. 33. 8888 *. * 0 140. 252. 1. 29. 8888 *. * (state) 성균관 대학교 Sung. Kyun. Kwan Univ. 47

UDP Server Design l Priority • wildcard address를 갖는 end point가 있다면, 묵시적인 우선

UDP Server Design l Priority • wildcard address를 갖는 end point가 있다면, 묵시적인 우선 순위가 존재. • “destination IP addr. = specific IP addr” 인 종단점은 wildcard 보다 먼저 선택된다. • match되는 것이 없을 경우에만 wildcard end point가 이용 된다. 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 48

UDP Server Design n Restricting Foreign IP Address l 대부분의 implementations 경우, UDP end

UDP Server Design n Restricting Foreign IP Address l 대부분의 implementations 경우, UDP end point로 하여금 foreign addr. 를 제한. • end point는 명시한 IP addr. 과 port로 부터만 datagram을 수신. l Example sun % sock -u -s -f 140. 252. 13. 35. 4444 5555 proto Recv-Q Send-Q Local Address Foreign Address udp 0 0 140. 252. 13. 33. 5555 140. 252. 13. 35. 4444 정보통신연구실 (state) 성균관 대학교 Sung. Kyun. Kwan Univ. 49

UDP Server Design n Multiple Recipients Per Port l 대부분의 implementation • An application

UDP Server Design n Multiple Recipients Per Port l 대부분의 implementation • An application end point - An local Addr. & port number l Example sun % sock -u -s 9999 we expect this to fail can’t bind local address: Address Already in use sun % sock -u -s -A 9999 so we try -A flag this time can’t bind local address: Address Already in use 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 50

UDP Server Design l multicating을 지원하는 시스템의 경우 • Multiple end point - same

UDP Server Design l multicating을 지원하는 시스템의 경우 • Multiple end point - same local IP addr & UDP port number 가능 • 예) 4. 4 BSD는 multicasting을 지원 l Multiple end point - same local IP addr & UDP port number • destination IP addr =broadcast or multicast addr. – incoming datagram이 각 end point에 전달됨. • destination IP addr =broadcast or multicast addr. – incoming datagram 이 하나의 end point에만 전달됨. 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 51

Summary n UDP is a simple protocol. l n ICMP unreachable error는 new path

Summary n UDP is a simple protocol. l n ICMP unreachable error는 new path MTU discovery feature이 다. l n Traceroute와 UDP를 이용한 path MTU discovery UDP와 ARP간의 interaction l n UDP가 user process에 제공하는 서비스는 단지 port number들 과 optional checksum뿐이다. 대부분의 ARP implementation들은 ARP 응답을 기다리는 동안, 주어진 목적지에 가장 최근에 전송된 datagram을 보류한다. ICMP source quech error는 처리할 수 없을 정도로 빠르게 datagram을 받을 때 발생할 수 있다. l UDP를 이용하면, 쉽게 error를 발생시킬 수 있다. 정보통신연구실 성균관 대학교 Sung. Kyun. Kwan Univ. 52