새소식

반응형
CS 지식/네트워크

[데이터 통신] 9. Introduction to Data-Link Layer

  • -
반응형

9.1 Communication at Data-Link Layer

  • data link에서는 physical link와 physical layer 사이에 발생할 수 있는 error 들을 detection하고 correction하는 것이 주요 기능이 될 것이다.
  • hop에서 hop까지의 전달을 안전하게 하는 것이 data-link의 역할이고 이 곳에서 무슨 일을 하는 지에 대해 배워볼 것이다.
  • 왜 이렇게 data-link layer가 반복적으로 hop-to-hop으로 거쳐야 하는가?
    • 그 이유는 매 hop마다 physical layer를 거치면서 전달이 되기 때문에 그러면서 생기는 error로부터 안전이 보장되지 않는다. 따라서 매 hop마다 data-link를 거치게 되는 것이다.

 

Nodes and Links

  • Data-link layer is for node-to-node communication

Data-Link Services

  • The data-link layer is located between the physical and the network layers. The data-link layer provides services to the network layer; and it receives services from the physical layer
    • 항상 아래 계층으로부터 서비스를 받는다고 생각하면 된다. 반대로 위의 layer는 아래 layer의 서비스를 사용한다.
  • Encapsulation and decapsulation at the data-link layer

  • Framing: A packet at the data-link layer is normally called a frame
  • *Flow control *(흐름 제어)
    • 처리 능력의 차가 있는 양쪽의 노드(sender and receiver) 사이에 flow control message를 sender에게 보내서 data의 양을 줄이거나(slow down) 당분간 stop하도록 하는 것
      • overflow를 방지
  • Error control
    • error detection and correction
    • 이 세상에 있는 어떠한 유선 또한 무선도 error를 피할 순 없다.(attenuation, distortion, noise)
  • Congestion control
    • 혼잡하면 많이 밀리기(delay) 때문에 이를 제어하는 방법(transport layer와 더 관련된 것으로 2학기에서 자세히 다룸)

 

Data-Link Layer

  • Two Categories of Links:
    • Point-to-point link or broadcast link

 

  • Two Sub-layers:
    • Dividing the data-link layer into two sub-layers
    • Data Link Control(DLC)
      • 한 노드에서 다른 노드까지 error 없도록 보내는 것
    • Media Access Control(MAC)
      • 커피숍에서 여러명이 air 매체를 통해 와이파이를 나눠서 쓰는 경우, data link layer에 적용하기 전에 media에 access해서 media를 쓸 수 있는 권리를 가져오는 것(차지하는 것)
      • Media access control can be presented only in a multicast link.

  • data link layer of a broadcast link has two sublayers.
  • data link layer of a point-to-point link has one sublayer.

 

9.2 Link-Layer Addressing

  • A link-layer address is called a link address, physical address, and sometimes a MAC address
    • link layer address = link address = physical address = MAC address
  • network layer address is called a IP address, logical address
    • network layer address = IP address = Logical address
  • IP addresses and link-layer addresses in a small internet

N1 is source address, N8 is destination address

중간에 거치는 link address -> Ln

data(편지)와 source and destination의 주소는 전달과정에서 그 내용이 변하지 않지만 L1, L2, L7, L8과 같은 link layer address는 노드를 거치면서 계속 변한다.

  • link layer address는 한 노드를 거치면서 계속해서 그때 그때마다 필요한 address에 기반하여 생기고 사라지고를 반복하기 때문(타고 가는 link가 계속해서 바뀌기 때문이다.)
  • decapsulation을 통해 어디로 가야하는 지를 보고 다시 자신의 address와 다음 노드의 address를 encapsulation 후에 해당 address로 전달을 한다.
  • data(편지)를 decapsulation을 할 수 있는 것은 N8 뿐이다.
    • 나머지는 destination address로 갈 수 있는 layer만을 알려주는 것

 

Three Types of Addresses

  • Unicast address: The second digit needs to be an even number.
    • 한 군데에서 한 군데로(one-to-one)
    • The LSB of the first byte is ‘0’
    • data-link layer of a point-to-point link has 1 sublayers
  • Multicast address: The second digit needs to be an odd number
    • 내가 여러명에게(to any group) - one-to-many
    • The LSB of the first byte ‘1’
  • Broadcast address
    • 모두에게(to all) - one-to-all
    • 전부다 1 -> FF:FF:FF:FF:FF:FF
    • data-link layer of a broadcast link has 2 sublayers

  • first byte의 LSB가 0이면 unicast, 1이면 multi cast이다.
    • 2 (0010) -> 0 -> unicast
    • 3(0011) -> 1 -> multicast
  • 전부 다 1을 쓰면 (FF:FF:FF:FF:FF:FF:FF) one-to-all 이다.

 


  • In a point-to-point link, the link is not shared between devices. -> media를 공유하는 것이 아니기 때문
  • In a broadcast link, the link is shared between many devices.
  • data link layer of a broadcast link has two sublayers.
  • data link layer of a point-to-point link has one sublayer.

 

Address Resolution Protocol (ARP)

Network address: IP address

