CS/Computer Network

[Network Layer] Routing

min_zu 2024. 10. 18. 12:46
728x90
반응형

Network layer : 어떤 router을 거쳐서 client2로 패킷을 전송할지 결정하는 역할

Two types of services

  • Connectionless : 목적지만 지정되어 있음
  • Connection-oriendted : 중간에 어떤 라우터를 거쳐 도착할 지 헤더에 저장되어 있다.

Forwarding : Move pkt from router's input to appropriate router output (라우터로 들어와서 어디 subnet으로 보낼지 결정하는 것)

Routing : Determine route token by pkt from source to dst (Fowarding 보다 큰 개념)

Routing algorithm은 Fowarding table을 만들어준다. 

 

Implementation of Connection-oriented service

When a connection is established, a route from the source to destination is chosen and stored in tables (connection setup) uses vc number (not the dst address)

 

경로 선택 및 저장 : 연결이 설정되면, 출발지에서 목적지로 가는 경로가 선택되고 테이블에 저장된다. (연결 설정)

VC number : 데이터를 전송할 때 경로를 따라가는 가상 회선으로 데이터가 어느 경로를 통해 전달되어야할지 결정하는데 사용됨

(virtual circuit으로, circuit switching처럼 가상으로 할당되어있는 것이라고 생각하면 됨)

 

예시

A's table

incoming interface incoming VC# outgoing interface outgoing VC#
H1 1 A > C 1 : C > B
H3 1 A > C 2 : C > E

outgoing interface : 물리적 경로

outgoing VC# : 논리적 경로로 어디로 가야하는지 

 

Routing 

connectionless service : datagram network ex) 인터넷 프로토콜

* forwording table이 IP Address에 의해 결정됨

connection-oriented service : virtual circuit network ex) ATM

 

라우터는 헤더를 보고 갈 방향을 결정하는데, datagram network는 IP주소로, virtual circuit network는 VC number로 결정한다.

 

 

 

Forwarding table in R1

Incoming interface Incoming VC# Outgoing interface Outgoing VC#
1 12 3 22
2  63 1 18
3 7 2 17
1 97 3 87

pkt 4에 대해서 목적지에 따라서 특정 경로가 설정됨(출력 라인)

에를 들어

dest output link
r1 -
r2 3
h2 2

pkt4가 h2로 간다면 output 2로 가게 된다. 

 

VC network

hot1 -> host10 전송

  incoming VC# outgoing interface
R1 1
2
R2
R3
R2 1
2
3
H3
H4
R4
R3 1
2
R1
R2
R4 1
2
H9
H10

빨간 선을 따라서 간다고 가정할 때, 해당 VC 테이블을 참고하여 각 패킷에 헤더를 붙이면 

R1에서 R2로 가기 위해서는 VC#가 1이여야하고

R2에서 R4로 가기 위해서는 VC#가 3이여야하고

R4에서 H10으로 가기 위해서는 VC#이 2여야한다.

해당 번호에 따라 패킷에 헤더가 붙는다.

특징

  1. src-dst behaves like telephone circuit(circuit switch)
    vc는 패킷 스위치인데, circuit처럼 동작하여 패킷이 지나가는 link가 reserve가 되어있다. 
  2. Links and router resources(ex buffer) are reserved
  3. Every router on src-dst keeps "forwading table" for each connection
  4. Table is updated when each connection is setup or terminated
    update : VC network와 datagram network의 차이점 : datagram은 5~10분에 한번씩 하지만 VC는 각각의 connection마다 update된다.
  5. Each pkt carries VC number (not IP address)
  6. VC number can be changed on each link (new VC number comes from forwarding table)
    VC number을 링크마다 바꿈 
  7. Call setup(hand shacking) is done before pkt is sent > link/router resource reserved
    패킷이 보내지기 전에 hand shackingd이 필요하다 (reserved 등을 하기 위해서)
  8. Not used for IP (used for ATM)
  9. suitable for sevices requiring high reliability or low delay
    src -> dst까지의 루트가 최적의 경로로 설정이 된다. 

인터넷 프로토콜에 쓰이진 않음 

매번 보낼때 마다 forwarding table을 업데이트 시키는 등..의 문제가 있음

 

Datagram Network

  1. Forwarding table이 특정 src-dst 사이으이 connection을 염두에 둔 것이 아님
    Network내의 모든 가능한 src-dst의 조합을 고려해서 만듦
  2. pkt si forwarding using dst address
  3. No call setup(hands shaking)
  4. Routers do not update : forwarding table for each connection > 몇 분마다 한번씩(load balancing)

datagram forwading table은 어디서부터~ 어디까지의 ip가 어디로 가는지 지정한다.

이때 더 길게~ 맞는 ip에 해당하는 곳으로 보내야함 (longest prefix matching)

 

*miss routing : datagram이 src에서 dst까지 도착하지 못한 경우

728x90
반응형