> For the complete documentation index, see [llms.txt](https://krjaeh0.gitbook.io/j-log/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://krjaeh0.gitbook.io/j-log/network/routing-and-switching/routing-1.md).

# Routing

{% hint style="info" %}
이 페이지 내용은 [**Routing**](/j-log/network/routing-and-switching/routing.md) 로 통합되었습니다.
{% endhint %}

외부 네트워크와 통신을 위해서는 추가 연결이 필요하다. 라우터 간의 연결을 [DCE](broken://pages/6a6979814c8e6656e823ac2924370108772dc14b)(데이터 회선 장비)간 연결이라고 한다. 네트워크 장비를 가리키는 용어는 두 가지가 있다.

* [DTE](broken://pages/6a6979814c8e6656e823ac2924370108772dc14b): 데이터 **단말** 장비
* [DCE](broken://pages/6a6979814c8e6656e823ac2924370108772dc14b): 데이터 회선 장비

라우터는 [DCE](broken://pages/6a6979814c8e6656e823ac2924370108772dc14b)에 속하고 DCE 간 연결이 되어야 패킷을 주고 받을 수 있다.

DCE간 연결을 하는 과정을 라우팅이라 한다.

## 라우팅의 종류

크게 두가지가 있다.

* static routing : 관리자가 직접 연결
* [dynamic routing](broken://pages/ada283eadddaa75d940091e2cdf57398412e8793) : 그 외 연결

라우팅 된 정보는 라우팅 테이블에서 관리된다.

## 연결 시뮬레이션

{% stepper %}
{% step %}

### 1) 초기 연결: DCE 연결 후 핑 시도

외부 서버에 접근하기 위해 라우터 간 DCE 연결을 했다.

연결을 했으니 PC에서 서버에 핑을 보내보자.

서버의 IP 192.168.100.1로 핑을 보내도 신호가 잡히지 않는다. 왜냐하면 라우터 끼리 선으로 연결만 되었지 라우팅 되어 있지 않기 때문이다.
{% endstep %}

{% step %}

### 2) 라우팅 테이블의 필요성

PC(192.168.10.2/24)에서 server(192.168.100.1/24)로 데이터를 보내고자 한다면 그 과정을 테이블에 관리해야 한다. 그 테이블을 [Routing table](broken://pages/81da58566720020d4e152e5290ec3fa87cdafc19)이라 한다.

외부망에 접근하려면 라우터(L3)에서 라우팅 테이블을 참조해 데이터를 주고 받는다.
{% endstep %}

{% step %}

### 3) 라우터 인터페이스 IP 할당

라우터는 외부로 나가는 인터페이스에도 IP를 할당해야 사용이 가능하다. 임시로 아래와 같이 설정했다.

정상적으로 연결되었다면 초록불이 들어올 것이다.
{% endstep %}

{% step %}

### 4) 라우팅 추가 (경유지 설정)

이렇게 라우터에 새로운 IP를 할당하면 연결이 되었을까? 아니다. 직접 라우팅 작업을 거치지 않으면 우리가 사용하는 내부 네트워크(192.168.10.0)에서는 외부(192.168.100.0)에 접근할 수 없다.

다시 라우터에 접속해 아래 명령어를 입력한다.

이렇게 하면 우리 네트워크(192.168.10.0)에서 외부(192.168.100.0)에 접속할 수 있게 된다. 여기서 마지막에 172.168.10.2는 외부 네트워크에 접속하기 위해 꼭 거쳐야 하는 경유지로, 해당 경유지를 설정하지 않으면 외부 네트워크를 찾을 수 없다.
{% endstep %}

{% step %}

### 5) 상대측 라우팅 필요성

이제 통신이 될까? 아니다.

우리 라우터의 라우팅 테이블에만 경유지 설정을 통해 라우팅이 된 것이지, 상대 네트워크에서는 우리 네트워크를 안전하지 않은 네트워크로 인식하여 차단될 수 있다. 외부 네트워크의 라우터에서도 우리 네트워크를 라우팅해야 접속이 가능해 진다.

(상대 라우터에서 적절한 라우팅이 추가된 이후)

외부 서버로 정상적으로 패킷 통신이 가능해 졌다.
{% endstep %}

{% step %}

### 6) 클라이언트 IP의 게이트웨이 설정

한 가지 주의할 점은 IP 설정에서 게이트웨이 설정을 꼭 해야 한다.

게이트웨이 설정이 빠지면 라우팅에 성공해도 결국 데이터가 나갈 통로가 없어 통신이 불가능해진다.
{% endstep %}
{% endstepper %}

{% hint style="warning" %}
라우터 간 물리적 연결만으로는 통신이 되지 않는다. 라우팅 테이블에 경로(특히 경유지/next-hop)를 추가하고, 상대 네트워크에서도 역방향으로 해당 네트워크를 라우팅해야만 양방향 통신이 가능하다. 또한 각 호스트의 게이트웨이 설정도 반드시 확인해야 한다.
{% endhint %}

## 관련 링크

* [그 외 라우터 설정](broken://pages/0b1c89b32384ee8dfcf07fde46047b838b68fe1b)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://krjaeh0.gitbook.io/j-log/network/routing-and-switching/routing-1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