Data link address: MAC address

  • Auxiliary(보조적인) protocol defined in the network layer
  • To map the IP address (from network layer) to the corresponding link-layer address
    • IP 주소는 아는데 MAC address는 모르는 경우 ARP를 통해 data-link 주소를 얻고자 할 때
    • IP 주소는 link를 통해 frame을 전달할 때 도움이 안됨(link layer가 도움이 됨)
  • Caching for efficiency
    • MAC address를 cache 해 두었다가 쓰게 되면 더 효율적으로 쓰는 것이 가능하도록 하는 것

ARP Operation

  • N2라는 컴퓨터에게 정보를 보내고 싶은데 MAC address를 모를 때 ARP request라는 것을 보낸다.
  • 그런데 그것을 보내기 위해선 link address인 L2를 알아야 하는데 특정 link 주소(like L2)를 지칭할 수 없기 때문에 broadcast 전달(one-to-all) 함으로써 모든 컴퓨터가 ARP request를 받도록 한다.
  • 진짜 N2 컴퓨터만이 응답(reply)를 하게 된다. 그러면 N2 입장에서는 N1이 request 한 것을 이미 알기 때문에 N1 에게로 unicast로 L1의 정보를 보내게 된다.

 

ARP Packet Format

format을 굳이 외울 필요는 없지만 간단히 소개 정도만 하자면 아래 그림과 같이 되어있다.

hardware length: data-link layer(hardware)가 쓰는 MAC address의 길이 즉, 6 byte

Protocol length: IP address 즉, 4 byte

알고자하는 IP address가 broadcast 전달을 통해 Destination hardware address 부분이 empty였다가 채워지게 된다.

 

Example 9.4: ARP

나는 L1 이라는 MAC address와 N1이라는 IP 주소를 갖고 있는데 너의 MAC address는 모르겠지만 N2라는 IP address를 가진 친구야 너의 MAC address는 뭐니? 라는 것을 broadcast 한다.(ARP)

그러면 N2를 갖고 있는 system B만 응답을 systemA 에게만 unicast로 MAC address (L2)를 전달을 한다.

그 이후부터는 N1 N2라는 network 주소 앞에다가 L1, L2로 encapsulation 시켜서 정보를 전달하게 된다.

 

Example: Communication(이 아래부터의 그림 중요)

위 그림과 같은 간단한 형태의 동작 과정에서 IP address와 Mac address 가 어떻게 활용되는지를 알아보자.

 

Example: At Alice's Site NA

  • NA라는 IP 주소와 LA라는 MAC address를 가진 Alice가 NB라는 IP 주소와 LB라는 MAC address를 갖는 Bob 컴퓨터와 통신을 하고 싶다고 하자.
  • 중간에 여러 노드(link layer, 우체국)를 거치게 때문에 주소의 변환이 이루어지게 될 것이다.
  • datagram에는 source destination's IP address와 data 정보가 편지봉투에 담겨 있고 현재는 destination address만 알기 때문에 이를 router R1(우체국)에 보내서 알아오도록 한다.(by using ARP)
  • 내부에 아무도 그러한 주소를 가진 곳에 없으면 바깥의 router가 대신해서 자기의 MAC address(L1)를 알려준다.

 

Example: At Router R1

위 과정을 통해서 Alice가 보낸 것이 왔다. 그러면 R1 입장에서는 자기의 MAC address인 L1 으로 왔으니까 잘 왔다는 의미로 decapsulation 하여 없애고 편지를 위로 올려준다.

 

그러면 또 Forwarding table을 통해서 ARP를 구동 시켜서 L3를 알려줄 것이고 이를 통해 L2라는 address와 L3라는 address로 encapsulation 시켜서 L3라는 address로 내보내게 될 것이다. 이렇게 되면 다시 frame이 만들어져서 한 구간을 가게 된다.

 

Example: At Router R2

  • 다음은 R2가 자기에게 왔음을 확인하여 decapsulation을 하고 message를 위로 올린다음에 주소(NB)를 확인하여 ARP를 통해 NB를 찾는데 이제는 NB가 응답하여 LB를 보내게 될 것이다.
  • 그러면 자기 주소인 L4를 붙이고 상대로부터 받은 MAC address인 LB를 붙여서 전달을 한다.

 

Example: At Bob's Site

그러면 최종적으로 Bob에게 오면 LB라는 MAC address로 왔으니까 제대로 온 것이기 때문에 decapsulation 하고 주소를 보니까 NB도 일치하므로 또 다시 decapsulation 하여 실실적인 data를 뽑아서 위의 layer에게 data를 전달하게 된다.

 


  • If the sender is a host and wants to send a packet to another host on the same network, the logical address that must be mapped to a physical address is the destination IP address in the datagram header.
  • If the sender is a host and wants to send a packet to another host on another network, the logical address that must be mapped to a physical address is the IP address of the router found in the routing table.
  • The sender is a router that has received a datagram destined for a host on another network. The logical address that must be mapped to a physical address is the IP address of the router of the router found in the routing table.
  • The sender is a router that has received a datagram destined for a host in the same network. The logical address that must be mapped to a physical address is the destination IP address in the datagram header.

-> same network이면 physical address는 destination IP address in the datagram header.

-> another network이면 physical address는 IP address of the router of the router found in the routing table.


 

반응형
Contents

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

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