IPv4(Internet Protocol version 4)는 32비트 주소로 호스트를 가리키고, 데이터그램을 발신 호스트에서 목적 호스트까지 전달하는 IP의 4판이다. RFC 791이 정한다. IPv4는 비연결형 프로토콜로, 전달도, 순서도, 중복 없음도 보장하지 않는다.[1] 데이터그램은 손상되거나, 중복되거나, 순서가 바뀌거나, 아예 도착하지 않을 수 있다. 신뢰성이 필요하면 IP 위 계층이 맡으며, TCP가 끝과 끝 신뢰성을 주는 전송 계층 프로토콜이다.[2]

주소

IPv4 주소는 32비트다.[1] 주소는 흔히 8비트씩 네 부분으로 나누어, 각 부분을 0~255의 10진수로 쓰고 점으로 잇는 점 10진 표기(dotted-decimal)로 쓴다.[3][4] 예: 192.0.2.1.[5]

주소의 앞부분은 네트워크를, 뒷부분은 그 네트워크 안의 호스트를 가리킨다.[1][2]

RFC 4632에 따르면 CIDR(Classless Inter-domain Routing) 표기는 접두사를 IPv4 주소와 같은 4바이트 값으로 쓰고, 그 뒤에 /와 유효 비트 수를 뜻하는 0~32의 10진수를 붙인다. 예를 들어 마스크가 255.255.0.0인 옛 Class B 네트워크 172.16.0.0은 접두사 172.16.0.0/16이다.[6]

특수한 용도의 주소가 있다.[7]

  • 255.255.255.255는 제한된 브로드캐스트 주소로, 보낸 호스트가 연결된 물리 네트워크의 모든 호스트가 받고, 그 네트워크 밖으로 전달되지 않는다.
  • 호스트 부분이 모두 1인 주소는 그 네트워크의 방향 지정 브로드캐스트 주소다.[2][8]
  • 224.0.0.0부터 239.255.255.255까지는 멀티캐스트 주소다.[9][10]
  • 127.0.0.0/8은 루프백 주소다.[2][7]
  • RFC 1918에 따르면 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 세 블록은 IANA가 사설 인터넷용으로 남겨 둔 주소다. 이 주소는 그것을 쓰는 조직, 또는 이 주소 공간을 함께 쓰기로 한 조직들 안에서만 유일하다.[11]
  • 호스트는 인터페이스에 169.254.0.0/16 안의 링크 로컬 주소를 스스로 설정할 수 있다. 이 자동 설정은 다른 설정 수단이 없는 환경에서 특히 쓸모 있다. 이 주소는 같은 물리(또는 논리) 링크에 직접 연결된 장치와 통신하는 데만 맞는다.[12]

헤더

IPv4 헤더는 옵션이 없으면 20바이트이고, 옵션을 포함해 최대 60바이트다. 데이터그램 전체의 최대 길이는 65,535바이트다. 헤더 필드는 아래와 같다.[1]

필드비트뜻
Version4IP 판 번호. IPv4는 4
IHL4헤더 길이. 32비트 워드 단위
Type of Service8아래 설명 참고
Total Length16헤더와 데이터를 합친 데이터그램 길이. 바이트 단위
Identification16단편을 재조립할 때 같은 데이터그램을 가려내는 값
Flags3단편화 제어 플래그. 예약 비트 하나와 DF(Don’t Fragment), MF(More Fragments)
Fragment Offset13단편이 원래 데이터그램에서 놓이는 자리. 8바이트 단위
Time to Live8데이터그램이 네트워크에 머물 수 있는 한도
Protocol8데이터 부분에 실린 위 계층 프로토콜
Header Checksum16헤더만의 체크섬
Source Address32발신 주소
Destination Address32목적 주소
Options가변선택 사항

헤더 필드는 가장 높은 자리 바이트부터 보내는 네트워크 바이트 순서로 보낸다.[1]

RFC 791은 Type of Service를 원하는 서비스 품질을 가리키는 필드로 정했다.[1] RFC 2474는 이 옥텟을 대체하는 DS(Differentiated Services) 필드를 정의했다.[13] RFC 3260은 RFC 2474가 8비트 옥텟 전체를 DS 필드로 부른 것이 불일치와 모호함을 낳았다고 보고, 앞으로의 문서에서는 DS 필드를 옛 Type of Service 옥텟의 상위 6비트로 정의하기를 권했다. 이 6비트 필드에 담는 값이 DSCP(Differentiated Services Codepoint)다.[14]

RFC 3168은 Type of Service 옥텟의 정의를 6비트 DS 필드가 대체한 것으로 두고, 이 옥텟의 비트 6과 7을 2비트 ECN(Explicit Congestion Notification) 필드로 정한다. ECN 필드는 IPv6의 Traffic Class 옥텟에서도 같게 정의된다.[15]

Protocol 필드 값은 IANA가 관리한다. ICMP는 1, TCP는 6, UDP는 17이다.[16]

