๐Ÿ”Œ Subnetting ๊ณ„์‚ฐ

Q. 172.31.0.0/24 ์„ IP ์ฃผ์†Œ 30๊ฐœ์”ฉ ์„œ๋ธŒ๋„ทํŒ…
๋ช‡ ๊ฐœ์˜ ์„œ๋ธŒ๋„ท์ด ๋‚˜์˜ค๋Š”์ง€, ๊ฐ ์„œ๋ธŒ๋„ท์˜ Network Address, Broadcast Address, ํ• ๋‹น ๊ฐ€๋Šฅํ•œ IP ์ฃผ์†Œ ๋Œ€์—ญ์€?


Q. 172.16.0.0/16 ์„ ์„œ๋ธŒ๋„ท 4๊ฐœ๋กœ ๋‚˜๋ˆ„๋ ค๊ณ  ํ•จ
๊ฐ ์„œ๋ธŒ๋„ท์˜ Network Address, Broadcast Address, ํ• ๋‹น ๊ฐ€๋Šฅํ•œ IP ๋Œ€์—ญ์€?


๐Ÿ’ก ํŒ€์›๋ถ„๊ป˜ ์–ป์€ ํ’€์ด ํŒ!


๐Ÿ”Œ ๋„คํŠธ์›Œํฌ(์ธํ„ฐ๋„ท) ๊ณ„์ธต IP Header

์•„๋ž˜ ๊ทธ๋ฆผ์€ IPv4 ์˜ IP ํ—ค๋” ๊ทธ๋ฆผ. ๋ณดํ†ต 20~50 byte ๊ธธ์ด

*IPv6 ํ—ค๋”์—์„œ๋Š” payload length ๋ผ๊ณ  ๋”ฐ๋กœ ์žˆ์–ด์„œ ๋ฐ์ดํ„ฐ ๊ธธ์ด๋ฅผ ๊ณ„์‚ฐํ•  ํ•„์š”๊ฐ€ ์—†์Œ

MTU(Maximum Transmission Unit) : ์ตœ๋Œ€ ์ „์†ก ๋‹จ์œ„ (byte)
๋ณดํ†ต ์ด๋”๋„ท MTU ๊ฐ€ 1500byte ์ธ๋ฐ, ์ด๊ฒƒ๋ณด๋‹ค ํŒจํ‚ท์˜ ํฌ๊ธฐ๊ฐ€ ํฌ๋‹ค๋ฉด ๋ผ์šฐํ„ฐ๋Š” ๋ถ„ํ• (Fragmentation)์„ ์‹œ๋„ํ•จ. ๊ทธ๋Ÿฌ๋‚˜ flag์˜ D๊ฐ€ 1์ด๋ฉด ํŒจํ‚ท์„ ๋ฒ„๋ฆฌ๊ฒŒ ๋จ

*TTL ์€ ๋ฃจํ•‘ ๋ฐฉ์ง€ ๋ชฉ์ ์œผ๋กœ ์‚ฌ์šฉ๋จ


๐Ÿ”Œ ICMP

IP๋Š” ์‹ ๋ขฐ์„ฑ์„ ๋ณด์žฅํ•˜์ง€ ์•Š์Œ. ๊ทธ๋ž˜์„œ ICMP๊ฐ€ ๋„คํŠธ์›Œํฌ ์˜ค๋ฅ˜ ์ •๋ณด ๋ฉ”์„ธ์ง€๋ฅผ ์ „๋‹ฌํ•จ
ํ—ค๋”๊ฐ€ Code + Type + checksum ์œผ๋กœ ์ด๋ฃจ์–ด์ง

*IP ํ• ๋‹นํ•œ ํ›„ IP ํ†ต์‹  ์ž˜๋˜๋Š”์ง€ ํ™•์ธํ•  ๋•Œ ๋งŽ์ด ์”€

๊ธฐ๋Šฅ

