Chapter 22. IPv6
22.1 IPv6 Addressing
- IPv4 주소 할당 문제를 해결하기 위해 IPv6 사용한다.
- IPv6는 128bit로 구성, 각 자리는 16진수로 표현
- 16 bit씩 끊어서 표현한다. 16진수 숫자 하나는 4bit
0 Abbreviation
- 앞자리 0은 생략
- 연속된 0 section들은 축약해서 더블 콜론(::)으로 표시. 가장 긴 부분에 한번만 적용 가능.
Address Scopes
- Unicast Address : one-to-one, Sender-Receiver
- Global Unicast (2000::/3, 001로 시작하는 모든 주소) 전체주소의 1/8Interface ID : OS에 따라 다르게 설정
- EUI-64 : 7번째 bit를 0에서 1로 바꾸고 중간에 FF:FE 추가
- Global routing prefix(Site) + Subnet Identifier(Subnet) + Interface Identifier(Interface)
- Link-Local Unicast (FE80::/10)주소를 얻기 전 local route나 DHCPv6서버와 통신할 때 source 주소로 사용Link local address만 가지고 Global unicast address를 가지지 않을 수도 있다. (ex.프린터)
- 모든 기기 반드시 이 주소를 가진다.
- Link 내에서만 유효
- Unspecified Address (::/128)스스로 설정한 link-local address가 서브넷 상에 동일한 주소가 있는지 확인
- 최초에 주소가 없을 때 source 주소로 사용
- Loopback Address (::1/128)IPv4의 127.0.0.1/8
- 기기 밖으로 나가지 않고 내부에서 수신하는 주소 (1개)
- IPv4-mapped Address (::FFFF:0:0/96)외부로 전달되는 주소로는 사용되지 않음.
- IPv6 전용 Application process가 IPv4 주소를 내부적으로 처리할 때 사용
- Unique Local Address (FC00::/7)Cooperating Site 내에서만 라우팅 가능
- Private address
- Anycast Address : one-to-any, receiver는 동일한 IP주소 사용, IP주소만으로는 구분이 안됨.
- Multicast Address : one-to-many, 모든 컴퓨터가 데이터 수신
- (FF00::/8), FF로 시작하는 모든 주소
- Flag, Scope 설정 가능
- FF02::1 → All nodes for this link (Broadcast)
- FF02::2 → All routers for this link
Autoconfiguration
- Router Soilicitation
- Router AdvertisementConfiguration flags : 지정하는 방식으로 주소 정함. (SLAAC, Stateless/Stateful)
- 주기적으로 라우터가 자신을 알림.
22.2 IPv6 Protocol
Packet Format
- Base Header(40bytes) + Payload(IPv6 Extension Header + Data)
- Payload length(16bits) : Base Header를 제외한 길이(Payload)
- Next Header : Fragmentation
- IPv6는 source에 의해서만 fragmentation 될 수 있다.
- Hop limit : TTL(IPv4)
Extension Header
- Hop-by-Hop
- Destination
- Source routing
- Fragmentation
- Authentication
- Encrypted Security Payload (기밀성 유지, 암호화)
22.3 ICMPv6 Protocol
Error messages
- Destination unreachable도착했어도 upper layer에 deliver할 수 없음
- router가 packet을 forward 할 수 없음
- Packet too big
- Time exceeded
- Parameter problems
Informational messages
- echo request
- echo reply messages
- ping, tracert로 확인할 수 있음
Neighbor discovery(ND) messages (IPv6)
Router-Solicitation message (RS)
Router-Advertisement message (RA)
Neighbor-Solicitation message (NS)
Neighbor-Advertisement message (NA)
Redirection message
- Router and prefix discovery = RS, RA
- 처음에 IP 주소를 얻기 위해 자신의 link내의 router와 통신
- Address resolution = NS, NA
- 상대 host의 주소는 알지만 mac 주소를 모를 때 사용
- Duplicate Address Detection(DAD) = NS, NA
- 자신이 가진 주소가 link 내에서 유일한지 조사
- Redirection = Redirection message
- router가 sender에게 더 좋은 경로를 알려줄 때
Group membership messages (IPv6)
22.4 IPv4 to IPv6 Transition
Dual Stack
- Complete Support for both
Tunneling
- IPv6 is encapsulated in an IPv4 packet
Header translation
- IPv6 host ↔ IPv4 host
- NAT64
- IPv6-initiated, IPv4-initiated
Chapter 23. Introduction to Transport Layer
Introduction
Process
- Process-to-process communication
- Process : application-layer entity
- Responsible for providing services to the upper layer(application layer)
Port Number
- application 안에서 process를 구분
- Client (short-lived port num.) : 통신을 initiate, server쪽 port number 알아야 한다.
- Server (well-known port num. 0~1023) : 통신을 기다림, 통신을 받을 때 client의 port number도 같이 받는다.
Socket Address
- IP 주소 + Port Number (Source & Destination)
Flow Control
- Pushing : 데이터가 너무 빨리 전송되어 receiver에서 처리하지 못할 때
- Pulling : 데이터가 너무 느리게 전송되어 resources가 낭비될 때
Error Control
- Transport Layer : Reliable
- Error detection, correction code
- Sequence number (modulo $2^m$)
- Acknowledgement (ACK)
Sliding Window
- Flow + Error control
- Seq. number (modulo $2^m$)
- Window size : 너무 크면 안된다.
- Outstanding Packet : sent, but not acknowledged
Congestion Control
Connection-oriented / Connectionless
- UDP : connectionless, independcy between packets
- TCP : connection-oriented, dependcy between packetsrouter는 logical connection과 상관 없다.패킷의 순서가 맞지 않으면 hold하다가 이후에 순서를 맞춰 upper layer에 보낸다.
- Reliable : Flow, Error, Congestion control can be implemented
- Set-up phase 필요
Transport-Layer Protocols
Simple connectionless protocol (UDP)
Stop-and-wait Protocol
- Send window = Receive window = $1$
- Sender가 패킷을 한 번에 하나만 보내고 ACK가 올 때까지 기다림
- ACK : 다음 받을 패킷의 seq. no.
- large bandwidth, long round-trip delay(Large RTT) channel에는 비효율적이다.
Pipelining
- ACK를 기다리지 않고 연속적으로 패킷을 보냄 = 여러개의 outstanding 패킷이 존재하게 함
Go-Back-N (GBN) Protocol
- Send window($S_{size}$) < $2^m$, Receiver Window = $1$
- $S_{size}=2^m$ 이 되면 ACK가 안가도 정상적으로 받은 것처럼 인식될 수 있음
- Cumulative ACK : 중간에 ACK만 lost 되어도 마지막 ACK로 sliding 됨
- Timer = RTT의 평균 + 4$\sigma$
- 장점 : Seq no에 맞지 않게 받으면 모두 버리기 때문에 Receiver에 버퍼가 필요 없음
- 단점 : 하나의 패킷이라도 받지 못하게 되면 outstanding 패킷을 모두 다시 보내야함
Selective-Repeat (SR) Protocol
- Send window($S_{size}$) = $2^{m-1}$, Receiver Window = $2^{m-1}$
- Send, receiver window size > $2^{m-1}$ 안됨
- 중간에 패킷이 lost 되어도 이후의 ACK를 보냄
- Cumulative ACK 아님
- Time-out 이후 ACK를 못받은 패킷을 sender가 다시 보냄
- GBN보다 send window size 작게 해야하기 때문에 Pipelining 효과는 줄어듦
Bidirectional Protocols
- Piggybacking : ACK에도 data를 실어 보낼 수 있음
Chapter 24. Transport Layer Protocols
Introduction
- OSINetwork, Transport Layer : 크게 변화 없다.
- Maximum Transmission Unit (MTU) : Data-link에서 정해진다.
- Physical, Data-link Layer : 발전속도가 빠르다. (전송속도 높이기 위해)
- Port NumberDHCP : 67HTTPS : 443
- HTTP : 80
- DNS : 53
UDP (User Datagram Protocol)
- Unreliable, Connectionless
- Minimum overhead
- Packet : User datagram
- Header (8 bytes = 64 bits, 16진수로 16 bit 4자리씩)
- Source port num. + Dest. port num. + Total length + Checksum
- Data
- User Datagram format
- Total length = Header length(8 bytes) + Data length
- Checksum : (-) header의 다른 부분(Pseudoheader+Header+Data)을 16 bit씩 나누어 모두 더한 값을 저장, user datagram 모두 더한 값 = 0 (엄밀히 말하면 계층화를 깬다)
- UDP 사용
- Short request & response (DNS)
- Multimedia Communications (bandwidth determined by application)손실 어느정도 허용, 속도가 더 중요
- real-time interactive ($RTT < 150ms$ : strict delay) application에 적합
- Multicasting
- SNMP (Simple Network Management Protocol)
- SMTP, large file transfer에는 적잡하지 않음
TCP
- Reliable, Connection-oriented, flow & error control
- GBN + SR 사용
- Packet : Segment
- Stream of btyes (순서 보장)실제로는 physically TCP receiver에서 순서 맞춘다.
- 응용계층에서 logically 볼 때, socket을 통해 파일에 읽고 쓰듯이 프로그래밍함
- BufferIP 계층에서는 패킷들로 데이터를 보내므로 이에 맞춰 TCP에서도 segment로 나누어 보냄
- Sender, Receiver에 버퍼 서로 같을 필요는 없다.
- Segment
- Byte Numbering : 송신 또는 수신한 byte 수로 seq. no./ ACK no. 붙임.
- Sequence Number : 랜덤한 initial number
- ACK Number : 다음에 받을 segment의 byte number
- Segment format
- HLEN : Header Length 4 byte 단위
- Control Field (Flag) : bit = 1 일때 set
- flow control, connection establishment/terminiation, connection abortion, mode of data transfer
- Connection Estabilishment (SYN+ACK)
- 3-Way Handshaking
- SYN : initial seq. no.
- data carry X, seq. no. +1
- SYN + ACK : data carry X, seq. no. +1
- ACK : data carry O (piggybacking), seq. no. +0 (data 없을 때)
- 3-Way Handshaking
- SYN Flooing Attack (DOS Attack)SYN 제한, 주소 필터링, 쿠키로 해결
- 한 번에 많은 SYN segment를 server에 보내 resource를 차지하는 공격
- Pushing Data (PSH)Delay sensitive한 데이터를 buffer에 차기 전에 수신하는 즉시 application으로 보냄
- Control Field : PSH flag
- Connection Termination (FIN)
- 3-Way HandshakingACK : 마지막 ACK는 data를 포함할 수 없음
- FIN, FIN+ACK : Final data를 포함할 수 있음
- 4-Way Handshaking with half-close
- Client가 데이터와 FIN seg.을 보내고 ACK를 받아 half-close
- Server가 sorting을 수행해 끝내면 client에 데이터 전송
- Client ACK
- 데이터 전송 모두 끝나면 Server도 FIN seg. 보내고 ACK 받아서 Termination
- Windows
- Send Window : controlled by receiverRight wall : receiver rwnd and ACK에 따라 shrinks, opens
- Left wall : outstanding 패킷이 ACK되면 closes
- Receive Window (rwnd): controlled by processRight wall : process가 data pull 하면 open (shrink X)
- Left wall : process가 buffer를 읽었을 때 closes
- Client, Sever 모두 둘 다 가지고 있다.
- Error ControlError control 을 위한 ACK, Retransmission 규칙
- ACK is piggybacked
- ACK delaying
- 다음 전송할 데이터를 기다렸다가 piggyback ACK
- 다음 segment가 도착하기를 기다렸다가 한꺼번에 cumulative ACK
- ACK delaying timer 만료되면 ACK
- ACK를 안보낸 상태에서 다음 order segment가 도착하면 즉시 ACK
- out-of-order data segment가 도착하면 즉시 ACK (order를 다시 알려줌)
- Missing Segment : 즉시 ACK
- Duplicate Degment : discard, 즉시 ACK
- Retransmission Time-out (RTO)
- RTO Timer expires
- 재전송 후 timer restart
- RTT 기반으로 적절한 값으로 설정
- Rule of Fast RetransmissionReceiver는 rwnd 안이라면 out of order 패킷도 받아놓는다.
- Original ACK + 같은 ACK 3개 : sender가 받으면 즉시 재전송
- TCP ACK : cumulative ACK (ACK flag = 1)
- Congestion Control
- Congestion Windowcwnd 값을 늘리거나 줄일 때의 단위 : MSS(maximum segment size)Time-out, 3 Duplicate ACKs 를 가지고 네트워크 상황 판단
- $Actual \ Send \ Window \ Size=min{rwnd, cwnd}$
- cwnd를 이용하여 send window 크기를 조절한다.
- Slow Start algorithm
- 초기 cwnd = 1 MSS
- ACK 하나마다 1 MSS 증가 (매 RTT마다 2배씩 증가)
- slow-start threshold (ssthresh)가 될 때까지 적용
- Congestion Avoidance Algorithm
- ssthersh 넘어서면 ACK 하나 받을 때마다 1/cwnd MSS 만큼 증가
- 전체 ACK를 받으면 cwnd 1 증가 = RTT마다 1씩 증가 (선형적)
- Fast Recovery Algorithm
- 3 duplicate ACKs 왔을 때 fast recovery 구간으로 진입
- cwnd = ssthresh + 3
- duplicate ACKs 올 때마다 cwnd 1씩 증가
- New ACK가 오면 구간을 벗어나고 cwnd = ssthresh, congestion avoidance 구간으로 진입
- Classical Congestion Control
- TCP Tahoe : Slow start, Congestion Avoidance
- TCP Reno : Slow start, Congestion avoidance, Fast recovery
- AIMD : 대부분의 시간은 CA구간에 머무름. 결과적으로 Addictive increase, multiplicative decrease (톱니 모양)
- Reno Throughput : cwnd 값은 $W_{max}$와 $0.5W_{max}$ 사이를 움직인다.
- $throughput= {0.75W_{max}}\ / \ {RTT}$
- Retransmission Timer$RTO=RTT_S+4 \times RTT_D$
- 맨 앞에 있는 segment가 전송될 때, RTO 타이머 작동
- Fairness issue
SCTP
- Combined from UDP & TCP
- For multimedia communications
Chapter 25. Introduction To Application Layer
Introduction
- Application Layer
- Logical connection : Imaginary direct connection
- Application layer는 사용자에게 service 제공
- 가장 상단의 layer이므로 추가하고 지우기 쉽다.
Application-Layer Paradigms
- Client-server paradigmServer should be powerful
- Server는 항상 작동중이며 Client 기다리는 중, 두 프로그램은 전혀 다르다.
- Peer-to-Peer (P2P) paradigm각 컴퓨터가 서비스를 제공하거나 받는다.
- Challenges : Security, Applicability
- Server가 항상 동작할 필요 없다.
- Mixed Paradigm
Client-Server Programming
API
- Predefined set of instructions
- TCP/IP 는 Socket이 필요하다.
- Socket(Network-Layer) + (Transport-Layer)
- IP Address + Port Number
Chapter 26. Standard Client-Server Protocols
World-Wide Web and HTTP
World Wide Web
- Distributed client-server service
- Web browser
- Controller
- Client protocols (HTTP, FTP, SSH, SMTP, …)
- Interpreters (HTML, JS, Java)
- URL
- Protocol
- Host
- Port
- Path
- Web page의 주소 정의
HyperText Transfer Protocol (HTTP)
- Web server에서 웹 페이지를 client에게 제공
- TCP 를 사용
- 3-Way handshaking
- Request msg (client)
- Method (ex. GET, PUT, …)
- URL
- Response msg (server)
- Status code
- 3자리 숫자로 request 결과를 나타냄. (ex. 200=OK, 400=Bad Request, 404=Not Found)
- CookiesSet-cookie : 처음 request하면 client의 상태 정보를 저장하고 관련 값을 cookie로 client에게 전송
- Cookie : client는 cookie 저장했다가 이후 request할 때 같이 보냄
- Client에 대한 정보를 기억
- Proxy Server실제 서버의 부하와 트래픽의 양을 줄임
- Client는 proxy server에 request 보냄
- Proxy server가 web page 가지고 있으면 response
- Web page 없다면 실제 서버에 request, response를 client에 전달
- Copy of responses to recent requests
'대학강의 정리' 카테고리의 다른 글
컴퓨터그래픽스 기말고사 정리 (0) | 2022.12.31 |
---|