420 likes | 504 Views
Het IP - Protocol. IP-protocol Services. Routing Multiple client protocols Datagram delivery Independant from the Network Interface Layer Fragmentation and reassembly Extensible through IP options Packet switching technology. 4-bit version. 4-bit hea- der length. 8-bit type of
E N D
IP-protocol Services • Routing • Multiple client protocols • Datagram delivery • Independant from the Network Interface Layer • Fragmentation and reassembly • Extensible through IP options • Packet switching technology
4-bit version 4-bit hea- der length 8-bit type of service(TOS) 16-bit total length (in bytes) 3-bit flag 16-bit identification 13-bit fragment offset 8-bit time to live (TTL) 8-bit protocol 16-bit header checksum 32-bit source IP address 32-bit destination IP address Options (if any) data IP Header 0 15 16 31 20 bytes
Wat is een IP Address? 86 133.120.75.8 90 94 129.102.12.7 MARIA AVE MARIA AVE 133.120.0.0 129.102.0.0 131.107.0.0 129.102.16.2 131.107.3.27
8 Bits 1 1 1 1 1 1 1 1 128 64 32 16 8 4 2 1 255 Decimal Value Conversie IP Adres van Binair naar Decimaal Formaat
32 Bits Network ID Host ID Class B w. x. y. z. 131.107.3.24 Example: Netwerk ID en Host ID
Address Classes Number of Networks Number of Hosts per Network Class A Network ID Host ID 126 16,777,214 0 Class B Network ID Host ID 16,384 65,534 1 0 Class C Network ID Host ID 2,097,152 254 1 1 0 w x y z
Number of Networks Number of Hosts per Network Range of Network IDs (First Octet) Class A 126 16,777,214 1 – 126 Class B 16,384 65,534 128 – 191 Class C 2,097,152 254 192 – 223 Address Class Summary
A C B Router Router 124.x.y.z 192.121.73.z 131.107.y.z Assigning Network IDs
Network Addressing Guidelines • Network ID Must Be Unique • 127 Is Reserved for Diagnostic Loopback Functions • Network ID Cannot Be all 255 (All Bits Set to 1) • 255 is a broadcast address • Network ID Cannot Be all 0 (All Bits Set to 0) • 0 indicates a local network
A C B 124.0.0.27 124.0.0.1 192.121.73.2 131.107.24.27 Router Router 124.0.0.28 192.121.73.1 131.107.24.1 131.107.24.28 124.x.y.z 192.121.73.z 131.107.24.z 124.0.0.29 131.107.24.29 Assigning Host IDs
Host Addressing Guidelines • Host ID Must Be Unique to the Network ID • Host ID Cannot Be 255 (All Bits Set to 1) • 255 is a broadcast address • Host ID Cannot Be 0 (All Bits Set to 0) • 0 means “this network only”
Common Addressing Problems • Network IDs on the Local Network Don’t Match • Local hosts cannot communicate • Host IDs on the Local Network Are Duplicate • Windows NT–based hosts cannot initialize • Other TCP/IP-based hosts may not be able to communicate • Other TCP/IP-based hosts could hang
How to choose/assign IP-addresses ? • Internet Service Provider • ICANN - Internet Corporation for Assigned Names and Number • RIPE – ARIN – APNIC – LACNIC - AfriNIC • Private Address Space (RFC 1918) • 10.0.0.0 - 10.255.255.255 • 172.16.0.0 - 172.31.255.255 • 192.168.0.0 - 192.168.255.255
Loopback interface IP driver • 127.0.0.1 • name localhost IP output function IP input function Loopback driver Place on IP input queue yes Dest. IP = broadcast or multicast ? Place on IP input queue no yes Dest. IP = interface address ? Ethernet driver Ethernet
Excercise • Connect two pc’s to a hub and assign an ip-address from the same network. Issue a ping command from one to the other. Do the same with ip-addresses from different networks • Find the public address space assigned to your company (or any company that you know)
The Domain Name System • An Alias Used to Reference a TCP/IP Host • A Fully Qualified Domain Name (FQDN) • Example: ftp.microsoft.com • Provides a Simplified Way to Access a TCP/IP Host • Used by Ping and Other TCP/IP Utilities • Entries Are Stored in the HOSTS File or DNS • Viewed with the nslookup Utility
IP addressing summary • Network part: all host bits 0 • 193.58.9.0 • First ip address : • 193.58.9.1 • Broadcast address: all host bits 1 • 193.58.9.255
Overview Subnetting • What Is a Subnet? • Subnet Addressing • What Is a Subnet Mask? • Defining a Subnet Mask • Defining Network IDs for an Internetwork • Defining Host IDs for Subnets
What Is a Subnet Mask? • Distinguishes the Network ID from the Host ID • Used to Specify Whether the Destination Host is Local or Remote
131.107. 16.200 255.255. 0.0 Default Subnet Masks (No Subnetting) Address Class Bits Used for Subnet Mask Dotted Decimal Notation Class A Class B Class C 11111111 00000000 00000000 00000000 11111111 11111111 00000000 00000000 11111111 11111111 11111111 00000000 255.0.0.0 255.255.0.0 255.255.255.0 Class B Example IP Address Subnet Mask 131.107. y.z Network ID w.x. 16.200 Host ID
IP Address Subnet Mask 10011111 11100000 00000111 10000001 11111111 11111111 00000000 00000000 Result 10011111 11100000 00000000 00000000 How IP Determines If a Packet Is Destined Locally or Remotely • Local IP and Destination IP are ANDed with Mask • 1 AND 1 = 1 • Other combinations = 0 • If ANDed results of source and destination hosts match, the destination is local
A B Problem : Waste of address space ! • Inefficient use of address space 193.107.8.1 193.107.16.2 193.107.16.1 193.107.24.1 193.107.16.z We only use 2 address out of 254 193.107.8.z 193.107.24.z
How is subnetting done? 131.107.3.27 131.107.12.7 • Borrow bits from host part • All hosts on same segment have same subnet number Subnet 1 131.107.10.0 255.255.255.0 Subnet 2 131.107.3.0 255.255.255.0 131.107.12.0 Main Network Subnet 3 131.107.12.0 255.255.255.0 131.107.12.31 131.107.10.12
Address Class Bits Used for Subnet Mask Dotted Decimal Notation Class ? Class ? 11111111 11111111 00000000 00000000 11111111 11110000 00000000 00000000 11111111 11111111 11111111 0000000011111111 11111111 11110000 00000000 255.255.0.0255.240.0.0 255.255.255.0255.255.240.0 Class B Example IP Address 131.107.16. 200 255.255.255. 0 Subnet Mask 131.107. y.z Network ID w.x. 16. z Subnet ID w.x.y. 200 Host ID Examples of a Custom Subnet Mask (Subnetting)
Example 1 Example 2 131.107.35.200 131.107.61.26 153.170.37.16217.170.172.233 Using the Subnet Mask to Determine If a Host Is Local or Remote • Comparing Two Network IDs Does Not Always Indicate a Local or Remote Host • Compare Both Addresses to a Subnet Mask to Determine Location Subnet Mask IP Addresses Same Network? Yes No 131.107.35.200131.107.61.26 255.255.0.0, or 255.255.255.0
Determining the Number of Subnet Mask Bits Subnet Mask Number of Subnets 2 . . . 254 Network ID Subnet Mask Host ID Class B 1 0 Number of Hosts 16,382 . . . . . . 254 Host ID
3 Defining a Subnet Mask Determine the Number of Subnets Convert the Number of Subnets to Binary Convert the Required Number of Bits to Decimal (High Order) 1 2 3 Example of Class B Address 6 Number of Subnets 0 0 0 0 0 1 1 0 (3 Bits) Binary Value 4+2 = 6 Convert to Decimal 11111111 11111111 11100000 00000000 255 . 255 . 224 . 0
w.x.32.1 w.x.63.254 w.x.128.1 w.x.64.1 w.x.160.1 w.x.96.1 w.x.95.254 w.x.127.254 w.x.192.254 w.x.159.254 Shortcut to Defining Network IDs List the Number of Bits (High Order) Used for Subnet Mask Convert the Bit with the Lowest Value to Decimal Increment the Value for Each Bit Combination 11100000 1 32 2 3 0 + 32 = 32 + 32 = 64 + 32 = 96 + 32 = 128 + 32 = 160
Subnet IDs Host ID Range 00000000 = 0 00100000 = 32 01000000 = 64 01100000 = 96 10000000 = 128 10100000 = 160 11000000 = 192 11100000 = 224 “Invalid” x.y.32.1 – x.y.63.254 x.y.64.1 – x.y.95.254 x.y.96.1 – x.y.127.254 x.y.128.1 – x.y.159.254 x.y.160.1 – x.y.191.254 x.y.192.1 – x.y.223.254 “Invalid” Defining Host IDs for a Subnet • Each Subnet ID Indicates the Beginning Value in a Range • The Ending Value Is One Less Than the Beginning Value of the Next Subnet ID
Subnet Addressing • Determine the Number of Required Network IDs • One for each subnet • One for each wide area network connection • Determine the Number of Required Host IDs per Subnet • One for each TCP/IP host • One for each router interface • Define One Subnet Mask Based on Requirements • Define a Unique Network ID for Each Subnet Based on the Subnet Mask • Define Valid Host IDs for Each Subnet Based on the Network ID
Example : Assign subnets 210.10.10.0/24 10 10 10
Internet Excercise : Assign subnets (subnet zero is valid) 100 193.58.1.0 /24 100 193.58.2.0 / 24 193.58.3.0 / 24 10 2 2 28 100 50 50 6 50 40 40
Solution 100 193.58.1.0 /24 100 193.58.2.0 / 24 193.58.3.0 / 24 11111111 11111111 11111111 10000000 255 . 255 . 255 . 128
Internet Excercise : Assign subnets (subnet zero is valid) 193.58.1.0 /24 193.58.1.0 /25 193.58.2.0 / 24 193.58.1.128 /25 193.58.3.0 / 24 193.58.3.224 / 28 193.58.3.248 / 30 193.58.3.252 / 30 193.58.3.192 / 27 193.58.2.0 /25 193.58.2.128 /26 193.58.2.192 /26 193.58.3.240 / 29 193.58.3.0 / 26 193.58.3.64 / 26 193.58.3.128 / 26
Excercise : Assign subnets (subnet zero is valid) 192.168.1.0 / 24 50 40 10 Internet 20 30
Exercise • 25.158.7.89/19 • Define network mask • Define network • Define first ip address • Define last ip address • Define broadcast address
Review • What Is a Subnet? • Subnet Addressing • What Is a Subnet Mask? • Defining a Subnet Mask • Defining Network IDs for an Internetwork • Defining Host IDs for Subnets
Commands • netstat • Network connections and routing table • Unix - Windows NT • ifconfig • interface information • Unix • winipcfg • Windows 95/98 • ipconfig • Windows NT/2000
Classless Interdomain Routing (CIDR) • Exhaustion IP address space • No class A - B and C • w.x.y.z/s with 1 <= s < = 32 • Route aggregation