You are on page 1of 22


From Wikipedia, the free encyclopedia

Internet Protocol version 4 (IPv4) is the fourth revision in the development of the Internet Protocol (IP) and it is the first version of

the protocol to be widely deployed. Together with IPv6, it is at the core of standards-based internetworking methods of the Internet.

IPv4 is still by far the most widely deployed Internet Layer protocol. As of 2010, IPv6 deployment is still in its infancy.

IPv4 is described in IETF publication RFC 791 (September 1981), replacing an earlier definition (RFC 760, January 1980).

IPv4 is a connectionless protocol for use on packet-switched Link Layer networks (e.g., Ethernet). It operates on a best effort

delivery model, in that it does not guarantee delivery, nor does it assure proper sequencing or avoidance of duplicate delivery.

These aspects, including data integrity, are addressed by an upper layer transport protocol (e.g., Transmission Control Protocol).

Internet Protocol Suite

Application Layer




Transport Layer



Internet Layer

IP (IPv4, IPv6) · ICMP · ICMPv6 · IGMP ·IPsec ·


Link Layer

ARP/InARP · NDP · OSPF ·Tunnels (L2TP) · PPP · Media Access Control (Ethernet, DSL, ISDN, FDDI) ·(more)

This box: view • talk • edit



• 1 Addressing

o 1.1 Address representations

o 1.2 Allocation

o 1.3 Special-use addresses

o 1.4 Private networks

 1.4.1 Virtual private


o 1.5 Link-local addressing

o 1.6 Localhost

o 1.7 Addresses ending in 0 or 255

o 1.8 Address resolution

• 2 Address space exhaustion

• 3 Network address translation

• 4 Packet structure

o 4.1 Header

o 4.2 Data

• 5 Fragmentation and reassembly

o 5.1 Fragmentation

o 5.2 Reassembly

• 6 Assistive protocols

• 7 Early Development History

• 8 Notes

• 9 References

• 10 External links


IPv4 uses 32-bit (four-byte) addresses, which limits the address space to 4,294,967,296 (232) possible unique addresses. However,

some are reserved for special purposes such asprivate networks (~18 million addresses) or multicast addresses (~270 million

addresses). This reduces the number of addresses that can potentially be allocated for routing on the public Internet. As addresses

are being incrementally delegated to end users, an IPv4 address shortage has been developing. However, network addressing

architecture redesign via classful network design, Classless Inter-Domain Routing, and network address translation (NAT) has

contributed to delay significantly the inevitable exhaustion.

This limitation has stimulated the development of IPv6, which is currently in the early stages of deployment, and is the only long-

term solution.

[edit]Address representations

they are most often written in dot-decimal notation. The latter was therefore also called the rest field.0x02.0353 Each octet is individually converted into octal Hexadecimal 0xC00002EB Concatenation of the octets from the dotted hexadecimal Decimal 3221226219 The 32-bit number expressed in decimal Octal 030000001353 The 32-bit number expressed in octal Additionally. B.0002. methods were devised to allow IP networks to be subdivided.IPv4 addresses may simply be written in any notation expressing a 32-bit integer value.235 N/A Dotted Hexadecimal 0xC0.0xEB Each octet is individually converted to hexadecimal form Dotted Octal 0300. the network identifier represented in the most significant (highest order) octet of the address and the host identifier using the rest of the address. Class D was allocated for multicast addressing and Class E was reserved for future applications. The concept of the variable-length subnet mask (VLSM) was introduced which allowed flexible subdivision into varying network sizes. the high order octet of the addresses was redefined to create a set of classes of networks. an IP address was divided into two parts. C. D.0000.0x00.235 is a valid (though unconventional) equivalent to the above addresses. The following table shows several representation formats: Notation Value Conversion from dot-decimal Dot-decimal notation 192. which consists of the four octets of the address expressed separately in decimal and separated by periods. Class A. [edit]Allocation Originally. The rest of an address was used as previously to identify a host within a network. The system defined five classes. in a system which later became known as classful networking. in dotted format.0x00. The Classes A.2.0002. Quickly this was found to be inadequate. and E. which meant that each network class had a different capacity to address hosts. To overcome this limit. B. each octet can be of any of the different bases. Starting around 1985. For example. 192. but for human convenience.0.[1][2] . This enabled the creation of a maximum of 256 networks. and C had different bit lengths for the new network identification.