라우터는 데이터그램을 넘길 때마다 Time to Live를 1 이상 줄이고, 0이 되면 데이터그램을 버린다.[17] Time to Live처럼 바뀌는 헤더 필드가 있으므로, Header Checksum은 헤더를 처리하는 곳마다 다시 계산한다.[1]

단편화

데이터그램이 다음 네트워크가 허용하는 크기보다 크면, IPv4는 이를 여러 단편으로 나눈다. 단편은 목적 호스트에서 재조립한다.[1] 라우터는 데이터그램을 넘기기 전에 재조립하지 않는다.[17] DF 플래그가 선 데이터그램은 나누지 않으며, 나누지 않고는 목적지에 전달할 수 없으면 버린다. 이런 단편화와 재조립은 분할과 재조립의 한 경우다.[1]

라우팅

데이터그램은 라우터를 거쳐 네트워크 사이를 건넌다.[1][17] 라우터가 경로를 고르는 방법은 인터넷 프로토콜 스위트에서 다룬다. 이더넷 같은 링크에서 IPv4 주소에 대응하는 링크 계층 주소는 ARP로 얻는다.[2][18]

IPv6와의 차이

IPv4의 32비트 주소 공간은 약 43억 개다. IETF는 주소 공간이 점점 제약이 되리라는 전망에 따라 IPv4의 후계 프로토콜을 찾기 시작했다.[19] 그 결과 나온 IPv6는 주소 크기를 32비트에서 128비트로 늘렸다.[20]

[1]
J. Postel, “RFC 791 Internet Protocol.” 1981. Accessed: Sep. 26, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc791
[2]
R. Braden, Ed., “RFC 1122 Requirements for Internet Hosts — Communication Layers.” 1989. Accessed: Sep. 26, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc1122
[3]
T. Berners-Lee, R. Fielding, and L. Masinter, “RFC 3986 Uniform Resource Identifier (URI): Generic Syntax.” 2005. Accessed: Sep. 29, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc3986
[4]
R. Braden, Ed., “RFC 1123 Requirements for Internet Hosts – Application and Support.” 1989. Accessed: Sep. 29, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc1123
[5]
J. Arkko, M. Cotton, and L. Vegoda, “RFC 5737 IPv4 Address Blocks Reserved for Documentation.” 2010. Accessed: Sep. 29, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc5737
[6]
V. Fuller and T. Li, “RFC 4632 Classless Inter-domain Routing (CIDR): The Internet Address Assignment and Aggregation Plan.” 2006. Accessed: Sep. 29, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc4632
[7]
M. Cotton, L. Vegoda, R. Bonica, and B. Haberman, “RFC 6890 Special-Purpose IP Address Registries.” 2013. Accessed: Sep. 29, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc6890
[8]
J. C. Mogul, “RFC 919 Broadcasting Internet Datagrams.” 1984. Accessed: Sep. 29, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc919
[9]
S. E. Deering, “RFC 1112 Host Extensions for IP Multicasting.” 1989. Accessed: Sep. 29, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc1112
[10]
M. Cotton, L. Vegoda, and D. Meyer, “RFC 5771 IANA Guidelines for IPv4 Multicast Address Assignments.” 2010. Accessed: Sep. 29, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc5771
[11]
Y. Rekhter, B. Moskowitz, D. Karrenberg, G. J. de Groot, and E. Lear, “RFC 1918 Address Allocation for Private Internets.” 1996. Accessed: Oct. 22, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc1918
[12]
S. Cheshire, B. Aboba, and E. Guttman, “RFC 3927 Dynamic Configuration of IPv4 Link-Local Addresses.” 2005. Accessed: Oct. 22, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc3927
[13]
K. Nichols, S. Blake, F. Baker, and D. Black, “RFC 2474 Definition of the Differentiated Services Field (DS Field) in the IPv4 and IPv6 Headers.” 1998. Accessed: Sep. 29, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc2474
[14]
D. Grossman, “RFC 3260 New Terminology and Clarifications for Diffserv.” 2002. Accessed: Oct. 22, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc3260
[15]
K. Ramakrishnan, S. Floyd, and D. Black, “RFC 3168 The Addition of Explicit Congestion Notification (ECN) to IP.” 2001. Accessed: Oct. 22, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc3168
[16]
IANA, “Protocol Numbers.” 2026. Accessed: Sep. 29, 2026. [Online]. Available: https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
[17]
F. Baker, Ed., “RFC 1812 Requirements for IP Version 4 Routers.” 1995. Accessed: Sep. 29, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc1812
[18]
D. Plummer, “RFC 826 An Ethernet Address Resolution Protocol: Or Converting Network Protocol Addresses to 48.bit Ethernet Address for Transmission on Ethernet Hardware.” 1982. Accessed: Sep. 29, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc826
[19]
S. Bradner and A. Mankin, “RFC 1752 The Recommendation for the IP Next Generation Protocol.” 1995. Accessed: Sep. 29, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc1752
[20]
S. Deering and R. Hinden, “RFC 8200 Internet Protocol, Version 6 (IPv6) Specification.” 2017. Accessed: Sep. 29, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc8200