Network Layer IP Address
Addressing the Network: IPv4 IPv4 Addresses
Anatomy of an IPv4 Address Each device on a network must be uniquely identified at the Network layer. For IPv4, a 32 bit source and destination address is contained in each packet.
IPv4 Addressing Structure
Anatomy of an IPv4 Address Dotted Decimal Network Host Octet 32 bit Address
Binary to decimal and Vice Versa
Binary to Decimal
Decimal to Binary
Anatomy of an IPv4 Address 1.2 2.2 1.1 2.1 1.3 3.1 3.2 To identify a path or "route" through a network, the address must be composed of two parts: Network portion Host portion
Anatomy of an IPv4 Address IP Address 192. 168. 1. 2 Binary IP Address 11000000 10101000 00000001 00000010 Network Portion: Some portion of the high-order bits A network can be defined as a group of hosts that have identical bit patterns in the network address portion of their addresses. 192.168.1.2 11000000 10101000 00000001 00000010 192.168.1.67 01000011 192.168.1.204 11001100
Anatomy of an IPv4 Address IP Address 192. 168. 1. 2 Binary IP Address 11000000 10101000 00000001 00000010 Host Portion: A variable number of least significant bits that are called the host portion of the address. The number of bits used in this host portion determines the number of hosts that we can have within the network. 192.168.1.2 11000000 10101000 00000001 00000010 192.168.1.67 01000011 192.168.1.204 11001100
Anatomy of an IPv4 Address How do we or devices identify the network part or the host part? Answer: For us :Using the “Prefix Mask”. 192.168.10.2/24 Means that the first 24 bits are the network portion. The last 8 bits are the host portion.
Anatomy of an IPv4 Address Answer: For devices Using the “subnet mask”. 255.255.255.0
Prefix or Subnet Mask The Prefix Mask and the Subnet Mask are different ways of representing the same information. Prefix Mask of /24 or a subnet mask of 255.255.255.0 Prefix Mask of /16 or a subnet mask of 255.255.0.0 Prefix Mask of /8 or a subnet mask of 255.255.0.0
Subnet Mask IP Address: 10.24.36.2 / 8 Subnet Mask? IP Address: 10.24.36.2 255.255.224.0 Prefix Mask? IP Address: 10.24.36.2 255.255.255.192 Prefix Mask? IP Address: 10.24.36.2 255.255.255.252 Prefix Mask? IP Address: 10.24.36.2 255.254.0.0 Prefix Mask? IP Address: 10.24.36.2 255.255.240.0 Prefix Mask?
ANDing Inside data network devices, digital logic is applied for their interpretation of the addresses. AND is used in determining the network address. 0 AND 0 = 0 1 AND 0 = 0 1 AND 1 = 1 0 AND 1 = 0 A B Result 1
Network and Host Part IP Address 135.15.2.1 255.255.0.0 A B Result 1 1 Decimal Binary IP Address 135.15.2.1 10000111 00001111 00000010 00000001 Subnet Mask 255.255.0.0 11111111 00000000 Network 135.15.0.0 10000111 00001111 00000000
ANDing –What is in our network?
Reasons to Use AND Routers use the ANDing process to determine the route a packet will take. The network number of the destination address is used to find the network in the routing table. The router determines the best path for the frame. Decimal Binary IP Address 135.15.2.1 10000111 00001111 00000010 00000001 Subnet Mask 255.255.0.0 11111111 00000000 Network 135.15.0.0 10000111 00001111 00000000
Reasons to Use AND The source device uses the ANDing process to determine if the packet is to be sent to the default gateway. If the destination network is the same as the network where the PC resides, the packet is sent directly to that host. If the destination network is different, the packet is sent to the default gateway. Decimal Binary IP Address 135.15.2.1 10000111 00001111 00000010 00000001 Subnet Mask 255.255.0.0 11111111 00000000 Network 135.15.0.0 10000111 00001111 00000000
3 Types of Address Every network has: Network address – the first one Broadcast address – the last one Host addresses – everything in between
Types of Addresses
Network Address 192.168.10.0/24 Network Address 192 168 10 11000000 10101000 00001010 00000000 Broadcast Address 255 11111111 Host Address 1 00000001 All hosts in the network will have the same network bits. Cannot be assigned to a device. Each host bit in this address will be 0.
Broadcast Address Cannot be assigned to a device. Network Address 192 168 10 11000000 10101000 00001010 00000000 Broadcast Address 255 11111111 Host Address 1 00000001 Cannot be assigned to a device. Each host bit in this address will be 1.
Host Address Network Address 192 168 10 11000000 10101000 00001010 00000000 Broadcast Address 255 11111111 Host Address 1 00000001 The unique address assigned to each device on the network. Addresses 192.168.10.1 through 192.168.10.254.
Network Prefix is not always /24
Calculating Network, Host and Broadcast Addresses
Special Addresses
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 255.255.255.255 locally Multicast – a message addressed to a group of hosts. Uses an address starting 224 - 239
Unicast and Multicast Examples of Multicast Application Video and audio broadcasts Routing information exchange by routing protocols Distribution of software News feeds
Broadcast Limited Broadcast Directed Broadcast For a host outside of the network to communicate with the hosts within the 172.16.4.0 /24 network, the destination address of the packet would be 172.16.4.255. A directed broadcast is sent to all hosts on a specific network. he limited broadcast is used for communication that is limited to the hosts on the local network. These packets use a destination IPv4 address 255.255.255.255. Routers do not forward this broadcast.
Range of IPv4 Addresses
Public and Private Addresses
Private IP addresses Unrestricted use on private networks. Not routed across the Internet. The ranges are: 10.0.0.0 – 10.255.255.255 (10.0.0.0/8) 172.16.0.0 – 172.31.255.255 (172.16.0.0/20) 192.168.0.0 – 192.168.255.255 (192.168.0.0/24)
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
Network Address Translation (NAT) 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
Routing through NAT Inside Private Outside Public Translation of Private IP address to Public IP address. The translation process uses an internal translation table.
How Does NAT Work? Send R2: I have a packet for the outside network. I must translate the IP address. 209.165.200.226 DA SA 209.165.201.1 209.165.200.226 DA SA 209.165.201.1 192.168.10.10
How Does NAT Work? Receive R2: I have a packet for the inside network. I must translate the IP address. DA SA 192.168.10.10 209.165.201.1 209.165.200.226 DA SA 209.165.200.226 209.165.201.1
Dynamic Mapping and Static Mapping NAT Table Inside Local Inside Global 10.0.0.1 179.9.8.81 10.0.0.2 10.0.0.3 10.0.0.4 10.0.0.5 10.0.0.6 10.0.0.7 10.0.0.8 179.9.8.86 Dynamic Mapping: Mapping of local addresses dynamically to a pool of global addresses. The hosts able to use NAT is limited by the number of addresses in the range. If you have allocated 6 public addresses for NAT, any 6 users can use NAT simultaneously. The NAT device dynamically assigns an address when a request is received. When a session ends, the address is returned to the pool for another user.
NAT Overload Port Address Translation (PAT): 209.165.200.226 SA DA 192.168.10.10:1555 209.165.201.1:80 SA DA 209.165.200.226:1555 209.165.201.1:80 SA DA 209.165.200.226:1331 209.165.202.129:80 SA DA 192.168.10.11:1331 209.165.202.129:80
NAT Overload Port Address Translation (PAT): 209.165.200.226 SA DA 209.165.201.1:80 209.165.200.226:1555 SA DA 209.165.201.1:80 192.168.10.10:1555 SA DA 209.165.202.129:80 192.168.10.11:1331 SA DA 209.165.202.129:80 209.165.200.226:1331
NAT Overload Port Address Translation (PAT): NEXT AVAILABLE PORT 192.168.10.11:1444 192.168.10.12:1444
Special IPv4 Addresses Default Route : Loopback Address : 0.0.0.0 “all addresses” in default route. Hosts cannot be given addresses starting 0. 0.0.0.0 - 0.255.255.255 (0.0.0.0 /8) address block. Loopback Address : 127.0.0.1 Hosts use this address to direct traffic to themselves. Hosts cannot be given addresses starting 127.
Special IPv4 Addresses Link Local : TEST-NET Automatically assigned to the local host by the operating system in environments where no IP configuration is available. 169.254.0.0 - 169.254.255.255 (169.254.0.0 /16 block) TEST-NET 192.0.2.0 to 192.0.2.255 set aside for teaching and learning purposes. Unlike the experimental addresses, network devices will accept these addresses in their configurations.
Special IPv4 Addresses
Reserved and Special Purpose Addresses Type Block Range Network 1 per network Broadcast Multicast 224.0.0.0/4 224.0.0.0 – 239.255.255.255 Default Route 0.0.0.0/8 0.0.0.0 – 0.255.255.255 Loopback 127.0.0.0/8 127.0.0.0 – 127.255.255.255 Link-local 169.254.0.0/16 169.254.0.0 – 169.254.255.255 Test-net 192.0.2.0/24 192.0.2.0 – 192.0.2.255 Private 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 10.0.0.0 – 10.255.255.255 172.16.0.0 – 172.31.255.255 192.168.0.0 – 192.168.255.255
Legacy IPv4 Addresses-Classful
Classful addressing Easy to work out but very wasteful. Routers and hosts still assume class subnet masks by default Class A /8 255.0.0.0 Class B /16 255.255.0.0 Class C /24 255.255.255.0
Planning to address the network
Assigning Addresses Static addressing address is configured by an administrator Servers, printers, routers, switches need static addresses
Assigning Addresses Dynamic addressing address is allocated automatically by DHCP by leasing addresses from a pool. Dynamic addressing is best for workstations
Assigning Addresses to other devices
Who Assigns IP Addresses?
Testing
Testing the Network -Ping For testing IP connectivity between hosts. Ping sends out requests for responses from a specified host address. Uses a Layer 3 protocol, called ICMP (Internet Control Message Protocol).
Ping Sends Echo request datagram, receiver responds with an ICMP Echo Reply datagram. For each packet sent, ping measures the time required for the reply.
Testing the Local Stack
Testing Connectivity to the local network.
Testing Connectivity to Remote LAN
Example: Testing Local Stack
Testing Default Gateway
Testing Remote Network
Internet Control Messaging Protocol (ICMPv4) ICMP is the messaging protocol. As IPv4 is not a reliable protocol. ICMP send messages to provide feedback, not to make IP reliable. ICMP messages are not required and are often not allowed for security reasons.
Types of ICMP Messages ICMP messages that may be sent include: Host conformation Unreachable Destination or Service Time exceeded Route redirection Source quench
Traceroute/Tracert Traceroute (tracert) is a utility that allows us to observe the path between these hosts. The trace generates a list of hops that were successfully reached along the path. An asterisk (*) is used to indicate a lost packet.
Tracert Example
IPv6
IPv6 128-bit hierarchical addressing - to expand addressing capabilities Header format simplification - to improve packet handling Improved QoS mechanisms and security. IPv6 is not merely a new Layer 3 protocol - it is a new protocol suite.
IPv6 Address