IP Address
Internal
|[IP]
!!!Overview
IP addresses allow network resources to be reached through a network interface.
Each IP address must be unique in its own network.
Networks can be isolated from each other, or they can be bridged or translated (see [NAT])
!!!IPv4 Address
An IPv4 address consists in 32 bits (4 bytes). Each byte is divided by a period and typically expressed as a number 0-255. Example
{{{ 192.168.1.1 }}}
!!!IPv4 Address Classes
0
Each of the address classes have a range within them that is used to designate private (not routed) networks. Any computer that is not connect to internet directly can use these addresses.
!!Class A
Template:0 xxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx
If the first bit of the IPv4 address is 0, in means that the address is part of class A. The address falls within the range 0.0.0.0 - 127.255.255.255.
!Loopback Range
The loopback range is specified by addresses from 127.0.0.0 to 127.255.255.255. Addresses in this range are used by each host to test networking to itself. Typically, 127.0.0.1 is used.
!Private Network Assignment within Class A
10.0.0.0-10.255.255.255
!!Class B
Template:10 xxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx
If the first two bits of the address are 10, the address is in class B. The address falls within the range 128.0.0.0 - 191.255.255.255.
!Private Network Assignment within Class B
172.16.0.0-172.31.255.255
Example 170.20.1.1/255.255.0.0 (/16)
!!Class C
Template:110 xxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx
If the first three bits of the address are 110, the address is in class C. The address falls within the range 192.0.0.0 - 223.255.255.255.
!Private Network Assignment within Class C
192.168.0.0-192.168.255.255
!!Class D
Template:1110 xxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx
If the first four bits of the address are 1110, the address is in class D. The address falls within the range 224.0.0.0 - 239.255.255.255.
Class D is reserved fro multicast protocols.
!!Class E
Template:1111 xxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx
If the first four bits of the address are 1111, the address is in class E. The address falls within the range 224.0.0.0 - 255.255.255.255.
Class E addresses are reserved for future and experimental use, and are largely not used.
!!!Network Address and Host Address
IPv4 addresses are a concatenation of two separate components. The first part of the address is used to identify the network the address is part of. The second part, that comes afterwards, designates a specific host within that network. Note that the host bits can be further reallocated to represent subnets within a network, effectively enlarging the network address space on the expense of host address space. See [IPAddress#Subnets] below.
Class A addresses use the remainder of the first octet (7 bits) to represent the network and the rest of the three octets to define hosts.
Class B addresses use the first two octets (6 + 8 = 14 bits) to represent the network and the rest of the two octets to define hosts.
Class C addresses use the first three octets (5 + 8 + 8 = 21bits) to represent the network and the rest of 1 octet to define hosts.
Within the host address space, 0 and 11...11 are reserved and cannot used as host addresses.
For example, for a C class address, 0 and 256 cannot be used as host addresses.
!!!Network Address, Netmasks, Subnets and Subnet Maks
Each IP address class defines what part of the IP address is used to designate the network.
!Netmask
A __netmask__ defines what bits of the IP address are used to designate the network. Traditionally, that is represented by turning those bits to 1, which makes the netmask a 32 bit number filled with all-1s in the network part of the IP address, and with all-0s in the host part.:
|Class |Default Netmask |Netmask |A |Template:11111111.00000000.00000000.00000000 | 255.0.0.0 |B |Template:11111111.11111111.00000000.00000000 | 255.255.0.0 |C |Template:11111111.11111111.11111111.00000000 | 255.255.255.0
We determine the network portion of the address by applying a bitwise AND operation to between the address and the netmask.
!Example
For class C address 192.168.0.1, the first three bytes are used to address the network (192.168.0.0) and the last byte is used to address the hosts within the network. 1 is an address out of 254 unique addresses allowed by the space (the address space allows for 256 unique values, but 0 and 256 cannot be used, as they are reserved). The netmaks in this case is Template:11111111.11111111.11111111.00000000 or 255.255.255.0.
!!Subnets
By default, each network has one subnet, which contains all hosts that can be defined in that network. However, some of the bits used to represent the host address can be reallocated as additional network specification, thus allowing for the definition of additional subnets within the network.
Do reallocated bits need to be adjacent to the network portion?
If subnetting is used, the netmask becomes the __subnet mask__. A subnet masks is essentially a netmask with additional bits reallocated from host address representation to network address representation.
!Example
In the above example we might decide we don't need a host address space that allows 256 hosts, so we re-allocate 1 bit to the network address space. The netmask becomes the subnet mask and it is Template:11111111.11111111.11111111.10000000 or 255.255.255.128.
Traditionally, the subnet itself must not be used as an address.
!!The CIDR (Classless Inter-Domain Routing) Notation
The CIDR notation is a specification added to the IP address itself as to the number of significant bits that make up the routing or networking portion:
{{{ X.X.X.X/<the-number-of-first-bits-of-the-ip-address-that-represent-the-network-address> }}}
The CIDR number comes from the number of 1's in the subnet mask when converted to binary.
!Example
In the above subnetting example, the CIDR notation is 192.168.0.1/25.
!Values
|Subnet Mask |CIDR Prefix |Total IP's |Usable IP's |Number of Class C networks |255.255.255.255| /32| 1| 1| 1/256th |255.255.255.254| /31| 2| 0| 1/128th |255.255.255.252| /30| 4| 2| 1/64th |255.255.255.248| /29| 8| 6| 1/32nd |255.255.255.240| /28| 16| 14| 1/16th |255.255.255.224| /27| 32| 30| 1/8th |255.255.255.192| /26| 64| 62| 1/4th |255.255.255.128| /25| 128| 126| 1 half |255.255.255.0| /24| 256| 254| 1 |255.255.254.0| /23| 512| 510| 2 |255.255.252.0| /22| 1024| 1022| 4 |255.255.248.0| /21| 2048| 2046| 8 |255.255.240.0| /20| 4096| 4094| 16 |255.255.224.0| /19| 8192| 8190| 32 |255.255.192.0| /18| 16,384| 16,382| 64 |255.255.128.0| /17| 32,768| 32,766| 128 |255.255.0.0| /16| 65,536| 65,534| 256 |255.254.0.0| /15| 131,072| 131,070| 512 |255.252.0.0| /14| 262,144| 262,142| 1024 |255.248.0.0| /13| 524,288| 524,286| 2048 |255.240.0.0| /12| 1,048,576| 1,048,574| 4096 |255.224.0.0| /11| 2,097,152| 2,097,150| 8192 |255.192.0.0| /10| 4,194,304| 4,194,302| 16,384 |255.128.0.0| /9| 8,388,608| 8,388,606| 32,768 |255.0.0.0| /8| 16,777,216| 16,777,214| 65,536 |254.0.0.0| /7| 33,554,432| 33,554,430| 131,072 |252.0.0.0| /6| 67,108,864| 67,108,862| 262,144 |248.0.0.0| /5| 134,217,728| 134,217,726| 1,048,576 |240.0.0.0| /4| 268,435,456| 268,435,454| 2,097,152 |224.0.0.0| /3| 536,870,912| 536,870,910| 4,194,304 |192.0.0.0| /2| 1,073,741,824| 1,073,741,822| 8,388,608 |128.0.0.0| /1| 2,147,483,648| 2,147,483,646| 16,777,216 |0.0.0.0| /0| 4,294,967,296| 4,294,967,294| 33,554,432
!!!IPv6 Address
An IPv6 address consists in 128 bits (16 bytes). An IPv6 address is generally written out as eight segments of four hexadecimal digits:
{{{ 1203:8fe0:fe80:b897:8990:8a7c:99bf:323d }}}
__Referenced by:__\\ [{INSERT com.ecyrd.jspwiki.plugin.ReferringPagesPlugin WHERE max=20, maxwidth=50}]