TCP/IP - MTU, MSS, PMTUD

1. MTU

  • Maximum Transmission Unit ์˜ ์•ฝ์ž๋กœ,

  • ๋„คํŠธ์›Œํฌ์— ์—ฐ๊ฒฐ๋œ ์žฅ์น˜๊ฐ€ ๋ฐ›์•„๋“ค์ผ ์ˆ˜ ์žˆ๋Š” ์ตœ๋Œ€ ๋ฐ์ดํ„ฐ ํŒจํ‚ท์˜ ํฌ๊ธฐ๋ฅผ ๋งํ•œ๋‹ค.

  • ์ด ํฌ๊ธฐ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๋ฐ์ดํ„ฐ๋Š” ์ชผ๊ฐœ์ ธ์„œ ํŒจํ‚ทํ™”๊ฐ€ ๋œ๋‹ค.

  • ๋„คํŠธ์›Œํฌ ๊ฒฝ๋กœ ์ƒ์— ์žˆ๋Š” ์•„๋ฌด ์žฅ์น˜๋‚˜ MTU ๋ณด๋‹ค ํŒจํ‚ท์ด ํฌ๋ฉด, ๊ทธ ํŒจํ‚ท์€ ๋ถ„ํ• ๋  ์ˆ˜ ์žˆ๋‹ค.

  • ์˜ˆ๋ฅผ ๋“ค์–ด, ์•„๋ž˜์™€ ๊ฐ™์€ ๊ณผ์ •์„ ํ†ตํ•ด 1500 bytes ์˜ ๋ฐ์ดํ„ฐ ํŒจํ‚ท์ด ์ „์†ก๋˜๊ณ  ์žˆ๋‹ค๊ณ  ํ•ด๋ณด์ž๋ฉด,

    • Computer

    • Router B(max : 1500b)

    • Router C(max : 1400b)

    • Server

  • ์ปดํ“จํ„ฐ๋กœ๋ถ€ํ„ฐ ๋ฐ์ดํ„ฐ ํŒจํ‚ท์ด ์ถœ๋ฐœํ•˜๊ฒŒ ๋˜๋ฉด ์ด๋ฏธ ๋ผ์šฐํ„ฐB ๋‚ด๋ถ€์—์„œ ๋‹ค์Œ ๋ผ์šฐํ„ฐC๋ฅผ ๊ฑฑ์ •ํ•˜์—ฌ ํŒจํ‚ท์ด 100 + 1400 ์ฒ˜๋Ÿผ ๋‘˜๋กœ ์ชผ๊ฐœ์ ธ์„œ ์ „๋‹ฌ๋˜๊ฒŒ ๋œ๋‹ค. ๊ทธ๋ž˜์•ผ ๋ผ์šฐํ„ฐC๋ฅผ ๋ฌด์‚ฌํžˆ ํ†ตํ™”ํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.

1-1. ํŒจํ‚ท์ด ๋ถ„ํ• ๋˜์ง€ ์•Š์„ ๋•Œ

  • ๋ชจ๋“  ํŒจํ‚ท์ด ์ž๋™์œผ๋กœ ๋ถ„ํ• ๋˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋‹ค. ํŒจํ‚ท์ด ๋ถ„ํ• ๋  ์ˆ˜ ์—†์–ด์„œ ๋„คํŠธ์›Œํฌ ๊ฒฝ๋กœ ์ƒ์— ์žˆ๋Š” ์–ด๋– ํ•œ ๋ผ์šฐํ„ฐ๋‚˜ ์žฅ์น˜์˜ MTU ๋ฅผ ์ดˆ๊ณผํ•œ๋‹ค๋ฉด, ํŒจํ‚ท์„ ๋ถ„ํ• ํ•ด์„œ ์ „๋‹ฌํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ, ์•„์˜ˆ ์ „๋‹ฌํ•˜์ง€ ์•Š์„์ˆ˜๋„ ์žˆ๋‹ค.

  • IPv6 : ์•„์˜ˆ ๋ถ„ํ• ์„ ํ—ˆ์šฉํ•˜์ง€ ์•Š์Œ

  • IPv4 : flag ๊ฐ’์— ๋”ฐ๋ผ ๋‹ค๋ฅด๋‹ค.

    • 0: reserved

    • 1: don't fragment

    • 2: more fragments

