새소식

반응형
CS 지식/네트워크

[네트워크] 19. Network-Layer Protocols

  • -
반응형

19.1 Internet Protocol (IP)

  • Position of IP and other network-layer protocols in TCP/IP protocol suite
  • Three auxiliary protocols: ICMP, IGMP, ARP

  • IP를 지원하기 위한 보조적인 프로토콜 - IGMP(one-to-many), ICMP(error control), ARP

 

Datagram Format(매우 중요)

  • 인터넷은 packet switching 방식에 근간을 두고 있음.
    • virtual circuit과 datagram 중 datagram을 사용하고 그렇기 때문에 packet 하나가 datagram 단위이다.
  • header는 최소 20바이트에서 최대 60바이트까지 될 수 있다.
  • 뒤의 option field가 0~40바이트가 될 수 있는데 header lenth를 보면 알 수 있듯이 하나의 bit가 4byte를 나타내고 있기 때문에 4byte 단위로 끊어져야 하기 때문에 option이 4byte가 아니라면 padding(0으로 이어주는)을 하여 4byte 단위를 맞추어 준다.
  • service type: 특급 우편? 일반 우편?

 

  • Version Number: 4 (for IPv4) - 0100
  • Header length: 4 bits (1 bit -> 4 byte word) - 최대 60 byte를 나타낼 수 있어야 하기 때문에 1bit가 4byte를 나타내는 것
    • 2060 -> **515**(0101~1111)
  • Service type: TOS(Type of Service), Differentiated Services (DiffServ, 차등서비스) - 특급우편인지 일반우편인지
    • payload의 형식? 성격? 타입?을 나타내 줄 수 있는
    • 우선순위를 정한다.
    • 오디오나 영상과 같은 것은 빨리 전송이 되어야 하기 때문(늦게 오면 화질이나 음질이 깨지기 때문)
  • Total length: Up to 65,535 bytes(216)
    • IP packet의 size
    • Length of data = total length – (HLEN bit) x 4
  • Identification, Flags, and Fragmentation offset - packet을 자르고 붙이는데 필요한 field
    • Identification: fragment로 나누어야 하는 경우 나눠진 packet들은 다시 붙이기 위해 똑같은 Identification을 갖는다.
    • Flag: 빈칸,
    • D(o not fragment)
    • M(ore fragment) - 뒤에 더 추가적인 fragment가 있으면 1
    • fragment offset
      • 보내고 싶은 payload(파란색 부분)가 0부터 시작해서 data가 쭉 있을텐데 flags가 3bit(8byte) 를 차지하고 있기 때문에 offset을 알기 위해서는 8을 곱해주어야 한다.
      • 예를 들어 fragmentation offset = 100 이라면 800byte가 떨어져 있는 곳에 payload가 위치해 있다는 것을 의미한다.(일종의 payload pagenumber)
    • : fragment - 조각
  • Time-to-live(lifecycle, 중간에 가다가 특정 시간 도착 안 하면 중지), Protocol(TCP인지, UDP인지, ICMP인지...)

Q) quiz 3번 문제에서 framentation offset이 100이라면 payload의 시작으로부터 800 byte 떨어져 있는 곳에 있는 것 아닌가? 왜 datagram의 시작부터 세지?

Q) What is MTU

A) 네트워킹에서 MTU(Maximum Transmission Unit)이란 네트워크에 연결된 장치가 받아들일 수 있는 최대 데이터 패킷 크기를 말합니다. 지하도로나 터널의 높이 제한처럼

 

Header Checksum

  • header 부분의 것들을 모두 add하고 이를 wrapped sum, 1의보수를 취하고 위의 red field 부분에 넣는다.
  • 그러면 수신 측에서는 저 부분을 그대로 받아서 header의 wrapped sum과 checksum을 더했을 때 만약 정상적으로 왔다면 보수를 취했을 때 0으로 딱 떨어지게 된다.
  • 약한 형태의 error control
    • not payload, only header

 

Fragmentation

  • packet을 보내기 위해 조각내는 과정
  • 이더넷(1500바이트)이나 와이파이(2300바이트)의 경우 IP packet의 양이 제한되어 있기 때문에 이를 통해 전송되려면 이를 통해 전송이 가능한 정도의 크기로 fragment를 해야 한다.
  • 아래 그림은 4000바이트 짜리 packet을 1400바이트의 이더넷으로 전송할 때, 위처럼 원점으로부터 얼마나 떨어져 있는지를 offset으로 표현하게 된다.

 

Fragmentation Example

  • 1400으로 세 조각을 내서 보내는 경우
  • 2번째 packet이 간 path는 MTU가 1400보다 더 작다면 이를 더 잘게 쪼개서 보내야 한다.
  • 수신 측에서는 같은 identification을 갖고 있는지, 0으로부터 얼만큼 offset이 되어있는지를 확인하여 이를 수신할 때 assembly 하게 된다.

 

