뭐라도 끄적이는 BLOG

Network Layer 2 본문

Network/Network

Network Layer 2

Drawhale 2022. 5. 28. 18:20

2계층의 역할은 노드와 노드사이에 데이터 전송을 담당하는 역할을 한다. 즉 가까이 있는 컴퓨터끼리 어떻게 데이터를 주고 받는지에 대한 계층이다. 우리 주변에서 Star형으로 연결된 공유기로 이루어진 LAN에서 같은 네트워크 상에 존재하는 여러 장비들 중에서 어떤 장비가 어떤 장비에게 데이터를 전달할 때 사용된다.

2계층은 전기 신호를 모아 데이터 형태로 처리하므로 데이터에 대한 에러를 탐지하거나 고치는 역할을 수행할 수 있다. 과거에는 탐지하고 고치거나 재전송 했지만 현대는 물리계층의 신뢰도가 어느정도 안정적이여서 에러를 탐지하는 역할만 수행하는 경우가 많다. 대표적으로 Ethernet의 checksum 부분

주소체계가 생긴다는 것은 한 명과 통신하는 것이 아니라 동시에 여러명과 통신할 수 있다는 것이므로 무작정 데이터를 던지는 것이 아니라 받는 사람이 현재 데이터를 받을 수 있는지 확인하는 작업을 해야한다. 이 작업을 Flow Control이라고 한다.

2계층의 주요 장비로 NIC(Network Interface Card)와 Switch이며 주요 프로토콜로 Ethernet이 있다.

MAC(Media Access Control)

MAC은 전송 매체와의 상호 작용을 담당하는 하드웨어를 제어하는 계층이다. 즉, 전송 매체에 대한 흐름 제어 및 다중화를 제공한다. 대표적으로 CSMA/CD와 CSMA/CA가 있다. IEEE 802.3에 MAC계층에 대한 정의가 이루어지고 있다.

MAC Address

물리적인 주소라고도 부른다. MAC주소는 IEEE에서 부여하는 제조회사 식별 ID인 OUI와 제조사별 고유번호로 3byte씩 총 6byte로 이루져 있다. google에서 MAC address search를 검색해서 나오는 사이트에서 MAC address를 검색해 보면 어떤 제조사가 만들었는지 알 수 있다.

LLC

LLC또한 Datalink 계층의 한부분이다. 네트워크 계층과의 연결을 담당하는 계층이다. 현재 많이 사용되고 있는 Ethernet의 Ethernet Type이 LLC를 대신하고 있다. Ethernet Type처럼 상위 프로토을 지정할 수 있는 규칙을 SNAP(Subnetwork Access Protocol)라고 한다. LLC는 Ethernet을 제외한 다른 2계층 프로토콜에선 사용하고 있다.  IEEE 802.2에 LLC계층에 대한 정의가 이루어지고 있다.

Ethernet Protocol

Ethernet은 인터넷에서 연결된 환경이라면 흔히 볼 수 있는 2계층의 대표적인 프로토콜이다.

Ethernet 프로토콜을 상세히 보자면 위 그림과 같다. 이중에서 우리가 관심있게 볼만한 곳을 제외하면 아래와 같은 부분이 남는다. 제외된 부분을 간단히 설명하자면 Preamble은 0과1로 이루어진 데이터의 시작부분을 찾기위한 동기화 부분이다. 그리고 Data영역은 Payload부분이다.

Destination Address는 목적지 MAC Address번호이며 Source Address는 출발지의 MAC Address이다. 각각 6byte임을 그림에서 확인할 수 있다.

Ethernet Type은 상위 프로토콜의 정보를 담는다. 즉 Payload안에있는 3계층 프로토콜이 무엇인지 알려준다. Ethernet외에도 Mutiflexing을 위해 이후나올 다른 프로토콜도 모두 상위프로토콜이 무엇인지 보여준다.

 

Ethernet Type의 예를 보면 IPv4의 경우 0x0800이 삽입되고 ARP의 경우 0x0806이 입력된다.

 

EtherType - Wikipedia

From Wikipedia, the free encyclopedia Jump to navigation Jump to search Field in Ethernet frames indicating which protocol is encapsulated in the payload EtherType is a two-octet field in an Ethernet frame. It is used to indicate which protocol is encapsul

en.wikipedia.org

EtherType에 대해선 상단의 링크에서 확인해 볼 수 있다. 그리고 Linux상에서도 /etc/ethertypes 파일에 정의되어 있다.

Data이후 4byte의 CRC Checksum영역이 있지만 이곳에선 일단 넘어가겠다. 더 상세한 Ethernet Protocol은 다른 영역에서 설명할 것이다.

 

※ 참고

 

IEEE 802.3 - Wikipedia

From Wikipedia, the free encyclopedia Jump to navigation Jump to search Collection of standards for wired Ethernet This article is about the standards working group. For Ethernet frame data format, see Ethernet frame. IEEE 802.3 is a working group and a co

en.wikipedia.org

 

IEEE 802.2 - Wikipedia

IEEE 802.2 is the original name of the ISO/IEC 8802-2 standard which defines logical link control (LLC) as the upper portion of the data link layer of the OSI Model.[1] The original standard developed by the Institute of Electrical and Electronics Engineer

en.wikipedia.org

 

Medium access control - Wikipedia

From Wikipedia, the free encyclopedia Jump to navigation Jump to search Service layer in IEEE 802 network standards In IEEE 802 LAN/MAN standards, the medium access control (MAC, also called media access control) sublayer is the layer that controls the har

en.wikipedia.org

 

Subnetwork Access Protocol - Wikipedia

The Subnetwork Access Protocol (SNAP) is a mechanism for multiplexing, on networks using IEEE 802.2 LLC, more protocols than can be distinguished by the 8-bit 802.2 Service Access Point (SAP) fields. SNAP supports identifying protocols by EtherType field v

en.wikipedia.org

 

반응형

'Network > Network' 카테고리의 다른 글

Network  (0) 2022.05.18