IPv4 addressing
by Wenwei Weng
When Internet was started, it starts with IPv4 address, which is 32-bit number. Initially the IPv4 address is classified into type A, B, C, D, E. In 1993 IETF introduced Classless Inter-Domain Routing (CIDR) with goal to slow the growth of routing tables on routers across the Internet, and to help slow the rapid exhaustion of IPv4 addresses.
Classful IPv4 address
The IPv4 address is classified into class A, B, C, D and E, D is for multicast, and E is reserved. In fact, it is really not used in the nwtwork. Below table shows Class A, B and C address.
Class A - *0xxxxxxx
First octet is used for numbering the networks as defined by default mask.
Available number of bits that can be ‘modified’ as represented by ‘x’ are 7 and therefore number of possible different network number combinations using those bits is equal to 2^7. For each Class A network, it can have hosts up to 2^24-2.
Note: that 10.x.x.x is defined as private IPv4 address, which means these addresses are not routable in the public internet, rather they are extensive used inside corprate network, i.e. intranet. Inside Cisco network, majority of linux servers in the data center has 10.x.x.x address.
Class B - 10xxxxxx.xxxxxxxx
First two octets are used for numbering the networks as defined by default mask.
Available number of bits that can be ‘modified’ as represented by ‘x’ are 14 and therefore number of possible different network number combinations using those bits is equal to 2^14. For each Class B network, it can have hosts up to 2^16-2.
Note: that 172.16.x.x - 172.32.x.x are defined as private IPv4 address, which means these addresses are not routable in the public internet, rather they are extensive used inside corprate network, i.e. intranet. Inside Cisco network, 172.16.x.x-172.32.x,x are used for lab, i.e. linux server, router interfaces etc.
Class C - 110xxxxx.xxxxxxxx.xxxxxxxx
First three octets are used for numbering the networks as defined by default mask.
Available number of bits that can be ‘modified’ as represented by ‘x’ are 21 and therefore number of possible different network number combinations using those bits is equal to 2^21. For each Class C network, it can have hosts up to 2^8-2
Note: that 192.168.x.x is defined as private IPv4 address, which means these addresses are not routable in the public internet, rather they are extensive used inside corprate network, i.e. intranet. Inside Cisco network, 192.168.x.x is used as private network for group/BU specific set up, they are typically going through NAT to talk to coprate network.
As we can see in the case of Class A network, the maximum allowed hosts is huge, which is often not the case in the actual network. This leads to waste of limited precious IPv4 address. In Cisco router, by default, the routing protocol assumes classless addressing, i.e. when it advertises the route, it will include network with subnet mask. Still if the customer really wants to enable classful routing, it can do so by “no ip classless”:
CIDR, VLSM, CIDR notation
Under CIDR, IPv4 addresses are described as consisting of two groups of bits in the address: the most significant bits are the network address (or network prefix or network block), which identifies a whole network or subnet, and the least significant set forms the host identifier, which specifies a particular interface of a host on that network.Under CIDR, the restriction of network block is either 8, 16, or 24 bits is removed. Based on the actual network set up, the network can be any size as appropriate.
Classless Inter-Domain Routing is based on variable-length subnet masking (VLSM). Under CIDR, one host is described through CIDR notation, e.g.
- 192.168.100.14/24 represents the IPv4 address 192.168.100.14 and its associated routing prefix 192.168.100.0, or equivalently, its subnet mask 255.255.255.0, which has 24 leading 1-bits.
- block 192.168.100.0/22 represents the 1024 IPv4 addresses from 192.168.100.0 to 192.168.103.255.
One of advantge of CIDR, it provides the possibility of fine-grained routing prefix aggregation. For example, sixteen contiguous /24 networks can be aggregated and advertised to a larger network as a single /20 routing table entry, if the first 20 bits of their network addresses match. Two aligned contiguous /20 blocks may be aggregated to a /19, and so forth. This results in reduction of the number of routes that have to be advertised.
IPv4 Address configuration
There are two ways to have IPv4 address configurated for an interface: static or dhcp.
static IPv4 address configuration
Under Cisco router, the address can be assigned using CLI, see example below, it is to configure GigabitEthernet1 interface to IPv4 address 192.168.100.1/24:
Under linux, let’s sya there is an ethernet interface “eth0”, you can Assign static IP Address to eth0 interface editing configuration file /etc/network/interfaces to make permanent changes as shown below.
To confiugre the interface “eth0” right away , there are two commands: old one “ifconfig “, and new one “ip addr add …”.
DHCP: dynamic address configuration
Cisco IOS can server a DHCO server to provide IP address to local interface or to hosts in the network. Below is a quick example of a dhcp pool, which provides the IPv4 address to interface gigabitEthernet 1.
As shown above, interface gigabitethernet 1 acquires the IP address “192.168.100.1/24” from the dhcp pool “local-pool1”.
Subscribe via RSS