# \[Netwhat] 연습문제 정리

> ### 문제 출처
>
> [adblanc](https://github.com/adblanc)/[**netwhat42-train**](https://github.com/adblanc/netwhat42-train) [365kim/42\_cursus/2\_netwhat ](https://github.com/365kim/42_cursus/tree/master/2_netwhat)
>
> ### 유용한 링크
>
> [10진수 <-> 2진수 변환기](https://ko.calcuworld.com/%EC%88%98%ED%95%99/2%EC%A7%84%EB%B2%95-%EA%B3%84%EC%82%B0%EA%B8%B0/) [IP주소 범위 계산기](http://jodies.de/ipcalc) [서브넷마스크 Reference Table](https://www.cloudaccess.net/cloud-control-panel-ccp/157-dns-management/322-subnet-masks-reference-table.html)

## 1. IP adress

### 선행지식

* [IPv4 (32bit)와 IPv6 (128bit)](https://velog.io/@hidaehyunlee/IP-address%EB%9E%80#1-what-is-ip-address)
* [IP Class](https://velog.io/@hidaehyunlee/IP-address%EB%9E%80#2-ip%EC%A3%BC%EC%86%8C%EC%9D%98-%ED%81%B4%EB%9E%98%EC%8A%A4abc-class%EB%9E%80)

### 1.1. IP주소 크기 구하기

#### Q. What is the size of an IPv4 address?

```
- 128 bits
- 32 bits 
- 64 miles
- 16 bits
- 8 bits
- 64 bytes
- 128 bytes


Answer : 32 bit
```

#### Q. What is the size of an IPv6 address?

```
- 128 bits
- 32 bits 
- 64 miles
- 16 bits
- 8 bits
- 64 bytes
- 128 bytes


Answer : 128 bit
```

#### Q. To the test IP stack on your local host, which IP address would you ping?

```
- 127.0.0.0
- 1.0.0.127
- 127.0.0.1
- 127.0.0.255


Answer : 127.0.0.1
```

### 1.2. IP주소 클래스 구하기

#### Q. What is the default IP address class available?

```
- A AND B
- FIRST
- C
- B


Answer : C
```

#### Q. Which IP address class has more host addresses available by default?

```
- C
- D
- E
- F
- FIRST(A)


Answer : FIRST(A)
```

#### Q. Which of this is not a class of IP address?

```
- Class D
- Class F
- Class C
- Class E


Answer : Class F
```

## 2. Subnetting

### 선행지식

* [기본 서브넷 마스크(Default Subnet Mask) 와 CIDR 표기법](https://velog.io/@hidaehyunlee/%EB%84%B7%EB%A7%88%EC%8A%A4%ED%81%ACNetmask%EC%99%80-%EC%84%9C%EB%B8%8C%EB%84%B7%EB%A7%88%EC%8A%A4%ED%81%ACSubnetmask#22--%EA%B8%B0%EB%B3%B8-%EC%84%9C%EB%B8%8C%EB%84%B7-%EB%A7%88%EC%8A%A4%ED%81%ACdefault-subnet-mask)
* [네트워크/브로드캐스트 주소 계산법](https://velog.io/@hidaehyunlee/%EC%84%9C%EB%B8%8C%EB%84%B7%ED%8C%85subnetting%EC%9C%BC%EB%A1%9C-%EB%84%A4%ED%81%AC%EC%9B%8C%ED%81%AC%EB%A5%BC-%ED%9A%A8%EC%9C%A8%EC%A0%81%EC%9C%BC%EB%A1%9C-%EA%B4%80%EB%A6%AC%ED%95%98%EC%9E%90#1-networkbroadcast-%EC%A3%BC%EC%86%8C)
* [호스트주소 수 계산법](https://velog.io/@hidaehyunlee/IP-address%EB%9E%80#21-a%ED%81%B4%EB%9E%98%EC%8A%A4)
* [호스트주소 범위 (서브네팅 계산 방법)](https://velog.io/@hidaehyunlee/%EC%84%9C%EB%B8%8C%EB%84%B7%ED%8C%85subnetting%EC%9C%BC%EB%A1%9C-%EB%84%A4%ED%81%AC%EC%9B%8C%ED%81%AC%EB%A5%BC-%ED%9A%A8%EC%9C%A8%EC%A0%81%EC%9C%BC%EB%A1%9C-%EA%B4%80%EB%A6%AC%ED%95%98%EC%9E%90#22-%EC%84%9C%EB%B8%8C%EB%84%B7%ED%8C%85-%EA%B3%84%EC%82%B0-%EB%B0%A9%EB%B2%95)

### 2.1 서브넷마스크 표기법

#### Q. What is the CIDR notation of the 255.255.128.0 subnet mask?

```
- /8
- /16
- /9
- /17


Answer : /17
```

#### Q. What is the CIDR notation of the 255.255.192.0 subnet mask?

```
- /5
- /31
- /18
- /14


Answer : /18
```

#### Q. What is the subnet mask of /24?

```
- 255.255.255.255
- 255.255.255.0
- 255.0.0.0
- 255.255.128.0
- 255.192.0.0
- 255.224.0.0


Answer : 255.255.255.0
```

### 2.2. 네트워크/브로드캐스트 주소 구하기

#### Q. What is the network address of a host with an IP address of 182.161.121.118/24?

```
- 180.0.0.0
- 182.161.121.64
- 182.161.120.0
- 182.161.121.116
- 0.0.0.0
- 182.161.96.0
- 182.160.0.0
- 182.161.121.0


Answer : 182.161.121.0
Solution : (182.161.121.118) & (255.255.255.0) = 182.161.121.0
```

#### Q. What is the network address of a host with an IP address of 107.212.146.212/25?

```
- 107.212.146.208
- 107.128.0.0
- 0.0.0.0
- 64.0.0.0
- 107.212.128.0
- 107.212.146.128
- 107.212.0.0
- 107.208.0.0
- 107.212.146.192


Answer : 107.212.146.128
Solution : (107.212.146.212) & (255.255.255.128) = 107.212.146.128
```

#### Q. What is the network address of a host with an IP address of 166.175.144.121/23?

```
- 166.128.0.0
- 166.175.144.0
- 166.175.144.96
- 128.0.0.0
- 166.174.0.0
- 166.0.0.0
- 166.0.0.0
- 166.175.144.120


Answer : 166.175.144.0
Solution : (166.175.144.121) & (255.255.254.0) = 166.175.144.0
```

#### Q. What is the network address of a host with an IP address of 116.45.224.50/8?

```
- 116.0.1.0
- 116.0.0.0
- 116.255.255.0
- 116.255.255.255


Answer : 116.0.0.0
Solution : (116.45.224.50) & (255.0.0.0) = 116.0.0.0
```

#### Q. What is the network address of a host with an IP address of 45.195.37.187/16?

```
- 45.194.37.187
- 45.0.0.0
- 45.194.0.0
- 45.195.0.0


Answer : 45.195.0.0
Solution : (45.195.37.187) & (255.255.0.0) = 45.195.0.0
```

#### Q. What is the broadcast address of a host with an IP address of 51.254.122.100/24?

```
- 51.254.122.0
- 51.254.122.1
- 51.254.122.254
- 51.254.122.255

Answer : 51.254.122.255
```

### 2.3. 호스트 주소 수 구하기

#### Q. What is the maximum number of IP addresses that can be assigned to hosts on a local subnet using the 255.255.255.128 subnet mask?

```
- 128
- 60
- 126
- 62
- 252
- 258
- 124
- 58
- 64


Answer : 126
Solution : 2^(32 - 25) - 2 = 128 - 2 = 126
```

#### Q. What is the maximum number of IP addresses that can be assigned to hosts on a local subnet using the 255.224.0.0 subnet mask?

```
- 4194306
- 4194302
- 1048578
- 4194300
- 2097148
- 4194298
- 1048574
- 2097150
- 1048576


Answer : 2097150
Solution : 2^(32 - 11) - 2 = 2097152 - 2 = 2097150
```

#### Q. You have an interface on a router with the IP address of 124.144.156.248/21. Including the router interface, how many hosts can have IP addresses on the local network connected to the router interface?

```
- 1020
- 2050
- 2044    
- 4090
- 2046
- 2048
- 4092
- 2042
- 4094


Answer : 2046
Solution : 2^(32 - 21) - 2 = 2048 - 2 = 2046
```

#### Q. You have an interface on a router with the IP address of 240.19.3.205/12. Including the router interface, how many hosts can have IP addresses on the local network connected to the router interface?

```
- 1048576
- 2097154
- 1048574
- 524284
- 1048578
- 2097148
- 1048572


Answer : 1048574
Solution : 2^(32 - 12) - 2 = 1048576 - 2 = 1048574
```

### 2.4. 호스트주소 범위 구하기

#### Q. Which of the following proposals is the valid host range for the subnet on which the IP address 158.167.18.156/15 resides?

```
- 158.166.0.1- 158.167.255.253
- 158.165.255.253- 158.167.255.254
- 158.166.0.1- 158.167.255.254
- 158.166.0.2- 158.168.0.2


Answer : 158.166.0.1- 158.167.255.254
Solution : (Network)158.166.0.0 (Broadcast) 158.167.255.255
```

#### Q. Which of the following proposals is the valid host range for the subnet on which the IP address 1.93.149.6/17 resides?

```
- 1.93.127.255- 1.93.255.250
- 1.93.128.1- 1.94.0.1
- 1.93.128.1- 1.93.255.251
- 1.93.128.1- 1.93.255.254
- 1.93.128.1- 1.94.0.3


Answer : 1.93.128.1- 1.93.255.254
Solution : (Network)1.93.128.0 (Broadcast) 1.93.255.255
```

## 3. Public/Private IP address

### 선행지식

* [사설IP 주소대역](https://velog.io/@hidaehyunlee/%EA%B3%B5%EC%9D%B8Public-%EC%82%AC%EC%84%A4Private-IP%EC%9D%98-%EC%B0%A8%EC%9D%B4%EC%A0%90#21-%EC%82%AC%EC%84%A4ip-%EC%A3%BC%EC%86%8C%EB%8C%80%EC%97%AD)

### 3.1. 사설 IP주소 고르기

#### Q. Which of the following IP addresses is a private address?

```
- 169.153.119.123
- 24.23.102.151
- 255.62.136.173
- 10.166.25.20
- 46.244.138.171
- 27.147.158.251


Answer : 10.166.25.20
```

#### Q. Which of the following IP addresses is a private address?

```
- 222.9.230.144
- 135.167.134.35
- 172.32.0.5
- 27.157.141.96
- 172.16.0.2
- 129.244.78.149
- 137.223.167.235


Answer : 172.16.0.2
```

#### Q. Which of the following IP addresses is a private address?

```
- 108.246.233.231
- 146.227.105.173
- 59.155.254.18
- 253.29.133.220
- 192.168.20.253
- 94.152.104.99


Answer : 192.168.20.253
```

## 4. Transport Layer

### 선행지식

* [OSI 7 Model](https://velog.io/@hidaehyunlee/%EB%8D%B0%EC%9D%B4%ED%84%B0%EA%B0%80-%EC%A0%84%EB%8B%AC%EB%90%98%EB%8A%94-%EC%9B%90%EB%A6%AC-OSI-7%EA%B3%84%EC%B8%B5-%EB%AA%A8%EB%8D%B8%EA%B3%BC-TCPIP-%EB%AA%A8%EB%8D%B8)
* [TCP / UDP 원리 및 차이](https://velog.io/@hidaehyunlee/TCP-%EC%99%80-UDP-%EC%9D%98-%EC%B0%A8%EC%9D%B4)

### 4.1. TCP/UDP 특징

#### Q. Which of the following propositions is not true?

```
- UDP is faster, simpler and more efficient than TCP
- UDP only has the basic error control mechanism
- UDP is a datagram oriented protocol
- UDP does not support broadcasting


Answer : UDP does not support broadcasting
```

#### Q. Which of the following propositions is not true?

```
- TCP is a connection-oriented protocol
- TCP does not support broadcasting
- TCP provides extended error checking mechanisms, because it provides flow control and data acknowledgement
- Data sequencing is a TCP feature (this means that packets arrive in order in the recipient)
- The delivery of data to the destination cannot be guaranteed in TCP
- TCP is reliable because it guarantees the delivery of data to the router of the destination


Answer : The delivery of data to the destination cannot be guaranteed in TCP
```

#### Q. Which of the following propositions is not true?

```
- UDP is faster, simpler and more efficient than TCP
- UDP provides extended error checking mechanisms, because it provides flow control and data acknowledgement
- UDP is a datagram oriented protocol
- UDP supports broadcasting


Answer : UDP provides extended error checking mechanisms, because it provides flow control and data acknowledgement
```

#### Q. Which of the following propositions is not true?

```
- TCP is a datagram oriented protocol
- TCP does not support broadcasting
- TCP provides extended error checking mechanisms, because it provides flow control and data acknowledgement
- Data sequencing is a TCP feature (packets arrive in order in the recipient)
- TCP is reliable because it guarantees the delivery of data to the router of the destination
- TCP is comparatively slower than UDP


Answer : TCP is a datagram oriented protocol
```

#### Q. Which of the following services use UDP? 1. DHCP 2. SMTP 3. FTP 4. HTTP

```
- 3
- 1
- 2
- All of the above


Answer : 1
```

## 5. Application Layer

### 선행지식

* [OSI 7 Model](https://velog.io/@hidaehyunlee/%EB%8D%B0%EC%9D%B4%ED%84%B0%EA%B0%80-%EC%A0%84%EB%8B%AC%EB%90%98%EB%8A%94-%EC%9B%90%EB%A6%AC-OSI-7%EA%B3%84%EC%B8%B5-%EB%AA%A8%EB%8D%B8%EA%B3%BC-TCPIP-%EB%AA%A8%EB%8D%B8)
* [DHCP/DNS 개념](https://github.com/hidaehyunlee/Fork-my-brain/tree/4f7d19f4487fe8d450e22a9b6451bbed865ce125/Network/DHCP/DNS%20%EA%B0%9C%EB%85%90/README.md)

### 5.1. DNS/DHCP 특징

#### Q. *\_\_* translates Internet domain names and host names into IP addresses

```
- Network time protocol
- Default routing protocol
- Domain name system
- OSI model system


Answer : Domain name system
```

#### Q. You want to implement a mechanism that automates IP configuration, including IP address, subnet mask, default gateway and DNS information. What protocol will you use to achieve this?

```
- SNMP
- DHCP
- SMTP
- ARP


Answer : DHCP
```

#### Q. What DHCP protocol does it use at the transport layer level?

```
- ICMP
- TCP
- FTP
- UDP


Answer : UDP
```

#### Q. What type of address is supported by DHCP?

```
- IPV4
- IPV6
- IPV4 and IPV6
- None of them


Answer : IPV4 and IPV6
```

#### Q. DHCP is used for ***\_***

```
- IPV4
- Both IPV6 and IPV4
- IPV6
- None of the mentioned


Answer : Both IPV6 and IPV4
```
