Internet Addressing Mr Nenad Krajnović E-mail: krajko@etf.bg.ac.rs? 1
What is an IP Address? 32-bit number, defined by the Internet Protocol (IP) (RFC 791). IP addresses must be unique within the network. One IP address may point to: one and only one destination on the Internet (unicast), or: one and only one group of destinations (multicast). IP addresses are 32-bit integers, oftenly written in 4-octet form: 147.91.8.6 IP address distribution is coordinated in hierarchical manner. End users receive their address space from their ISP! 2
How many IP addresses exists? Since 32-bits are used for IP addresses, maximum number of IP addresses is: 4.294.967.296 Complete address range can not be used for host addressing!
IP Address Structure IP address consists of two parts: 147.91.8.6 10010011 01011011 00001000 00000110 Network prefix (m bits) Host id (32-m bits) 4
Network Address Addresses all hosts on a network segment: 147.91.8.0 /24 10010011 01011011 00001000 00000000 Network prefix (m bits) Host id (32-m zeros) /24 - denotes prefix length (m = 24) 5
Subnet mask Subnet mask - a way of keeping information about prefix length. 255.255.255.0 11111111 11111111 11111111 00000000 Network prefix (m ones) Host id (32-m zeros) 6
Broadcast Address Used by IP to broadcast data to all hosts on a given subnet. 147.91.8.255 /24 10010011 01011011 00001000 11111111 Network prefix (m bits - network prefix) Host id (32-m ones) /24 - denotes the prefix length (m = 24) 7
IP Address Structure - a Review (Repetitio mater studiorum est) IP adress: 10010011 01011011 00001000 00000110 147.91.8.6 Network address: 10010011 01011011 00001000 00000000 147.91.8.0 /24 Subnet mask: 11111111 11111111 11111111 00000000 255.255.255.0 Broadcast address: 10010011 01011011 00001000 11111111 147.91.8.255 /24 8
Another Example... Prefix length does not have to be on octet boundaries: 147.91.9.65 /26 10010011 01011011 00001001 01000001 Network prefix (m=26 bits) Host id (6 bits) /26 - denotes the prefix length (m = 26) 9
Another Example - Review IP adress: 10010011 01011011 00001001 01000001 147.91.9.65 /26 Network address: 10010011 01011011 00001001 01000000 147.91.9.64 /26 Subnet mask: 11111111 11111111 11111111 11000000 255.255.255.192 Broadcast address: 10010011 01011011 00001001 01111111 147.91.9.127 /26 10
Addressing in the LAN 147.91.9.67 147.91.9.66 147.91.9.68 147.91.9.65 147.91.9.64/26 147.91.9.69 147.91.9.100 147.91.9.101 147.91.9.72 147.91.9.126 147.91.9.70 147.91.9.71
Addressing in the LAN (VLAN) VLAN 1 10.10.5.0/24 VLAN 2 10.10.5.1 147.91.8.5 147.91.9.1 147.91.16.1 147.91.8.0/24 VLAN 8 147.91.9.0/24 VLAN 215 147.91.16.0/23
Addressing in the WAN 21.15.4.14 21.15.4.12/30 21.15.4.0/30 21.15.4.2 18.240.6.1 21.15.4.13 21.15.4.9 21.15.4.1 21.15.4.5 18.240.6.0/30 21.15.4.10 21.15.4.8/30 21.15.4.4/30 21.15.4.6 18.240.6.2
Why we are using network addresses? Routing table eth0 147.91.9.65 -> eth0 147.91.9.66 -> eth0 147.91.9.67 -> eth0 147.91.9.68 -> eth0 147.91.9.69 -> eth0 147.91.9.70 -> eth0 147.91.9.71 -> eth0 147.91.9.72 -> eth0 147.91.9.73 -> eth0 147.91.9.74 -> eth0 Routing table 147.91.9.64/26 -> eth0 eth0 147.91.9.67 147.91.9.66 147.91.9.67 147.91.9.66 147.91.9.68 147.91.9.64/26 147.91.9.65 147.91.9.68 147.91.9.64/26 147.91.9.65 147.91.9.69 147.91.9.100 147.91.9.101 147.91.9.72 147.91.9.69 147.91.9.100 147.91.9.101 147.91.9.72 147.91.9.126 147.91.9.126 147.91.9.70 147.91.9.71 147.91.9.70 147.91.9.71
IP Address Classification Total available address space: 0.0.0.0-255.255.255.255. We can classify addresses according to the following criteria: Classes: A, B, C, D, E class networks. Classes are now obsoleted! Usage: Public IP addresses (globally routeable, unique and non-reusable). Private IP addresses (routeable in private networks only). Special IP addresses (reserved, broadcast, multicast etc. networks). Validity: Provider aggregatable (valid until the ISP-User agreement is valid). Provider independent (valid until initial criteria for their assignment are met). 15
Network Prefix Length - m Prefix length may be determined: Automatically, depending on the address class - A, B, C, D, E (classful). Arbitary, depending on the ISP and customer network topology (CIDR). It defines the maximum number of addresses available to the user: 16 bits 24 bits 26 bits 65536 /16 65536 addresses 256 /24 256 addresses 64 /26 64 addresses Assigned network prefix length may be expanded (subnetting) 16
Classful Addressing Today mostly obsoleted, used only by some routing protocols. Classful addressing was created in the past to ease allocations. IP adress space is divided to 5 IP adress classes - A, B, C, D i E: A B C D 0 remaining 31 bits 0.0.0.0-127.255.255.255 10 remaining 30 bits 128.0.0.0-191.255.255.255 110 remaining 29 bits 192.0.0.0-223.255.255.255 1110 remaining 28 bits 224.0.0.0-239.255.255.255 E 1111 remaining 28 bits 240.0.0.0-255.255.255.255 17
Prefix Length and Classes Class IP range Start IP address m Subnet mask A 0/1 0.0.0.0 8 255.0.0.0 B 128/2 128.0.0.0 16 255.255.0.0 C 192/3 192.0.0.0 24 255.255.255.0 D 224/4 224.0.0.0 - - E 240/4 240.0.0.0 - - Older routing protocols determined prefix length (m) by the class. Newer routing protocols explicitly transmit prefix length. 18
Classful Subnetting A customer is assigned an IP network on class boundaries: 147.91.0.0 /16 (65534 hosts) The customer might expand the network prefix length, e.g.: 16 3 13 /19 6 subnets, 8190 hosts/subnet 16 4 12 /20 14 subnets, 4094 hosts/subnet 16 8 8 /24 254 subnets, 254 hosts/subnet Subnet number of all 0 s and all 1 s is not allowed by default. To allow all 0 s and all 1 s to be subnet numbers, routers must be configured for that. 19
Why Classful Addressing? Routing protocols did not transport information about netmask to conserve necessary bandwidth on the links. With implicit definition of netmask, it was easier to implement routing protocols. Estimated number of hosts on the network was much less then available address space.
Drawbacks of Classful Addressing The customer must always be assigned a classful network. Classful addressing is a waste of address space: Formerly, users with more than 254 hosts had been assigned a B class. At the end of 1992, 70% of B class space was assigned. A route to each classful subnet must be specified separately: If an ISP had 254 customers, with addresses: 193.1.1.0, 193.1.2.0, 193.1.3.0 193.1.254.0 254 separate route entries should be entered in the global routing table! These drawbacks led to a better solution - CIDR! 21
Classless Addressing (CIDR) Basis for classless inter-domain routing (CIDR). A customer is assigned an IP network on arbitary boundaries, e.g.: 19 13 195.91.160.0 /19 (8192 hosts) The customer might expand the network prefix length, e.g.: 19 5 8 /24 32 subnets, 254 hosts/subnet Subnet number of all 0 s and all 1 s is allowed by default. At the time of introduction of classless routing, it was necessary to additionally configure routers to support it. 22
Advantages of Classless Addressing The customer does not need to be assigned a classful network. Classful addressing saves address space: Formerly, users with more than 254 hosts had been assigned a B class. Now, they are assigned multiple C class networks (/23, /22, /21 etc.). Routes could be aggregated easily: If an ISP had 254 customers, with addresses: 193.1.1.0, 193.1.2.0, 193.1.3.0 193.1.254.0 they will need a single entry in the routing table - 193.1.0.0 /16!!! Classless addressing (CIDR) introduced a better model of global address distribution process, defined by the RFC 2050. 23
FLSM vs VLSM Subnetting Fixed length subnet mask subnetting (FLSM): Typical in classful environments. Needed by older routing protocols, like RIPv1. All network segments should have the same network masks (prefixes). Not practical, when the network has a lot of segments, divided by routers. It may result in non-economical solutions (say, a /24 for a point-to-point link!). Variable length subnet mask subnetting (VLSM): Supported by major routing protocols today. Allows network segments, separated by routers, to have variable prefixes. Very practical, even in the point-to-point case (/30 assigned usually). Smaller percentage of address space loss (for reserved addresses). 24
Example Network Topology Access server PPP (unnumbered) Dial-in x 10 9 Ethernet 1 Repeater Total of 200 hosts Ethernet Embedded router 100 hosts 2 3 50 PCs Ethernet 35 PCs 6 4 50 PCs 5 40 PCs Router Router 30 PCs 20 PCs 8 7 25
Fixed-length Subnet Masks 10.0.0.3 10.0.0.12 Repeater Ethernet Access server 10.0.0.0/24 Dial-in x 10 10.0.9.0 /24 PPP (unnumbered) 50 PCs - 10.0.2.0/24 10.0.0.77 Embedded router 10.0.0.50 10.0.0.0/24 Ethernet 10.0.1.77 10.0.1.21 Ethernet 10.0.1.78 10.0.1.79 10.0.1.0/24 35 PCs - 10.0.5.0/24 50 PCs - 10.0.3.0/24 30 PCs - 10.0.6.0/24 40 PCs - 10.0.4.0/24 Router Router 20 PCs - 10.0.7.0/24 26
Addressing Plan - FLSM i hosts Max addr Start address Prefix Subnet mask Broadcast 1 200 254 10.0.0.0 /24 255.255.255.0 10.0.0.255 2 100 254 10.0.1.0 /24 255.255.255.0 10.0.1.255 3 50 254 10.0.2.0 /24 255.255.255.0 10.0.2.255 4 50 254 10.0.3.0 /24 255.255.255.0 10.0.3.255 5 40 254 10.0.4.0 /24 255.255.255.0 10.0.4.255 6 35 254 10.0.5.0 /24 255.255.255.0 10.0.5.255 7 30 254 10.0.6.0 /24 255.255.255.0 10.0.6.255 8 20 254 10.0.7.0 /24 255.255.255.0 10.0.7.255 9 10 254 10.0.8.0 /24 255.255.255.0 10.0.8.255 Network address and broadcast address can NOT be used for host addressing! 27
Variable-length Subnet Masks (VLSM) 10.0.0.3 10.0.0.12 Repeater Ethernet Access server 10.0.0.0/24 Dial-in x 10 10.0.2.192/28 PPP (unnumbered) 50 PCs - 10.0.1.128/26 10.0.0.77 Embedded router 10.0.0.50 10.0.0.0/24 Ethernet 10.0.1.77 10.0.1.21 Ethernet 10.0.1.78 10.0.1.79 10.0.1.0/25 35 PCs - 10.0.2.64/26 50 PCs - 10.0.1.192/26 30 PCs - 10.0.2.128/27 40 PCs - 10.0.2.0/26 Router Router 20 PCs - 10.0.2.160/27 28
Addressing Plan - VLSM i hosts Max addr Start address Prefix Subnet mask Broadcast 1 200 254 10.0.0.0 /24 255.255.255.0 10.0.0.255 2 100 126 10.0.1.0 /25 255.255.255.128 10.0.1.127 3 50 62 10.0.1.128 /26 255.255.255.192 10.0.1.191 4 50 62 10.0.1.192 /26 255.255.255.192 10.0.1.255 5 40 62 10.0.2.0 /26 255.255.255.192 10.0.2.63 6 35 62 10.0.2.64 /26 255.255.255.192 10.0.2.127 7 30 30 10.0.2.128 /27 255.255.255.224 10.0.2.159 8 20 30 10.0.2.160 /27 255.255.255.224 10.0.2.191 9 10 14 10.0.2.192 /28 255.255.255.240 10.0.2.207 Network address and broadcast address can NOT be used for host addressing! 29
IP Address Distribution IANA Allocations RIPE NCC ARIN APNIC LACNIC AfriNIC ISP ISP ISP ISP ISP ISP ISP Assignments ISP 30
Internet Registries
Address Distribution - Example 193/8 IANA 193.1.32.0 /19 ISP RIPE NCC 193.2.0.0 /16 193.1.128.0 /18 ISP ISP 193.2.20.32 /27 193.2.20.0 /24 193.2.8.0 /21 32
Information about address distribution? Every Internet Registry is maintaining public database about address assignment www.ripe.net - RIPE www.arin.net - ARIN www.lacnic.net - LACNIC www.apnic.net - APNIC www.afrinic.net - AfriNIC
Address Categories Public IP numbers: Globally unique - one IP address points to one and only one destination. Non-reusable - once used, the same IP address must not be used elsewhere! Routable - theoretically visible from anywhere in the Internet. Need global coordinated allocation/assignment process (IANA, RIRs, ISPs ). Agreggatable - routes to 62.2.16/21 and i 62.2.24/21 give 62.2.16/20! Limited resource, like a radio-frequency spectrum! They need careful planning! Private IP numbers: Defined by the RFC 1918 (networks 10/8, 172.16/12 and 192.168/16). Basic application - intranets, networks behind firewalls or NATs or networks which won t connect to the Internet at all! They must not be routed on the public networks! Need coordination withing the private network where they are used. 36
Special IP Addresses Used internally by various networking protocols. They must not be used for host/network addressing. IP network m Abbreviated IP network usage 0.0.0.0 /0 0/0 Default gateway 127.0.0.0 /8 127/8 Loopback network 224.0.0.0 /4 224/2 Multicast addresses (class D) 240.0.0.0 /4 240/4 Class E (reserved by IANA) Special addresses are also: network address, subnet mask, broadcast address. 37
Address Validity (RFC 2050) Provider aggregatable (PA) address space: Assigned by the ISPs, for the need of their end users. Valid until the agreement between the ISP and the customer is valid. Upon provider change, the user must renumber their network! Provider guarantees global uniqueness and visibility of the assigned addresses. Most of assignments, being done today, are provider aggregatable. Provider independent (PI) address space: Address space, formerly assigned directly by InterNIC, RIPE NCC, APNIC. InterNIC, RIPE NCC, APNIC do not assign addresses to end users any more! The ISP reserves the right to refuse to route them, or to extra charge the cost for their routing. Necessary for multihomed networks! 38
Conclusion Addressing - Before and Now Before - classful addressing: End users received addresses from InterNIC, RIPE NCC, APNIC. A whole classful network address had to be assigned (say, C class). Fixed-length subnet masks in the user network. Avoidance of using zero subnets. Network prefix length derived directly from the address class. When changing the ISP, the user did not need to renumber the network! Now - CIDR: End users receive addresses from their ISPs. An arbitary network prefix can be assigned (say, /26 = ¼ C class). Variable-length subnet masks in the user network. Normal usage of zero subnets. Network prefix length information transmitted along with the netnum. When changing the ISP, the user has to renumber the network! 39