์˜ค๋ฅ˜ ๋ณด๊ณ 

  • Destination unreachable: ๋ชฉ์ ์ง€์— ๋„๋‹ฌํ•  ์ˆ˜ ์—†์Œ
  • Source unreachable: ๋ผ์šฐํ„ฐ๊ฐ€ PC ์—๊ฒŒ ํŠธ๋ž˜ํ”ฝ์ด ๋„ˆ๋ฌด ๋งŽ์•„ ํž˜๋“œ๋‹ˆ ์ฒœ์ฒœํžˆ ๋ณด๋‚ด๋ผ๊ณ  ํ•˜๋Š” ๊ฒƒ (๋ผ์šฐํ„ฐ ใ…Žใ…‡ใ…Œ)
  • Time exceed: TTL ๋งŒ๋ฃŒ
  • Prameter problems: ํŒŒ๋ผ๋ฏธํ„ฐ ๊ฐ’์ด ์ž˜๋ชป๋จ
  • Redirection: GW ๊ฐ€ 2๊ฐœ์ธ ๋„คํŠธ์›Œํฌ๋ง์—์„œ ๊ณต์ธ๋ง(GW1)์ด ์•„๋‹Œ ์›น์„œ๋ฒ„(GW2)๋กœ ๋‚˜๊ฐ€๊ณ  ์‹ถ์„ ๋•Œ GW1 ์ด GW2 ๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŒ… ํ•ด์คŒ

์ฟผ๋ฆฌ

  • Echo request and reply : ping 8.8.8.8 ๋ณด๋‚ด๋ฉด ์˜๋ฏธ์—†๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์ฃผ๊ณ  ๋ฐ›์Œ
  • Timestamp request and reply: ์ง€๊ธˆ ๋ช‡์‹œ์ธ์ง€ ์š”์ฒญ ํ›„ ๋‹ต ๋ฐ›์Œ
  • Address mask request and reply: ์ฃผ์†Œ ๋งˆ์Šคํฌ ์ •๋ณด ์š”์ฒญ ํ›„ ๋‹ต ๋ฐ›์Œ
  • Router solicitation and advertisement: PC ์™€ ๋ผ์šฐํ„ฐ ํ†ต์‹  ๋ชฉ์ 

ํŠน์ง•

  • ์œ„์—์„œ IP ์‹ ๋ขฐ์„ฑ์„ ๋ณด์žฅํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ์˜ค๋ฅ˜ ์ •๋ณด๋ฅผ ์ „๋‹ฌํ•˜์—ฌ ๋Œ€์ฒ˜ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•œ๋‹ค๊ณ  ํ–ˆ๋Š”๋ฐ,
    ๊ทธ๋ ‡๋‹ค๊ณ  ํ•ด์„œ ์‹ ๋ขฐ์„ฑ ์žˆ๋Š” ์ „์†ก์„ ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•˜๋Š” ๊ฑด ์•„๋‹˜

  • ๊ธฐ๋Šฅ์—์„œ ๋งํ•œ๊ฑฐ์™€ ๊ฐ™์ด, ๊ทธ๋ƒฅ ์˜ค๋ฅ˜ ๋ณด๊ณ  + ์ฟผ๋ฆฌ ๋ชฉ์ ์ž„

  • ์ฒซ๋ฒˆ์งธ ๋ฐ์ดํ„ฐ๊ทธ๋žจ์— ๋Œ€ํ•œ ๋‹จํŽธํ™”์— ๋Œ€ํ•ด์„œ๋งŒ ์˜ค๋ฅ˜ ๋ณด๊ณ ํ•จ

  • ์˜ค๋ฅ˜ ๋ณด๊ณ  ๋งค์ปค๋‹ˆ์ฆ˜์ž„. ๋ฐ์ดํ„ฐ๊ทธ๋žจ ๋ฌธ์ œ์— ๋Œ€ํ•œ ์˜ค๋ฅ˜ ๋ฉ”์„ธ์ง€ ๋ฐœ์ƒ์‹œํ‚ค๋Š” ๊ฑด ์•„๋‹˜

