TCP/IP(1)_1

silups·2024년 9월 19일
1

TCP/IP

목록 보기
1/12

CH5 IPv4 Addresses

CH5-1

Internet address(IP address)
: TCP/IP 프로토콜 제품군의 IP 계층에서 인터넷에 연결된 각 장치를 식별하는 데 사용되는 실별자

IPv4

  • 호스트나 라우터의 인터넷 연결을 고유하고 보편적으로 정의하는 32비트 주소
  • 보편적으로 사용
  • 2322^{32}(4,294,967,296)의 주소 공간을 가지고 있음

ex5.1 (2진법 -> 10진법)

Change the following IPv4 addresses from binary notation(2진법) to dotted-decimal notation(10진법).

  1. 10000001 00001011 00001011 11101111
10000001000010110000101111101111
128 + 18 + 2 + 1255 - 16

: 129.11.11.239

  1. 11000001 10000011 00011011 11111111
    : 193.131.27.255

  2. 11100111 11011011 10001011 01101111
    : 231.219.139.111

  3. 11111001 10011011 11111011 00001111
    : 249.155.251.15

ex5.2 (10진법 -> 2진법)

Change the following IPv4 addresses from dotted-decimal notation to binary notation.

  1. 111.56.45.78
111564578
64+32+8+4+2+132+16+832+8+4+164+8+4+2
01101111001110000010110101001110
  1. 221.34.7.82

    : 11011101 00100010 00000111 01010010
  1. 241.8.56.12
    : 11110001 00001000 00111000 00001100

4.75.45.34.78
: 01001011 00101101 00100010 01001110

ex5.3 (오류 찾기)

Find the error, if any, in the following Ipv4 addresses
1. 111.56.045.78
:
045에 0이 없어야 한다 (10진수 표기)

  1. 221.34.7.8.20
    :
    IPv4는 32비트 주소이다. 위의 주소는 8비트를 더 가지고 있다.

  2. 75.45.301.14
    :
    IPv4는 한 바이트 당 0 ~ 255(282^8 = 256)까지의 숫자를 가질 수 있다. 301은 255를 넘었다.

  3. 11100010.23.14.67
    :
    2진수와 10진수가 혼합되어 있다. 하나로 맞춰 주어야 한다. (226.23.14.67)

ex5.4 (2진법 -> 16진법)

Change the following IPv4 addresses from binary notation to hexadecimal notation(16진수).

  1. 10000001 00001011 00001011 11101111

0X810B0BEF or 810B0BEF16810B0BEF_{16}
-> 16진수 표기라는 것을 나타내 주어야 함

  1. 11000001 10000011 00011011 11111111
11000001100000110001101111111111
1100/00011000/00110001/10111111/1111
12/18/31/1115/15
C1831BFF

0XC1831BFF or C1831BFF16C1831BFF_{16}

ex5.5 (주소 범위 찾기)

Find the number of addresses in a range if the first address is 146.102.29.0 and the last address is 146.102.32.255
(주소 범위 구하기)
:

Last address - First address
(146.102.32.255) - (146.102.29.0) = 0.0.3.255

(02563+02562+32561+2552560)+1(0 * 256^3 + 0 * 256^2 + 3 * 256^1 + 255 * 256^0) + 1
= 0 + 0 + 768 + 255 + 1= 1024

-> +1을 하는 이유는 last address를 포함하기 위함

ex5.6 (마지막 주소 찾기)

The first address in a range of addresses is 14.11.45.96. If the number of addresses in the range is 32, what is the last address?
(범위가 32일 때 last address는?)
:
First address + (Range -1)
14.11.45.96 + 0.0.0.31 = 14.11.45.127

-> -1을 하는 이유는 First address 하나를 제외한 것

ex5.7 (NOT 연산)

InputOutput
01
10
  • binary notation
Original number00010001011110010000111000100011
NOT operation11101110100001101111000111011100
  • dotted-decimal
    255 - X
Original number171211435
NOT operation238134241220

ex5.8 (AND 연산)

Input1Input2Output
000
010
100
111

-> 둘다 1인 경우에만 1

  • binary notation
num100010001011110010000111000100011
num211111111111111111000110000000000
result00010001011110010000110000000000
  • dotted-decimal
num1171211435
num22552551400
result17121120

14 && 140
14 = 23(8)+22(4)+21(2)2^3(8) + 2^2(4) + 2^1(2)
140 = 27(128)+23(8)+22(4)2^7(128) + 2^3(8) + 2^2(4)
-> result = 23(8)+22(4)2^3(8) + 2^2(4) = 12

ex5.9 (OR 연산)

Input1Input2Output
000
011
101
111

-> 둘 중 하나라도 1인 경우에 1

  • binary notation
num100010001011110010000111000100011
num211111111111111111000110000000000
result111111111111111111000111000100011
  • dotted-decimal
num1171211435
num22552551400
result25525514235

14 | | 140
14 = 23(8)+22(4)+21(2)2^3(8) + 2^2(4) + 2^1(2)
140 = 27(128)+23(8)+22(4)2^7(128) + 2^3(8) + 2^2(4)
-> result = 27(128)+23(8)+22(4)+21(2)2^7(128) + 2^3(8) + 2^2(4) + 2^1(2) = 142

profile
NDBT

0개의 댓글