> 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/ip-addressing-and-nat/subnetting.md).

# Subnetting

> IPv4: 192.168.100.100\
> sub: 255.255.255.0

같이 설정되었을 때 서브넷마스크를 적용해 네트워크 대역을 계산할 수 있다.

각각의 옥텟을 순서대로 AND 연산을 수행한다.

```
11000000.10101000.01100100.01100100 = 192.168.100.100
11111111.11111111.11111111.00000000 = 255.255.255.0
11000000.10101000.01100100.00000000 = AND 연산 결과 = 192.168.100.0
```

따라서 192.168.100.0을 시작으로 192.168.100.255 사이에 속하는 IP를 갖는 단말기는 같은 네트워크에 소속된 것으로 정의된다.

{% hint style="warning" %}
아래 IP는 사용할 수 없다.

* 첫 주소(.0) = 네트워크 주소를 가리키는 값
* 마지막 주소(.255) = 브로드캐스트 전용
  {% endhint %}

마지막 옥텟의 값을 얼마를 주냐에 따라 하나의 네트워크에 설정 가능한 서브 네트워크의 수가 결정된다.

예:

```
255.255.255.128 = 11111111.11111111.11111111.10000000

192.168.100.100 서브넷 적용 결과 = 192.168.100.0
192.168.100.200 서브넷 적용 결과 = 192.168.100.128
```

255.255.255.0 일 때와 달리 둘의 서브넷 적용 결과가 서로 달라지게 되었다. 이로서 둘은 서로 다른 네트워크에 속하게 된다.

공식

$$
\text{서브 네트워크의 수} = 2^{n} \quad (n = 1\ \text{bit의 개수})
$$

$$
\text{서브 네트워크에 할당 가능한 IP 개수} = 2^{n} - 2 \quad (n = 0\ \text{bit의 개수})
$$

## [CIDR](broken://pages/1a1a68401ab3277248893ae0684be6777dfa170e)


---

# 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/ip-addressing-and-nat/subnetting.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.