19.2 ICMPv4

  • Internet Control Message Protocol Version 4 (with IPv4)
  • ICMPv4 has been designed to compensate two IPv4 deficiencies(결핍)
    • No error-reporting or error-correcting mechanism
    • No host and management queries(질의 응답)

  • Error-reporting messages
    • 03: Destination unreachable
      • 편지를 배달하는데 5동이 없어 -> ?! -> 수취인불명 -> 반송(그런 목적지 없어!)
    • 04: Source quench(목 조이기)
      • 편지가 너무 폭주하면 편지를 버리게 되고 현재 우체국 traffic이 heavy하니 보내는 양을 줄이라고 알린다.
    • 11: Time exceeded
      • 특정 시간(time to leave - 위에서 배운)이 지나 편지를 버렸으니 알고 있어라
    • 12: Parameter problem
      • format이 이상해서 버린 것
      • 편지로 따지면 규격 봉투에 보내지 않고 이상한 비닐봉지에 보낸 것
  • Query messages
    • 08 and 00: Echo request and reply
      • 살아있는지 물어보고 답을 받는. (host's liveness)
    • 13 and 14: Timestamp request and reply
      • 살아있는 단말 간 시간을 확인하는
    • Router solicitation and advertisement

이처럼 IP의 약점을 보완!

 

Error Messages for ICMPv4

  • Important points about ICMP error messages:
    • No ICMP error message will be generated in response to a datagram carrying an ICMP error message
      • 반송 편지가 모종의 이유로 잘 도착하지 않았더라도 이에 대해서 또 반송편지를 보내거나 그러진 않는다.
    • No ICMP error message will be generated for a fragmented datagram that is not the first fragment
      • fragmeted 된 것은 첫번째 fragment에 대해서만 error reporting!
    • No ICMP error message will be generated for a datagram having a multicast address
      • only unicast address!
    • No ICMP error message will be generated for a datagram having a special address such as 127.0.0.0 (loopback) or 0.0.0.0. (this-host)

  • 편지를 버리고 이를 알릴 때(error reporting) 편지 전체를 포함하는 것이 아니라 IP header와 8 byte를 포함하여 ICMP header(버린 이유)를 보내게 된다.
  • 그런데 이는 source에게 보내야 하기 때문에 IP header가 추가된다.
    • 보내는 사람, 받는 사람

 

Debugging Tools

  • Two tools that use ICMP for debugging or tracing the route of a packet: ping and traceroute
  • Ping: ICMP echo-request message and echo-reply message
    • 해당 host 컴퓨터가 살아있는 지 확인

Debugging Tools: Traceroute

  • Traceroute program in UNIX or tracert in Windows can be used to trace the route of a packet from the source to the destination

  • TTL값이 초반엔 작은 값으로 시작하여 error report(Time exceeded)가 오도록 하여 TTL 값을 점점 늘려나간다.
  • 그러다가 나중에 목적지에 제대로 도착했다면 tracert에서는 port number를 조작하여 없는 unknown UDP port를 보냄으로써 destination unreachable을 보낸다.
  • 최종적으로 위 과정을 거치면서 source로부터 destination까지 어느 router들을 거치는지 파악하는 것이 가능한 것이다.

 

19.3 Mobile IP

  • 고정된 IP를 쓰는 경우 이동했을 때 그 connection을 어떻게 유지하는가에 대한 solution
  • The main problem that must be solved in providing mobile communication using the IP protocol is addressing
  • IP addresses are designed to work with stationary(고정된) hosts because part of the address defines the network to which the host is attached
  • Mobile IP has two addresses for a mobile host: one home address(광운대) and one care-of address(고려대).
    • The home address is permanent;
    • the care-of address changes as the mobile host moves from one network to another
  • Home network and foreign network

Agents

  • 나를 대신해서 일을 대신해 주는 software적인 기능
  • To make the change of address transparent to the rest of the Internet requires a home agent and a foreign agent
  • When the mobile host and the foreign agent are the same, the care-of address is called a collocated(나란히 놓여진) care-of address
    • Foreign agent가 Mobile host 안에 내재되어 있을 수도 있다.

Remote and Mobile Host Communications

  • Three phases: Agent discovery, registration, and data transfer

  • 1, 2: (Home) Agent discovery
    • domain 안에서 agent를 찾기 위해 packet을 뿌리고 응답을 받아 agent를 찾는 과정
  • 3, 4: (Foreign) Agent discovery
  • 5, 6 : registration
    • 나 광운대에 있다가 고려대에 왔어 라고 알리는
  • 9: data transfer
    • 그렇게 되면 고려대에 있어도 광운대 IP를 가진 애는 다른 remote host와 data를 주고 받을 수 있게 된다.
  • 고려대 우체국아 광운대 우체국에 오는 거 있음 좀 알려줄래?

 

Agent Discovery

  • Mobile IP does not use a new packet type for agent advertisement; it uses the router advertisement packet of ICMP, and appends an agent advertisement message.
  • Mobile IP does not use a new packet type for agent solicitation(간절히 청함); it uses the router solicitation packet of ICMP.
  • router advertisement, router solicitation과 같은 ICMP query message를 통해서 agent discovery를 한다.

Registration (Request and Reply)

  • (1) The MH(Mobile Host) must register itself with the FA(Foreign Agent),
  • (2) The MH must register itself with its HA (normally by the FA),
  • (3) The MH must renew registration if it has expired,
  • (4) The MH must cancel its registration when it returns home
  • A registration request or reply is sent by UDP using the well-known port 434.

Data Transfer

  • After agent discovery and registration, a mobile host can communicate with a remote host
  • The movement of the MH is transparent to the rest of the Internet

Inefficiency in Mobile IP

  • The inefficiency can be severe or moderate.
    • The severe case is called double crossing or 2X.
    • The moderate case is triangle routing or dog-leg routing.
  • Using the update binding packet
    • 이러한 비효율이 존재할 때 remote host에게 자기가 foreign network에게 받은 care-of-address를 remote에게 알려줘서 remote host가 home address가 아닌 내가 새로운 mobile 환경에서 받은 care-of-address로 직접 보내도록 binding 시켜주는 것!

 

반응형
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.