Type / Message (์ด๊ฑด ๋ชป์™ธ์›€)

Error Reporting

ํƒ€์ž…๋ฉ”์„ธ์ง€
0์—์ฝ” ์‘๋‹ต (Echo Reply)
3์ˆ˜์‹ ์ง€ ๋„๋‹ฌ ๋ถˆ๊ฐ€๋Šฅ ( Destination Unreachable)
4๋ฐœ์‹  ์ œํ•œ (Source Quench)
5๋ผ์šฐํ„ฐ ๋ณ€๊ฒฝ (redirect)
8์—์ฝ” ์š”๊ตฌ (Echo Request)
11์‹œ๊ฐ„ ์ดˆ๊ณผ (Time Exceeded)
12ํŒŒ๋ผ๋ฏธํ„ฐ ๋ถˆ๋Ÿ‰ (Parameter Problem)

Desitinatino Unreachable Code

  • 0: Net Unreachable
  • 1: Host Unreachable
  • 2: Protocol Unreachable
  • 3: Port Unreachable (UDP ์„œ๋น„์Šค์— ๋Œ€ํ•ด ์„œ๋น„์Šคํ•˜๊ณ  ์žˆ์ง€ ์•Š์Œ ex) DNS, TFT ํŒŒ์ผ ์ „์†ก ์‹œ์Šคํ…œ)
    ...
  • 9: Network Administratively Prohibited (๋„คํŠธ์›Œํฌ ์žฅ๋น„์—์„œ ์ฐจ๋‹จ)
  • 10: Host Administratively Prohibited (๋„คํŠธ์›Œํฌ ์žฅ๋น„์—์„œ ์ฐจ๋‹จ)
  • 11: Network Unreachable


Query

ํƒ€์ž…๋ฉ”์„ธ์ง€
13ํƒ€์ž„์Šคํƒฌํ”„ ์š”๊ตฌ (Timestamp Request)
14ํƒ€์ž„์Šคํƒฌํ”„ ์‘๋‹ต (Timestamp Reply)
15์ •๋ณด ์š”๊ตฌ (Information Request)
16์ •๋ณด ์‘๋‹ต (Information Reply)
17์ฃผ์†Œ ๋งˆ์Šคํฌ ์š”๊ตฌ (Address Mask Request)
18์ฃผ์†Œ ๋งˆ์Šคํฌ ์‘๋‹ต (Address Mask Reply)

์‹ค์Šต

  • ์™€์ด์–ด์ƒคํฌ๋ฅผ ์ด์šฉํ•˜์—ฌ ํŒจํ‚ท ๋ถ„์„ํ•ด๋ณด๊ธฐ

  • ICMP ping Gateway๋กœ ๋ณด๋‚ด๊ธฐ

์™€์ด์–ด์ƒคํฌ์—์„œ icmp ๋กœ ํ•„ํ„ฐ ํ›„ ํ™•์ธํ•ด๋ณด๋ฉด ์ด 8๊ฐœ์˜ ํ•ญ๋ชฉ์ด ์บก์ณ๋œ ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Œ (ping ์„ ์ด 4๋ฒˆ ๋ณด๋ƒˆ๊ธฐ ๋•Œ๋ฌธ์— ์‘๋‹ต๋„ 4๋ฒˆ)

*ipconfig ๋ช…๋ น์–ด ์‚ฌ์šฉ์‹œ Gateway, broadcast, ์„œ๋ธŒ๋„ท ๋งˆ์Šคํฌ ๋“ฑ์˜ ๋„คํŠธ์›Œํฌ ์ •๋ณด๋ฅผ ๋ณผ ์ˆ˜ ์žˆ์Œ
*Time out ์ด ๋œจ๋ฉด ๋ฐฉํ™”๋ฒฝ์—์„œ ICMP ping ์„ ํ—ˆ์šฉํ•˜์ง€ ์•Š๊ณ  ์žˆ๋Š” ๊ฒƒ