0. Documentation and example code RFC 5735 192.0.0/24 IPv6 to IPv4 relay RFC 3068 192.0.0/16 Private network RFC 1918 Private network RFC 1918 192.0.0. CIDR was designed to permit repartitioning of any address space so that smaller or larger blocks of addresses could be allocated to users. by contrast.18. and the class-based scheme was dubbed classful.16.0/8 Private network RFC 1918 127. this system of classes was officially replaced with Classless Inter-Domain Routing (CIDR).0/24 Reserved (IANA) RFC 5735 192.88.Around 1993.99. Each RIR maintains a publicly-searchable WHOIS database that provides information about IP address assignments.0/8 Current network (only valid as source address) RFC 1700 The hierarchical structure created by CIDR is managed by the Internet Assigned Numbers Authority (IANA) and the regional Internet registries (RIRs).0/24 TEST-NET-1.0/8 Loopback RFC 5735 169.0/15 Network benchmark tests RFC 2544 .0/16 Link-Local RFC 3927 172.0.168. [edit]Special-use addresses Main article: Reserved IP addresses#Reserved IPv4 addresses Reserved address blocks CIDR address Description Reference block 0.0.0.

0. Therefore. Optionally. two branch offices) via the public Internet.g.0–10. VPNs establish tunneling connections across the public network such that the endpoints of the tunnel function as routers for packets from the private network.198.255 16777216 Single Class A 10.0. These ranges are not routable outside of private networks and private machines cannot directly communicate with public networks. it is not possible to communicate directly between two private networks (e. three ranges of address are reserved for use in private networks. This requires the use of IP tunnels or a virtual private network (VPN).0.31. however.0.0.255 1048576 Contiguous range of 16 Class B blocks 172. They can.0/4 Reserved (former Class E network) RFC 1700 255. The following are the three ranges reserved for private networks (RFC 1918): Name Address range Number of addresses Classful description Largest CIDR block 24-bit block 10.0–172.0. Documentation and examples RFC 5737 203.0/24 TEST-NET- 65536 Contiguous range of 256 Class C blocks 192. do so through network address translation.0.0/12 16-bit block 192. .0/4 Multicasts (former Class D network) RFC 3171 240. Documentation and examples RFC 5737 In this routing function the host encapsulates packets in a protocol layer with packet headers acceptable in the public network so that they may be delivered to the opposing tunnel end point where the additional protocol layer is removed and the packet is delivered locally to its intended destination.255..0/16 [edit]Virtual private networks Packets with a private destination address are ignored by all public routers. 20-bit block 172.0/24 TEST-NET-3.255. encapsulated packets may be encrypted to secure the data while it travels over the public network.255.255 Broadcast RFC 919 [edit]Private networks Of the approximately four billion addresses allowed in IPv4.0.0–192.0.

one can assign[edit]Link-local addressing Main article: Link-local address RFC 5735 defines an address block.) This is only true of networks with subnet masks of at least 24 bits — Class C networks in the old classful addressing scheme. so it cannot also refer to an individual device in that subnet. the broadcast address always ends in 255.0. equivalent to the address range 192. APIPA has been deployed on millions of machines and has. and Class C. These addresses are not routable and like private addresses cannot be the source or destination of packets traversing the Internet. the broadcast address is found by obtaining the bit complement of the subnet mask and performing a bitwise OR operation with the network identifier. In our example. rather than a specific machine. In classful addressing (now obsolete with the advent of CIDR). Link-local addresses are primarily used for address autoconfiguration (Zeroconf) when a host cannot obtain an IP address from a DHCP server or other internal configuration methods.168. such as a local network segment or point-to-point connection.0. Filling the void. For example.255.0. [edit]Addresses ending in 0 or 255 Main article: IPv4 subnetting reference It is a common misunderstanding that addresses ending with an octet of 0 or 255 can never be assigned to hosts. 255. thus.0– 169.255. or in CIDR. A broadcast address is an address that allows information to be sent to all machines on a given subnet.168. the broadcast address is 192.0/8 in CIDR notation) is reserved for localhost communication.168. etc. [edit]Localhost Main article: localhost The address range 127.0 refers to the entire subnet. RFC 3927.0/255.0/16). so to avoid confusion this address also cannot be assigned to a host.255. Microsoft created an implementation called Automatic Private IP Addressing (APIPA).255.0 or /8.168. When the address block was reserved.0/255. In other words. or C subnet.168.0 (or 192.255 (127. 255.1.168. Due to Microsoft's market power. However.0–127.168. entitled Dynamic Configuration of IPv4 Link-Local Addresses. However.255. 192. there are only three possible subnet masks: Class A.0. Addresses within this range should never appear outside a host computer and packets sent to this address are returned as incoming packets on the same virtual network device (known as loopback).255. Many years later. On a Class A.0 (or for the special use in link-local addressing.255.0–255. become a de facto standard in the industry.255.0. Generally. the broadcast address would be 192. this does not mean that every addresses ending in 255 cannot be used as a host address.0/16.0. networks with masks of /24 to /32 (or 255. For example. 255. (though this can cause . (See also Subnet .0 or /16. in the case of a Class B subnet zeros or all ones. the broadcast address is the last address in the range belonging to the subnet.255.0 or /24. Class B.254. the IETF defined a formal standard for this functionality. no standards existed for mechanisms of address autoconfiguration. in the subnet 192.168. B.255.0/24) the identifier 192.5.255. that a host is connected to. These addresses are only valid on the link.

g. broadcast addresses do not necessarily end with 255. the DNS naming is also hierarchical and allows for subdelegation of name spaces to other DNS servers.wikipedia.[citation needed]This was the motivation for the introduction of classful networks. respectively. PDAs. With the advent of CIDR. providing a vastly increased address space that allows improved route aggregation across the Internet and offers large subnetwork allocations of a minimum of 264 host addresses to end-users. cable modems  Mobile devices — laptop computers. [edit]Address space exhaustion Main article: IPv4 address exhaustion Since the 1980s it has been apparent that the number of available IPv4 addresses is being exhausted at a rate that was not initially anticipated in the design of the network. for the creation of CIDR addressing. 192.freebsd. and finally for the redesign of the Internet Protocol. 192.0. there are several driving forces for the acceleration of IPv4 address exhaustion[citation needed]:  Rapidly growing number of Internet users  Always-on devices — ADSL modems. but by names (e. This requires translating (or resolving) domain names to mobile phones The accepted and standardized solution is the migration to IPv6. Much like CIDR addressing.0.168. [edit]Address resolution Main article: Domain Name System Hosts on the Internet are usually known not by IP but by the numeric IP addresses assigned to such domain www. All other addresses in the subnet can be assigned to hosts on that subnet. www.168. The routing of IP packets across the Internet is not directed by such names.0. In general. en. but 192. Migration to IPv6 is in progress but is expected to take considerable time.confusion).whitehouse. Today. Methods to mitigate the IPv4 address exhaustion are:  Network address translation (NAT) .0 is the network identifier and so cannot be assigned[why?][citation needed]. the first and last addresses in a subnet are used as the network identifier and broadcast address. Also. www. etc. The address size in IPv6 was increased from 32 bits in IPv4 to 128 The Domain Name System (DNS) provides such a system for converting names to addresses and addresses to names. based on a larger address format (IPv6). can be assigned (though this can also cause confusion)..1.berkeley. The domain name system is often described in analogy to the telephone system directory information systems in which subscriber names are translated to telephone numbers.

private network 'behind' a single public IP address. permitting the use of private addresses within the private network. The 13th field is optional (red background in table) and aptly named: options. One method was the introduction of network address translation (NAT). The fields in the header are packed with the most significant byte first (big endian).  Use of private networks  Dynamic Host Configuration Protocol (DHCP)  Name-based virtual hosting  Tighter control by Regional Internet Registries on the allocation of addresses to Local Internet Registries  Network renumbering to reclaim large blocks of address space allocated in the early days of the Internet As of October 2010 predictions of exhaustion date of the unallocated IANA pool converge to between January 2011 and January 2012[3] [edit]Network address translation Main article: Network address translation The rapid pace of allocation of the IPv4 addresses and the resulting shortage of address space since the early 1990s led to several methods of more efficient use. [edit]Header The IPv4 packet header consists of 13 fields. so the version field is actually found in the four most significant bits of the first byte. [edit]Packet structure An IP packet consists of a header section and a data section. the most significant bits are considered to come first (MSB 0 bit numbering). bit 0–3 4–7 8–13 14-15 16–18 19–31 offset Explicit Differentiated Services Code 0 Version Header Length Congestion Total Length Point Notification 32 Identification Flags Fragment Offset 64 Time to Live Protocol Header Checksum . Most mass-market consumer Internet access providers rely on this technique. of which 12 are required. for example. The most significant bit is numbered 0. NAT devices masquerade an entire. and for the diagram and discussion.

ECN is an optional feature that is only used when both endpoints support it and are willing to use it. Being a 4-bit value. this field specifies the size of the header (this also coincides with the offset to the data). An example is Voice over IP (VoIP) that is used for interactive data voice exchange. Differentiated Services Code Point (DSCP) Originally defined as the Type of Service field. New technologies are emerging that require real-time data streaming and therefore will make use of the DSCP field. Explicit Congestion Notification (ECN) Defined in RFC 3168 and allows end-to-end notification of network congestion without dropping packets. The minimum-length datagram is 20 bytes (20-byte header + 0 bytes data) and the . the maximum length is 15 words (15×32 bits) or 480 bits = 60 bytes. Internet Header Length (IHL) The second field (4 bits) is the Internet Header Length (IHL) telling the number of 32- bit words in the header. which is a length of 5×32 = 160 bits = 20 bytes. The minimum value for this field is 5 (RFC 791). For IPv4. including header and data. Since an IPv4 header may contain a variable number of options. this has a value of 4 (hence the name IPv4). 96 Source IP Address 128 Destination IP Address 160 Options ( if Header Length > 5 ) 160 or Data 192+ Version The first header field in an IP packet is the four-bit version field. this field is now defined by RFC 2474 for Differentiated services (DiffServ). Total Length This 16-bit field defines the entire datagram size. in bytes. It is only effective when supported by the underlying network.

Time To Live (TTL) An eight-bit time to live field helps prevent datagrams from persisting (e. but most modern hosts handle much larger packets. in which case datagrams must be fragmented.528 + 20 = 65. The MF flag is also not set on packets that are not fragmented — an unfragmented packet is its own last fragment. It is specified in seconds. must be zero. In latencies typical in . This field limits a datagram's lifetime. This allows a maximum offset of (213 – 1) × 8 = 65. The first fragment has an offset of zero. going in circles) on an internet. Fragmentation is handled in either the host or packet switch in IPv4 (see Fragmentation and reassembly). This can be used when sending packets to a host that does not have sufficient resources to handle fragmentation. is 13 bits long and specifies the offset of a particular fragment relative to the beginning of the original unfragmented IP datagram.[note 1]  bit 1: Don't Fragment (DF)  bit 2: More Fragments (MF) If the DF flag is set and fragmentation is required to route the packet then the packet will be dropped. from high order to low order):  bit 0: Reserved. Some experimental work has suggested using the ID field for other purposes. measured in units of eight-byte blocks. Fragment Offset The fragment offset field. Identification This field is an identification field and is primarily used for uniquely identifying fragments of an original IP datagram. but time intervals less than 1 second are rounded up to 1.maximum is 65. Sometimes subnetworks impose further restrictions on the size.535 bytes with the header length included (65.535 — the maximum value of a 16-bit word.548 bytes). such as for adding packet-tracing information to datagrams in order to help trace back datagrams with spoofed source addresses. They are (in order. which does not have the MF flag set.g. The minimum size datagram that any host is required to be able to handle is 576 bytes. When a packet is fragmented all fragments have the MF flag set except the last fragment.528 bytes which would exceed the maximum IP packet length of 65.[4] Flags A three-bit field follows and is used to control or identify fragments.

At each hop. then the packet is discarded. the checksum of the header must be compared to the value of this field. Note that errors in the data field are up to the encapsulated protocol to handle — indeed. The reception of these ICMP messages is at the heart of how traceroute works. Since the TTL field is decremented on each hop and fragmentation is possible at each hop then at each hop the checksum will have to be recomputed. For purposes of computing the checksum. an ICMP message (specifically the time exceeded) is sent back to the sender that it has been discarded.practice. Each router that a datagram crosses decrements the TTL field by one. The Internet Assigned Numbers Authority maintains a list of IP protocol numbers which was originally defined in RFC 790. Header Checksum The 16-bit checksum field is used for error-checking of the header. it has come to be a hop count field. In other words. Protocol This field defines the protocol used in the data portion of the IP datagram.the checksum of the header with the checksum field filled in should be a word containing all zeros (value 0). Typically. all 16-bit words are summed together using one's complement (with the checksum field set to zero). When the TTL field hits zero. If a header checksum is found to be mismatched. The method used to compute the checksum is defined within RFC 1071: The checksum field is the 16-bit one's complement of the one's complement sum of all 16-bit words in the header. use Hex 45000030442240008006442e8c7c19acae241e2b (20 bytes IP header): 4500 + 0030 + 4422 + 4000 + 8006 + 0000 + 8c7c + 19ac + ae24 + 1e2b = 2BBCF 2 + BBCF = BBD1 = 1011101111010001. Source address . both UDP and TCP have checksum fields. The sum is then one's complemented and this final value is inserted as the checksum field. the packet is no longer forwarded by a packet switch and is discarded. the value of the checksum field is zero. For example. the 1'S of sum = 0100010000101110 = 442E To validate a header's checksum the same algorithm may be used .

which translates the destination address to the original sender's address.An IPv4 address is a group of four octets for a total of 32 bits.9. Destination address Identical to the source address field but indicates the receiver of the packet. The value for this field is determined by taking the binary value of each octet and concatenating them together to make a single 32-bit value. The list of options may be terminated with an EOL (End of Options List.7 would be 00001010000010010000100000000111. but these are not often used. Options Additional header fields may follow the destination address field. For example. this is only necessary if the end of the options would not otherwise coincide with the end of the header. 0x00) option. the source address will be translated by the NATing machine to its own address. Note that the value in the IHL field must include enough extra 32-bit words to hold all the options (plus any padding needed to ensure that the header contains an integral number of 32-bit words). Thus. reply packets sent by the receiver are routed to the NATing machine. Instead. the address 10. This address is the address of the sender of the packet. Note that this address may not be the "true" sender of the packet due to network address translation.8. The possible options that can be put in the header are as follows: Fi Cop Opt Clas Opt .

e. not inc contents of the data f header field and can layer protocols.the Option Typ The use of the LSRR and SSRR options (Loose and Strict Source and Record Route) is discouraged because they create security concerns. Some of the most co below including their  1: Internet  2: Internet  6: Transm . Num Opt Len Opt Dat  Note: If the i. many routers block packets containing these options. it is between 6-15 present and must be  Note: the C Number are sometim field .[citation needed] [edit]Data The last field is not a consequently.

the next g namely IPv6. instea maximum transmissio and send conforming [edit]Fragmentat When a device receiv destination address a . but also in the methods. does no fragmentation. 17: User D  41: IPv6 e  89: Open S  132: Strea See List of IP protoco [edit]Fragmenta Main article: IP fragm The Internet Protocol architecture that enab traffic and route traffi accommodates netw independent of the u used in the Link Laye hardware design usu speed. characteriz unit (MTU) paramete networks. it was nece automatically adjust t adapt to the underlyin need forfragmentatio function was placed a performed in IPv4 rou layer as highest one In contrast.

(1480/8) = 185 (5920/8) = 740. if a 4. This interface the maximum data si bigger than the MTU data. etc. for an I Ethernet MTU of 1. For use. By some chance if a or the MTU reduces t fragmented again.50 be: 0.50 an IP packet with no bytes) and is transmi bytes then it will be b . w  The fragm the offset of the segm measured in units of  The heade For example. The device then segm each segment is less IP header size (20 by Each segment is then following changes:  The total le  The more except the last one.

let's say the MT fragment will individu fragments each: Indeed. the amount o 1000 + 1480 + 540 = .Now.

(495) * 8 (bytes) plus also the total length. and receiver receives a fr set to 0 then it knows payload since the fra plus the data length i payload size. It . Note that fragments 3 fragment 2. When a d fragment then it must fragment it creates (f fragment would be se [edit]Reassembly When a receiver dete following is true:  "more frag  "fragment then the receiver kno receiver then stores t fragment offset. Using the example ab fragment 4 the fragm the data length (540 the original data leng Once it has all the fra data in proper order ( pass it up the stack fo [edit]Assistive p The Internet Protocol enables internetwork forms the Internet.

protocol in the computing. Protoc in the Internet Protoc are Dynamic Host Co infrequently. for e or connected to a ne address. The Address Re IP address to hardwa translation for IPv4. I often necessary. inverse [edit]Early Deve IPv4 was developed concept though for th Hornsby born Simon submission via a loca UseNet via the pollin comp. The struc protocol humanisatio of the then illusionary abracadabra from the stage magic.addresses are not tie hardware identificatio can have multiple IP additional mechanism between device inter properly deliver an IP link. This was a collation o collated by the Comp the producer of 'Acce submitted via their BB UseNet in the mid 19 the network standard . unless an a administrator.

^ As an Ap 3514 as the "Evil bit" [edit]References 1.the IPv6 protocol was in the 90's on comp.pdf 3. ^ http://ww 2. .p The information desig Australian community concept unique to Sim byte rail but was deve collation they are fun are the founders of th communication proto As a protocol standar tunneling computer p by military resources TCP before IPv4 this token tagging of proto also directly refers to the base of finding a where redeveloped in the subnet system m number of IPv4 addre addressing system w The maths of this sys (254 x 254 x 254 x 25 [edit]Notes 1. G Retrieved 2010-10-06. ^ Huston. ^ http://tech us/library/cc779089%2 2.

4. ca IPv4 Address exhaustion:  RIPE repo 2003  Official cur maintained by IANA  Dynamical consumption with pre Huston  IP address shortage  Countdow addresses (estimated Categories: Internet P standards | Internet L protocols • New featur • Log in / cre account • Article • Discussion • Read . ^ Savage. traceback". Retrieved [edit]External lin  RFC 791 —  http://www Authority (IANA)  http://www — IP Header Breakd  RFC 3344  IPv6 vs.

• Edit • View histo • Main page • Contents • Featured co • Current eve • Random ar • Donate Interaction • Help • About Wiki • Community • Recent cha • Contact Wi Toolbox Print/export Languages • ‫العربية‬ • Bosanski • Česky • Dansk • Deutsch • Español • Euskara • ‫فارسی‬ • Français • 한국어 • Hrvatski • Bahasa Ind • Italiano • Latviešu • Македонск • Bahasa Me • Nederlands • 日本語 • Norsk (bok • Polski • Русский • Slovenčina • Svenska • தமிழ் • Türkçe • Tiếng Việt • Yorùbá • 中文 .

. • Text is avail Attribution-ShareAlike L See Terms of Use for de Wikipedia® is a register Foundation. a non- • Contact us .• This page w 06:52. Inc.