An IP packet consists of the data being transmitted and a fixed length header block:
Header (20 bytes) | Data (variable length) |
The header contains 12 fields and is 20 bytes long. Two of those fields are the source and destination IP addresses. Since the address fields are 32 bits each the theoretical address space is as follows:
Number system | Smallest address | Largest address |
---|---|---|
Binary | 00000000.00000000.00000000.00000000 | 11111111.11111111.11111111.11111111 |
Decimal | 0.0.0.0 | 255.255.255.255 |
Hexadecimal | 00.00.00.00 | FF.FF.FF.FF |
In decimal, that would a range of 0 to 4,294,967,295, giving 4,294,967,296 unique addresses.
As you see, IP addresses are long numbers in binary, so we typically write them in decimal or hexadecimal with dots separating the four bytes.
For example, sws.csudh.edu has the IP address 155.135.1.163.
You can see the IP address of the computer you are currently using by opening a DOS command window and giving the ipconfig command.
An IP address is broken down into two parts, the network identifier and the host identifier. Routers use the network identifier to deliver a packet to its destination network and the routers and switches within that network deliver it to the destination host.
For example, CSUDH has been assigned a network address of 155.135, so the IP addresses on our campus run from 155.135.0.0 to 155.135.255.255. Internet routers use the 155.135 portion of the address to get a packet to our campus, and our router and switches take over from there.
That says the off-campus routers pay attention to the 16 high-order bits, ignoring the 16 low-order bits and on campus we can do the opposite. Rather than saying we "ignore" certain bits, programmers say they are masked out.
Some IP addresses are reserved. One special address is 127.0.0.1 which is reserved for local loop back. If an application sends a packet to this address, it is fed back into the sending machine as if it had come from the outside. This is very handy when you are running a client and server on your own machine, for example, a local Web server for development testing.
Several blocks of the IP address space are also reserved as non-routable addresses which are to be used solely within a LAN. We will discsuss these when we talk about NAT.