์™€์ด์–ด์ƒคํฌ๋กœ ๊ฒŒ์ดํŠธ์›จ์ด๋กœ ๋ณด๋‚ธ ํŒจํ‚ท์˜ ์ •๋ณด๋ฅผ ์ž์„ธํžˆ ๋ณผ ์ˆ˜ ์žˆ์Œ

[ ] ์•ˆ์˜ ์ •๋ณด๋Š” ์™€์ด์ปค์ƒคํฌ๊ฐ€ ๋ถ„์„ํ•ด์ค€ ๋ถ€๋ถ„



  • ICMP ์˜ค๋ฅ˜ ๋ฉ”์„ธ์ง€ ํ™•์ธํ•ด๋ณด๊ธฐ

nslookup ํ›„ DNS ํ•  ์„œ๋ฒ„๋ฅผ server x.x.x.x ๋กœ ๋ณ€๊ฒฝํ•ด์ค€ ๋’ค DNS ์ฟผ๋ฆฌ ๋‚ ๋ ค๋ด„
๋‹น์—ฐํžˆ ๊ฐ•์‚ฌ๋‹˜ ์ปดํ“จํ„ฐ์—” DNS ์„œ๋ฒ„๊ฐ€ ๊ตฌ์ถ•๋˜์–ด ์žˆ์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— Time out ๋จ

์™€์ด์–ด ์ƒคํฌ๋กœ ํ•ด๋‹น ํŒจํ‚ท ์˜ค๋ฅ˜์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ํ™•์ธํ•ด ๋ณด์•˜์Œ

  • UDP ์„œ๋น„์Šค ์ค‘ ํ•˜๋‚˜์ธ DNS ๊ฐ€ ์„œ๋น„์Šค๋˜์ง€ ์•Š๋Š”๋‹ค๋Š” ๊ฒƒ์„ ์•Œ๋ ค์ฃผ๊ณ  ์žˆ์Œ
  • ๋”ฐ๋ผ์„œ Type 3 ์˜ Code 3 ์— ํ•ด๋‹นํ•˜๋Š” ์˜ค๋ฅ˜ ์ •๋ณด๋ฅผ ICMP ๋กœ ์•Œ๋ ค์คŒ
  • filter ๊ฐ€ udp.port==53 ์ธ๋ฐ ICMP ์ •๋ณด๊ฐ€ ๋ณด์ด๋Š” ๊ฒƒ์€ ํŒจํ‚ท์— DNS ์ฟผ๋ฆฌ ์ •๋ณด๋„ ๊ฐ€์ง€๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž„

* 53๋ฒˆ port ๋Š” DNS port

๐Ÿ”Œ Port Number

ํ‘œ๊ธฐ
16๋น„ํŠธ 2162^{16} (0 ~ 65535)

3๊ฐ€์ง€ ๋ฒ”์œ„

-------- ์„œ๋ฒ„์šฉ ํฌํŠธ ----------
System port (0 ~ 1023) : ์ž˜ ์•Œ๋ ค์ง„ ํฌํŠธ
User port (1024 ~49151) : Registered Port ๋ผ๊ณ ๋„ ํ•จ, ๋ฒ”์šฉ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜๊ณผ ๊ฐ™์ด ์ด๋ฏธ ๋“ฑ๋ก๋œ ํฌํŠธ
------ ํด๋ผ์ด์–ธํŠธ์šฉ ํฌํŠธ -------
Private Port (49152 ~ 65535) : Dynamic Port ๋ผ๊ณ ๋„ ํ•จ, ์ž„์‹œ ํฌํŠธ

RFC 6335 ์ฐธ๊ณ 

0๊ฐœ์˜ ๋Œ“๊ธ€