IP Addressing 1 • IP addresses uniquely identify a host or router on the Internet • It is a 32-bit address (4 octets) • Has two main fields: NetId and HostId • The MSBs of the NetId identify the IP class • There are five IP classes: A, B, C, D, E IP Addressing 2 • Decimal dotted notation Ex. 124.10.21.3 • Classes: – – – – – A: MSB =0, from 1 to 126 first octet B: MSBs =10, from 128 to 191 first octet C: MSBs = 110 from 192 to 223 first octet D: MSBs =1110 from 224 to 239 first octet E: MSBs = 1111 from 240 to 255 first octet IP Addressing 3 • Classes A, B, C are used for unicasting • Class D is used for multicasting. There is no NetId nor HostId, all bits are used for the different multicasting addresses. • Class E is reserved by the Internet for special use IP Addressing • • • • • • • 4 Number of Networks and Hosts per class Class Networks Hosts A 27 - 2 = 126 224 -2 = 16777214 B 214 = 16384 216 -2 = 65534 C 221 = 2097152 28 - 2 = 254 D N.A. N.A. E N.A. N.A IP Addressing 5 • Multihomed devices: – Can be computers that are connected to different networks, with different IP numbers for each – Routers, each of its interfaces must have an assigned IP number IP Addressing 6 • Special addresses (Can not be assigned to hosts) – – – – – – Network Address Has Host ID all zeros Direct Broadcast Has host ID all 1s Limited Broadcast Has Net and Host ID all 1s This host on this net All zeros Specific host/this net NetId= 0s, HostID specific Loopback address NetId = 127, HostID any IP Addressing 7 • Limited Broadcasts will be blocked by a router and confined to the local network • This host on this network is an IP address used by a host at bootup, when it does not know its IP address and sends it as source address to the server (all zeros) • Specific host on this network is an IP address used by a host to communicate with another IP Addressing 8 • Specific host on this network ( NetID = 0, HostID = specific ) – Allows a host to communicate with another host on the same network – Used only in the destination field of an IP packet • Loopback address (127 in first octet) – The packet with this destination address will not leave the machine. Used to test the machine IP Addressing 9 • Multicast addresses – Are class D – Can be used only as destination address – Can be local or global level • Local means a group of users in one network • Global means a group of users belonging to different networks) • A system (host) can have several multicast addresses in addition to its own unicast address IP Addressing 10 • Assigned Multicast Addresses (by internet) • Address Group – – – – – – 224.0.0.0 224.0.0.1 224.0.0.2 224.0.0.4 224.0.0.5 224.0.0.6 Reserved All SYSTEMS on this SUBNET All ROUTERS on this SUBNET DVMRP routers OSPFIGP All ROUTERS OSPFIGP Designated ROUTERS IP Addressing 11 • Assigned Multicast Addresses (by internet) • Address Group – – – – – 224.0.0.7 224.0.0.8 224.0.0.9 224.0.0.10 224.0.0.11 ST Routers ST Hosts RIP2 Routers IGRP Routers Mobile-Agents IP Addressing 12 • Assigned Multicast Addresses (by internet) • Address Group – 224.0.1.X For Conferencing/Teleconferencing • Private Networks • For organizations that want to use TCP/IP but do not need internet access. • Although they could pick any set of IP addresses, this could cause some confusion IP Addressing 13 • A block of IP addresses on the three classes have been reserved for this purpose • CLASS NETIDs TOTAL Nets –A –B –C 10.0.0. 172.16 to 172.31 192.168.0 to 192.168.255 1 16 256 IP Addressing - Subnetting 14 • Subnetting is the process of dividing a network into several smaller subnetworks • To the Internet, the organization that subnetted its network still has one network address. • The router at the organization will direct the traffic to the different subnets, based on the subnet masks placed at each subnet. IP Addressing - Subnetting 15 • Each of the three primary IP address classes has an associated default subnet mask • The subnet mask is a 32-bit number (also four decimal dotted notation) in which the bits that correspond to the IP network address are made equal to one (1) and the bits that correspond to the hosts (in the IP address) are made equal to zero. IP Addressing - Subnetting 16 • The default subnet masks for classes A, B, C are: – Class A: 255.0.0.0 – Class B: 255.255.0.0 – Class C: 255.255.255.0 • A network using the default subnet mask is not subnetted. IP Addressing - Subnetting 17 • Depending on the available routers and routing protocols, you can implement one of two types of subnetting: – Constant Length subnet masks (CLSM) – Variable Length subnet mask (VLSM) • When you subnet, you are borrowing bits from the HostId field and assign them to the NetId field; that way you have more bits to encode subnets Ids but less bits for hosts IP Addressing - Subnetting 18 • Example of CLSM: IP address= 130.25.0.0 – This is a class B IP network address and has an associated default subnet mask of 255.255.0.0 – This two pieces of information could have been obtained using another IP addressing notation called slashed IP. In this example the IP network address would be 130.25.0.0 /16 (slash 16) which means that 16 bits are used for the associated NetId field of the subnet mask. IP Addressing - Subnetting 19 • Example of CLSM: IP address= 130.25.0.0 – If we want to subnet it, and we use for example a two bit subnet field, then two bits will be borrowed from the HostId field, of the default subnet mask, and will be used to identify up to four possible subnets: using the bit combinations: 00, 01, 10, 11. – The subnet mask will become: 255.255.192.0 IP Addressing - Subnetting 20 • Example of CLSM: IP address= 130.25.0.0 – Working it out in binary for : 255.255.192.0 – 1111 1111.1111 1111.1100 0000.0000 0000 – The group of bits=1 not bolded, correspond to what is called the network prefix. – The two bits=1 that are bolded are the subnet Id. – The collection of all the bits=1 is the extended network prefix. IP Addressing - Subnetting 21 • Using two bits for subnetId (b=2) allows us to subnet into 2b =22 = 4 subnets. But since the all zeros and all ones combinations are not allowed, the usable subnets are 2b – 2 = 2 • From a routing perspective, subnetting can be used to create network regions where machines would be on the same physical network(segment) and thus communicate using their MAC addresses IP Addressing - Subnetting 22 • When a computer in one subnet wishes to communicate with a computer on another subnet, traffic must be forwarded from the sender to a nearby IP gateway (router). • The Gateway will send its message on its way to the destination, which could be local to the router (another port) or to another router that is closer to the destination host. IP Addressing - Subnetting 23 • Exercise of CLSM subnetting: – Net Inc. wants 12 subnets for its class C IP network address 200.10.10.0. No subnet will require more than 10 hosts addresses – Solution: • 1. Add two to the number of subnets needed. In this case 12 + 2 = 14. • Find the power of two closest to that number but larger to it. In this case 16 IP Addressing - Subnetting 24 • Solution: • 3. Which exponent must be used in base two to obtain the number of subnets calculated before? 2 n = 16 ? Answer, n = 4 • 4. Thus you will borrow 4 bits from the associated HostId bits of default subnet mask and use them for the associated NetId bits of the subnet mask to be used • In binary : 1111 1111.1111 1111.1111 1111.1111 0000 • In dotted decimal: 255.255.255.240 IP Addressing - Subnetting 25 • Variable Length Subnet Mask (VLSM) – If all segments(subnets) must support roughly the same number of hosts (+/- 20%), CLSM makes the most sense; but if some subnets require a large number of hosts and others do not, CLSM will waste IP address space. In these cases VLSM is used. – Basically with VLSM, the larger subnets are subnetted again, using a second subnet mask. IP Addressing - Subnetting 26 • Variable Length Subnet Mask (VLSM) – To implement VLSM, you must have: – 1. Routing protocols that carry the extended network prefix information with each route advertised. For example: RIP-2, and OSPF. – 2. The routers must implement a “longest match” algorithm, whereby, the router will select the route with the longest extended network prefix (the most specific network), when several routes available IP Addressing - Subnetting 27 • Variable Length Subnet Mask (VLSM) – 3. The address assigned must mirror the physical topology of the network. This reduces the amount of routing information by taking the set of addresses assigned to a particular region of the topology and aggregating them into a single routing advertisement for the entire set. – This issue is important for routing purposes and is called CIDR (Classless Interdomain Routing)