2. MTU and MSS

  • MTU : Maximum Transmission Unit

    • IP header + TCP header + data (payload)

  • MSS : Maximum Segment Size

    • only data(payload)

  • ์ผ๋ฐ˜์ ์œผ๋กœ MTU๋Š” 1500 ๋ฐ”์ดํŠธ์ด๊ณ , MSS๋Š” 1460 ๋ฐ”์ดํŠธ์ด๋‹ค.

    • 20byte : ip header

    • 20byte : tcp header

  • ์ฆ‰, MTU = MSS + IP ํ—ค๋” + TCP ํ—ค๋”

  • ๋”ฐ๋ผ์„œ ๋„คํŠธ์›Œํฌ๋ฅผ ํ†ตํ•ด ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด๋‚ผ ๋•Œ, MTU ๊ฐ€ 1500์ด๋”๋ผ๋„, ๋ฐ์ดํ„ฐ๋Š” ๋ณดํ†ต 1460 ๋ฐ”์ดํŠธ ์ดํ•˜๋กœ ๋ณด๋‚ด์•ผ ์ „์†ก์ด ์ •์ƒ์ ์œผ๋กœ ๋œ๋‹ค.

  • ๊ทธ๋Ÿฌ๋‚˜ TCP ๋“ฑ์„ ์•ˆ์“ด๋‹ค๋ฉด ์ด๋Š” ๋‹ฌ๋ผ์งˆ ์ˆ˜ ์žˆ์Œ!

2-1. MTU, MSS ํ…Œ์ŠคํŠธํ•˜๊ธฐ (MAC ํ™˜๊ฒฝ)

// ์ „์†ก ๋ฐ์ดํ„ฐ ์œ ๋‹› ์‚ฌ์ด์ฆˆ๊ฐ€ 1500 ์ผ๋•Œ  
ping -D -s 1500 www.google.com
PING www.google.com (142.250.196.132): 1500 data bytes
ping: sendto: Message too long
ping: sendto: Message too long
Request timeout for icmp_seq 0
ping: sendto: Message too long
--- www.google.com ping statistics ---
9 packets transmitted, 0 packets received, 100.0% packet loss


// ์ „์†ก ๋ฐ์ดํ„ฐ ์œ ๋‹› ์‚ฌ์ด์ฆˆ๊ฐ€ 1460 ์ผ๋•Œ 
๎‚ฐ ping -D -s 1460 www.google.com
PING www.google.com (142.250.196.132): 1460 data bytes
76 bytes from 142.250.196.132: icmp_seq=0 ttl=114 time=39.657 ms
wrong total length 96 instead of 1488
76 bytes from 142.250.196.132: icmp_seq=1 ttl=114 time=39.159 ms
^C
--- www.google.com ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 32.495/35.390/39.657/3.287 ms
  • ping: IP ํ”„๋กœํ† ์ฝœ์—์„œ ํ˜ธ์ŠคํŠธ๊ฐ„์˜ ๋„คํŠธ์›Œํฌ ์—ฐ๊ฒฐ์ด ์ •์ƒ์ ์œผ๋กœ ์ž‘๋™ํ•˜๋Š”์ง€ ํ…Œ์ŠคํŠธํ•˜๋Š” ๋ช…๋ น์–ด.

  • -D: IP "Don't Fragment" ๋น„ํŠธ๋ฅผ ์„ค์ •ํ•˜๋Š” ์˜ต์…˜. ํŒจํ‚ท ํ”„๋ ˆ๊ทธ๋จผํŠธ๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ์ „์†ก๋˜์–ด์•ผ ํ•จ์„ ์š”๊ตฌํ•ฉ๋‹ˆ๋‹ค.

  • -s: ๋ฐ์ดํ„ฐ ๊ธธ์ด๋ฅผ ์ง€์ •ํ•˜๋Š” ์˜ต์…˜. ์ด ๊ฒฝ์šฐ "mtu" ๋ณ€์ˆ˜์˜ ๊ฐ’์ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.

  • www.google.com: ํŒจํ‚ท์ด ์ „์†ก๋  ๋ชฉ์ ์ง€ ํ˜ธ์ŠคํŠธ ์ด๋ฆ„ ๋˜๋Š” IP ์ฃผ์†Œ์ž…๋‹ˆ๋‹ค.

  • -c 1: ํŒจํ‚ท ํ•˜๋‚˜๋งŒ ์ „์†กํ•˜๋Š” ์˜ต์…˜.

  • > /dev/null 2>&1: ํŒจํ‚ท ํ…Œ์ŠคํŠธ์˜ ์ถœ๋ ฅ์„ ๋ฌด์‹œํ•˜๋„๋ก ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

2-2. PMTUD

  • PMTUD : Path MTU Discovery

  • ์ˆ˜์‹ ์ž์™€ ์†ก์‹ ์ž์˜ ๊ฒฝ๋กœ ์ƒ์—์„œ ์žฅ์น˜๊ฐ€ ํŒจํ‚ท์„ ๋ˆ„๋ฝํ•œ ๊ฒฝ์šฐ, ํ…Œ์ŠคํŠธ ํŒจํ‚ท์˜ ํฌ๊ธฐ๋ฅผ ๋‚ฎ์ถ”๋ฉด์„œ MTU์— ๋งž๊ฒŒ๋” ๋ฐ˜๋ณตํ•ด์„œ ๋ณด๋‚ด๋Š” ๊ณผ์ •์„ ๋งํ•œ๋‹ค.

Last updated