1 26-Aug-15 Addressing the network using IPv4 Lecture # 2 Engr. Orland G. Basas Prepared by: Engr. Orland G. Basas IT Lecturer
226-Aug-15 IP addressing – works at OSI model layer 3 TCP/IP model Internet layer Application Presentation Session Transport Network Data link Physical Application Transport Internet Network Access TCP, UDP IP Ethernet, WAN technologies HTTP, FTP, TFTP, SMTP etc Segment Packet Frame Bits Data stream
326-Aug-15 The 32-bit binary addresses used on the Internet are referred to as Internet Protocol (IP) addresses Commonly written in dotted-decimal format – When IP addresses are assigned to computers, some of the bits on the left side of the 32-bit IP number represent a network. The bits left over in the 32-bit IP address identify a particular computer on the network A computer is referred to as the host The IP address of a computer consists of a network & a host part that represents a particular computer on a particular network IP addressing
426-Aug-15 In the early days of the Internet, IP addresses were allocated to organizations based on request rather than actual need. When an organization received an IP network address, that address was associated with a “Class”, A, B, or C. This is known as Classful IP Addressing The first octet of the address determined what class the network belonged to and which bits were the network bits and which bits were the host bits. It was not until 1992 when the IETF introduced CIDR (Classless Interdomain Routing), making the address class meaning less. This is known as Classless IP Addressing. For now, all you need to know is that today’s networks are classless, except for those networks that still use Classful routing protocols. Classful IP Addressing
526-Aug-15 IPv4 Address Classes
626-Aug-15 Class A Class B Class C NetworkHost Network Host Network Host 1st octet2nd octet3rd octet4th octet N = Network number assigned by Internet registry H = Host number assigned by administrator Address Classes
726-Aug-15 Class A addresses NetworkHost First octet is between 0 – 127, begins with 0 Number between bits With 24 bits available for hosts, there a 2 24 possible addresses. That’s 16,777,216 nodes! There are 126 class A addresses. 0 and 127 have special meaning and are not used. 16,777,214 host addresses, one for network address and one for broadcast address. Only large organizations such as the military, government agencies, universities, and large corporations have class A addresses. For example ISPs have and
826-Aug-15 Class B addresses Network Host First octet is between 128 – 191, begins with 10 Number between bits With 16 bits available for hosts, there a 2 16 possible addresses. That’s 65,536 nodes! There are 16,384 (2 14 ) class B networks. 65,534 host addresses, one for network address and one for broadcast address. Class B addresses are assigned to large organizations including corporations (such as government agencies, and school districts).
926-Aug-15 Class C addresses Network Host First octet is between 192 – 223, begins with 110 Number between bits With 8 bits available for hosts, there a 2 8 possible addresses. That’s 256 nodes! There are 2,097,152 possible class C networks. 254 host addresses, one for network address and one for broadcast address. Usually assigned for small networks
1026-Aug-15 Class D Addresses A Class D address begins with binary 1110 in the first octet. First octet range 224 to 239. Class D address can be used to represent a group of hosts called a host group, or multicast group. Class E Addresses First octet of an IP address begins with 1111 Class E addresses are reserved for experimental purposes and should not be used for addressing hosts or multicast groups. IPv4 Address Classes
1126-Aug-15 Types of Addresses
1226-Aug-15 Subnet Mask To inform a computer how the 32-bit IP address has been split, a second 32-bit number called a subnetwork mask is used This mask is a guide that indicates how the IP address should be interpreted by identifying how many of the bits are used to identify the network of the computer The subnetwork mask sequentially fills in the 1s of the network portion.
1326-Aug-15 Class A IP Address Default Subnet Mask: (/8) Default Subnet Mask Class B IP Address Default Subnet Mask: (/16) Class C IP Address Default Subnet Mask: (/24)
1426-Aug-15 Network Prefix How do we know how many bits represent the network portion and how many bits represent the host portion? We use network prefix. The prefix length is the number of bits in the address that gives us the network portion Ex: /24, the /24 tells us that the first 24 bits are the network address. This leaves the remaining 8 bits, the last octet, as the host portion.
1526-Aug-15 IPv4 address octet network parthost part Prefix /24 Subnet mask:
1626-Aug-15 Find the network address In a network address, all the host bits are The router needs to do this for every packet.
1726-Aug-15 Logical AND Do a logical AND at each position
1826-Aug-15 Find the broadcast address In a broadcast address, all the host bits are The broadcast is the last address in the network.
1926-Aug-15 Reminder: 3 types of address Every network has: Network address – the first one Broadcast address – the last one Host addresses – everything in between
2026-Aug-15 Recall: Classful addressing network parthost part A network parthost part B network parthost part C
2126-Aug-15 Classful addressing Easy to work out but very wasteful. Routers and hosts still assume default subnet masks by class Class A/ Class B/ Class C/
2226-Aug-15 Classless addressing Any suitable prefix can be used We (and devices) need to know what the prefix is. More flexible, less wasteful.
2326-Aug-15 Classless addressing / /16 mask Broadcast address Hosts to host addresses
2426-Aug-15 Classless addressing / /24 mask Broadcast address Hosts to host addresses
2526-Aug-15 Classless addressing / /22 mask Broadcast address Hosts to host addresses
2626-Aug-15 Classless addressing / /22 mask Broadcast address Hosts to host addresses
2726-Aug-15 Classless addressing / /28 mask Broadcast address Hosts to host addresses
2826-Aug-15 Calculating addresses A host has IP address /24 What is the subnet mask? What is the network address? What is the broadcast address? What is the range of host addresses in the network?
2926-Aug /24 – fill in the table Last octet binary Last octet decimal Full Host Subnet mask Network Broadcast First host Last host
3026-Aug /24 Last octet binary Last octet decimal Full Host Subnet mask Network Broadcast First host Last host
3126-Aug-15 Calculating addresses A host has IP address /26 What is the subnet mask? What is the network address? What is the broadcast address? What is the range of host addresses in the network?
3226-Aug /26 fill in the table Last octet binary Last octet decimal Full Host Subnet mask Network Broadcast First host Last host
3326-Aug /26 Last octet binary Last octet decimal Full Host Subnet mask Network Broadcast First host Last host
3426-Aug-15 Calculating addresses A host has IP address /28 What is the subnet mask? What is the network address? What is the broadcast address? What is the range of host addresses in the network?
3526-Aug /28 fill in the table Last octet binary Last octet decimal Full Host Subnet mask Network Broadcast First host Last host
3626-Aug /28 Last octet binary Last octet decimal Full Host Subnet mask Network Broadcast First host Last host
3726-Aug-15 Unicast, Multicast, Broadcast Unicast – a message addressed to one host Broadcast – a message addressed to all hosts on a network. Uses network’s broadcast address or locally Multicast – a message addressed to a group of hosts. Uses an address starting
3826-Aug-15 Private IP addresses Unrestricted use on private networks. Not routed across the Internet – ( /8) – ( /20) – ( /24)
3926-Aug-15 Public IP addresses Routed over the Internet Master holder is IANA (Internet Assigned Numbers Authority) Assigned to regional registries and then to ISPs ISPs allocate them to organisations and individual users Use is strictly controlled as duplicate addresses are not allowed
4026-Aug-15 Special addresses “all addresses” in default route. Hosts cannot be given addresses starting is loopback. Hosts cannot be given addresses starting and higher – reserved for experimental purposes local only to for teaching
4126-Aug-15 Network address translation A large number of hosts on a network use private addresses to communicate with each other. The ISP allocates one or a few public addresses. NAT allows the hosts to share the public addresses when they want to use the Internet
4226-Aug-15 Addressing hosts Static addressing – address is configured by an administrator Servers, printers, routers, switches need static addresses Dynamic addressing – address is allocated automatically by DHCP by leasing addresses from a pool Dynamic addressing is best for workstations
4326-Aug-15 Subnetting /24 Address Subnet mask Last octet binary Borrow 1 bit from host part, give it to network part, /25 Addresses Subnet mask
4426-Aug-15 Subnetting /24 Borrow 2 bits from host part, give to network part, /26 Addresses Subnet mask
4526-Aug-15 Subnetting /24 Borrow 3 bits from host part, give to network part, /27 Addresses Subnet mask
4626-Aug-15 Subnetting /24 Borrow 4 bits from host part, give to network part, / Subnet mask And so on…
4726-Aug-15 Subnetting /24 Every time you borrow another bit you: Double the number of subnets Halve the size of the subnets Each subnet has a network address, a broadcast address, and everything in between is a host address. Here are some ways of visualising the process.
4826-Aug-15 Subnetting /24 Bits borrowed No of networks Prefix/25/26/27/28/29/30 Bit value/ network size No of hosts Subnet mask
4926-Aug-15 Ping and traceroute Ping sends an ICMP message. If all is well, the destination replies. If not, a router may reply to say the destination is unreachable, or the ping may time out. Traceroute sends a series of messages so that each router along the path replies. You get a list of addresses of all the routers.
5026-Aug-15 IPv6 Development started in 1990s because of concerns about IPv4 addresses running out A whole new protocol suite – not just layer 3 Uses 128-bit hierarchical addressing, written using hexadecimal Simpler header Integrated security – authentication, privacy Quality of service mechanisms
5126-Aug-15 Why Subnet? To break the network down into pieces, each of which can be addressed separately. Controls network traffic Reduces broadcasts Can provide low level security with access lists on the router Organization of IP address space
5226-Aug-15 Subnetting a Default Class C Network Address: Default Class C address is divided into network and host portions as follows: N. N. N. H To subnet we “borrow” bits from the host portion of the address (8 bits for Class C) N. N. N. x x x x x x x x Borrowing n bits yields 2 n – 2 subnets. Leaving n bits yields 2 n – 2 hosts. For a class C, we can borrow from 2 to 6 bits. Why not 1 bit? (How many usable subnets?) Why not 7 bits? (How many usable hosts?)
5326-Aug-15 Subnetting a Default Class C Network Address: Suppose we need 14 usable subnets, how many bits do we borrow? Remember, borrowing n bits give us: 2 n – 2 subnets Try borrowing 3 bits (n = 3): 2 3 – 2= 8 – 2 = 6 usable subnets (not enough) Try borrowing 4 bits 2 4 – 2= 16 – 2 = 14 usable subnets (enough)
5426-Aug-15 Subnetting a Default Class C Network Address: Write it with the network octet in binary: Borrowing 4 bits yields 14 usable subnets How many usable hosts per subnet? Same formula as subnets (2 n – 2) 4 host bits (n = 4) 2 4 – 2 = 16 – 2 = 14 usable hosts per subnet subnet bits host bits Break here
5526-Aug-15 Subnetting a Default Class C Network Address: Examples: First usable ^ 0000 subnet address: First usable host ^ 0001 on the first subnet: Second usable host ^ 0010 on the first subnet: Last usable host ^ 1110 on the first subnet: Broadcast address ^ 1111 for the first subnet:
5626-Aug-15 Subnetting a Default Class C Network Address: Examples: Second usable ^ 0000 subnet address: Third usable ^ 0000 subnet address: Fourth usable ^ 0000 subnet address: Last usable ^ 0000 subnet address:
5726-Aug-15 The Subnet Mask: How the Router Determines the Subnet The subnet mask (in binary) has: all ones in the network and subnet portion of the address all zeros in the host potion of the address The subnet mask for the previous example is: ^ 0000 ( =240) ANDing this mask with any valid host address on the network will always yield the subnet address for that host.
5826-Aug-15 The Subnet Mask: How the Router Determines the Subnet Example (our subnet mask is ) IP host address: Last octet to binary: AND subnet mask: Subnet Address: So the host address is on the subnet.
5926-Aug-15 Subnetting a Default Class B Network Address: Default Class B address is divided into network and host portions as follows: N. N. H. H To subnet we “borrow” bits from the host portion of the address (16 bits for Class B) N. N. x x x x x x x x. x x x x x x x x For a class B, we can borrow from 2 to 14 bits.
6026-Aug-15 Subnetting a Default Class B Network Address: Suppose we need 80 usable subnets, how many bits do we borrow? Remember, borrowing n bits give us: 2 n – 2 subnets Try borrowing 6 bits (n = 6): 2 6 – 2= 64 – 2 = 62 usable subnets (not enough) Try borrowing 7 bits 2 7 – 2= 128 – 2 = 126 usable subnets (enough)
6126-Aug-15 Subnetting a Default Class B Network Address: Write it with the network octets in binary: Borrowing 7 bits yields 126 usable subnets How many usable hosts per subnet? Same formula as subnets (2 n – 2) 9 host bits (n = 9) 2 9 – 2 = 512 – 2 = 510 usable hosts per subnet subnet bits host bits
6226-Aug-15 Subnetting a Default Class B Network Address: Examples: First usable ^ subnet address: First usable host ^ on the first subnet: Second usable host ^ on the first subnet: Last usable host ^ on the first subnet: Broadcast address ^ for the first subnet:
6326-Aug-15 Subnetting a Default Class B Network Address: Examples: Second usable ^ subnet address: Third usable ^ subnet address: Ninety-first usable ^ subnet address: Last usable ^ subnet address:
6426-Aug-15 Subnetting a Default Class B Network Address: The subnet mask for this example is: ^ ANDing this mask with any valid host address on this network will always yield the subnet address.
6526-Aug-15 Subnetting a Default Class B Network Address: Example: IP host address: Last octets to binary: ^ AND subnet mask: ^ ^ Subnet Address: Which subnet is this. How can you tell?
6626-Aug-15 Additional Info on subnetting
67 26-Aug-15 The End