Upload
yesmurali
View
320
Download
5
Embed Size (px)
DESCRIPTION
CS65-Computer NetworksDept. of EEEAddressing• In addition to the physical address (contained in NIC) that identify individual devices, the Internet requires an additional addressing convention : an address that identifies the connection of a host to its network. • Each internet address consists of four bytes(32 bits) defining three fields : class type, netid, hostid. • These parts are varying lengths, depending on the class of the address1 2..contd ..contd• Internet Address – IP Address
Citation preview
CS65-Computer Networks Dept. of EEE
Prepared by S.Muralidharan 1
1111 2222
AddressingAddressing
• In addition to the physical address (contained in NIC) that identify individual devices, the Internet requires an additional addressing convention : an address that identifies the connection of a host to its network.
• Each internet address consists of four bytes(32 bits) defining three fields : class type, netid, hostid.
• These parts are varying lengths, depending on the class of the address
3333
....contdcontd• Internet Address – IP Address
– Classful addressing – original architecture• Class A, B, C, D, and E
– Classless addressing – introduced during mid 1990s
• IPv4 – 32-bit binary number
– Dotted-Decimal Notation128.11.3.31255.255.255.0
• IPv6 - 128-bit 4444
The difference between classful IP addressing and classless IP addressing
• is in selecting the number of bits used for the network ID portion of an IP address. In classful IP addressing, the network ID portion can take only the predefined number of bits 8, 16, or 24. In classless addressing, any number of bits can be assigned to the network ID.
CS65-Computer Networks Dept. of EEE
Prepared by S.Muralidharan 2
5555
....contdcontd
• Classes :– Classes are designed to cover the needs of
different types of organizations.– For eg. Class A use only one byte to
identify class type and netid, and leave three bytes for host id. Which means this type of class can accommodate more hosts than any other class.
6666
.. .. contdcontd
– Class B provides two byte hostid field– Class C provide one byte hostid field.– Class D is reserved for “multicast address”.
Multicasting allows copies of a datagram to be passed to a select group of hosts rather than to an individual host.
– Class E is reserved for future use.
7777
NetidNetid and and HostidHostid
8888
Addressing Addressing –– IPV4IPV4• Network ID, Host ID• Class A – 128 blocks (First Byte), 16,777,216 hosts• Class B – 16,384 blocks (First & Second Byte), 65536 hosts• Class C – 2,097,152 blocks (First, Second, Third byte), 256 hosts• Class D – 1 block, Multicasting
CS65-Computer Networks Dept. of EEE
Prepared by S.Muralidharan 3
9999
Finding the ClassFinding the Class
10101010
Number of blocks and block size in Number of blocks and block size in classfulclassfulIPv4 addressingIPv4 addressing
11111111
IP Addresses IP Addresses -- Class AClass A• 32 bit global internet address• Network part and host part• Class A
– Start with binary 0– All 0 reserved– 01111111 (127) reserved for loopback– Range 1.x.x.x to 126.x.x.x
12121212
Classes and Blocks Classes and Blocks -- NetidNetid 7373128 Blocks; 16,777,216 Hosts
CS65-Computer Networks Dept. of EEE
Prepared by S.Muralidharan 4
13131313
IP Addresses IP Addresses -- Class BClass B• Range 128.x.x.x to 191.x.x.x• Second Octet also included in network
address• 214 = 16,384 class B addresses• It created a problem : it’s the type that most
organizations wanted, roughly right number of hosts in a network (64K), C is too small (256) and A way too many.
14141414
16384 Blocks; 65536 HostsClasses and Blocks Classes and Blocks -- NetidNetid 180180..88
15151515
IP Addresses IP Addresses -- Class CClass C• Range 192.x.x.x to 223.x.x.x• Second and third octet also part of network
address• 221 = 2,097,152 addresses• Nearly all allocated (still, lots left, being
allocated in chunk of addresses, not just net/host combinations)
16161616
2,097,152 Blocks; 255 HostsClasses and Blocks Classes and Blocks -- NetidNetid 200.11.8200.11.8
CS65-Computer Networks Dept. of EEE
Prepared by S.Muralidharan 5
17171717
• An address defines a network with all host-id = 0
18181818
Sample InternetSample InternetClass C
Class C
Class A
Class B
19191919
Problems with Classes
• Class A usually to big• Class C often to small• Not enough Class Bs• Inefficient utilisation of address space• Solution: extending the network part of
the address: Subnetting
20202020
SUBNETTINGSUBNETTING• Earlier classes give only 2 levels of topology
ie. netid and hostid
CS65-Computer Networks Dept. of EEE
Prepared by S.Muralidharan 6
21212121
• Helps to achieve 3 levels of topology.
22222222
SubnettingSubnetting –– 3 3 Level HierarchyLevel Hierarchy• Three levels: Site, Subnet, Host
23232323
……contdcontd• An organization can subdivide it’s host address
space into groups called subnets.• The subnet ID is generally used to group hosts
based on the physical network topology.• Subnet masks define variable partition of host
part• Subnets visible only within site
24242424
router
Subnet 1128.213.1.x
Subnet 2128.213.2.x
Subnet 3128.213.3.x
CS65-Computer Networks Dept. of EEE
Prepared by S.Muralidharan 7
25252525
An Institutional networkAn Institutional network
hub hub hub
switch
to externalnetwork
router
IP subnet
mail server
web server
26262626
27272727
Network number Host number
Class B address
Subnet mask (255.255.255.0)
Subnetted address
111111111111111111111111 00000000
Network number Host IDSubnet ID
Take a network address and break it up into subnets that can be assigned to individual physical networks.
Define a subnet mask to help create a new level of hierarchy in the addressing scheme.
The bitwise AND of the subnet mask with the full address gives the subnet number.
.
28282828
• Example: Take host address 213.23.47.37 and subnet mask 255.255.255.240 and compute the subnet number.
IP address 213. 23. 47. 37Mask 255. 255. 255. 240
-----------------------------------213. 23. 47. 32
37 0 0 1 0 0 1 0 1 AND operation240 1 1 1 1 0 0 0 0
----------------------------32 0 0 1 0 0 0 0 0
CS65-Computer Networks Dept. of EEE
Prepared by S.Muralidharan 8
29292929
128 64 32 16 8 4 2 1
1
2021222324252627
0 0 0 1 1 0 0140
1 1 0 0 0 0 0 0192
0 0 1 1 1 0 0 056
0 0 1 0 1 1 0 145
1 1 1 1 1 1 1 1255
1 1 1 1 1 1 1 1255
1 1 1 1 1 1 1 1255
0 0 0 0 0 0 0 00
IP Address
NetMask
1 0 0 0 1 1 0 0140
1 1 0 0 0 0 0 0192
0 0 1 1 1 0 0 056
0 0 0 0 0 0 0 00
Network Address
140.192.56.0/2424-bit mask8-bit subnet mask
140.192.56.45
1 0 0 0 1 1 0 0140
1 1 0 0 0 0 0 0192
0 0 1 1 1 0 0 056
0 0 1 0 1 1 0 145
1 1 1 1 1 1 1 1255
1 1 1 1 1 1 1 1255
1 1 1 1 0 0 0 0240
0 0 0 0 0 0 0 00
1 0 0 0 1 1 0 0140
1 1 0 0 0 0 0 0192
0 0 1 1 0 0 0 048
0 0 0 0 0 0 0 00
140.192.48.0/2020-bit mask4-bit subnet mask
140.192.56.45
IP Address
NetMask
Network Address
Network Subnet Host
Network Subnet Host
30303030
A Network With and Without A Network With and Without SubnettingSubnetting
31313131
Fine Points on Fine Points on SubnettingSubnetting• The subnet mask does not need to align on
byte boundaries. (You don’t even have to have contiguous 1’s, although that is not recommended.)
• It is possible to put multiple subnets on the same physical network, but hosts on the same physical network may then have to go through a router to talk to each other.
• From outside the subnetted domain, the whole thing is viewed as a single network. For this reason, subnets should be kept geographically close.
32323232
Subnets and Subnet MasksSubnets and Subnet Masks• Allow arbitrary complexity of internetworked
LANs within organization• Insulate overall internet from growth of
network numbers and routing complexity• Site looks to rest of internet like single network• Each LAN assigned subnet number• Host portion of address partitioned into subnet
number and host number• Local routers route within subnetted network• Subnet mask indicates which bits are subnet
number and which are host number
CS65-Computer Networks Dept. of EEE
Prepared by S.Muralidharan 9
33333333
• Subnets can simplify routing.• IP subnet broadcasts have a hostID of all 1s.• It is possible to have a single wire network
with multiple subnets.
34343434
Default masks for Default masks for classfulclassful addressingaddressing
35353535
Address Resolution Protocol (ARP)Address Resolution Protocol (ARP)• Why ARP?
– When an IP packet has traversed the Internet and encounters the destination LAN, how does the packet find the destination workstation?
• Even though the destination workstation may have an IP address, a LAN does not use IP addresses to deliver frames
• A LAN uses the MAC layer address
• ARP translates an IP address into a MAC layer address so a frame can be delivered to the proper workstation
36363636
....contdcontd• The Address Resolution Protocol is used
by a sending host when it knows the IP address of the destination but needs the Ethernet address.
• ARP is a broadcast protocol - every host on the network receives the request.
• Each host checks the request against it’s IP address - the right one responds
• ARP does not need to be done every time an IP datagram is sent - hosts remember the hardware addresses of each other.
CS65-Computer Networks Dept. of EEE
Prepared by S.Muralidharan 10
37373737
• Part of the ARP protocol specifies that the receiving host should also remember the IP and hardware addresses of the sending host.
• Each IP node (Host, Router) on LAN has ARPtable. ARP Table has IP/MAC address mappings for some LAN nodes like as follows :
< IP address; MAC address; TTL>< IP address; MAC address; TTL>– TTL (Time To Live): time after which
address mapping will be forgotten (typically 20 min)
38383838
Address Resolution Table• Each host maintains its own address resolution table• Each entry correlates between IP address and MAC
address• In an entry there is a field that marks the way the entry
was created (Static or Dynamic)Example:
1.1.24.1 00:30:7b:91:bd:6c Dynamic
1.1.24.65 00:60:e1:00:9c:70 Static
1.1.24.223 00:60:e1:00:07:91 Dynamic
IP Address MAC Address Type
8:00
---
8:03
TTL
39393939
ARP operationARP operation
40404040
• ‘A’ wants to send datagram to ‘B’, and 'A' knows ‘B’s’ IP address.• Suppose 'B'’s MAC address is not in ‘A’s’ ARP table.• 'A' broadcasts ARP query packet, containing 'B’s’ IP address
– all machines on LAN receive ARP query • 'B' receives ARP packet, replies to 'A' with its (‘B’s’) MAC address
– frame sent to ‘A’s’ MAC address (unicast)• 'A' caches (saves) IP-to-MAC address pair in its ARP table until
information becomes old (times out) – soft state: information that times out (goes away) unless
refreshed• ARP is “plug-and-play”:
– nodes create their ARP tables without intervention from net administrator
CS65-Computer Networks Dept. of EEE
Prepared by S.Muralidharan 11
41414141
ARPARPHEY - Everyone please listen! Will 128.213.1.5 please send me his/her Ethernet address
not me
Hi Red! I’m 128.213.1.5, and my Ethernet address is 87:A2:15:35:02:C3
42424242
How ARP is used in Routing to another LANwalkthrough: send datagram from A to B via R
assume A know’s B IP address
• Two ARP tables in router R, one for each IP network (LAN)• In routing table at source Host, find router 111.111.111.110• In ARP table at source, find MAC address E6-E9-00-17-BB-4B, etc
A
R B
43434343
• A creates datagram with source A, destination B • A uses ARP to get R’s MAC address for 111.111.111.110• A creates link-layer frame with R's MAC address as dest, frame
contains A-to-B IP datagram• A’s adapter sends frame • R’s adapter receives frame • R removes IP datagram from Ethernet frame, sees its destined
to B• R uses ARP to get B’s MAC address • R creates frame containing A-to-B IP datagram sends to B
A
R B44444444
ARP FRAME FORMAT� The 2-byte HardwareHardware--TypeType fieldfield gives the type of the hardware address we are interested in (e.g.,
1 for Ethernet).� The 2-byte ProtocolProtocol--TypeType fieldfield gives the type of the higher level protocol address we are
interested in (e.g., 0x0800 for IP). Note, it is two bytes long, just like the Ethernet type field.� A 1-byte HardwareHardware--LengthLength field specifying the length of the hardware address (6 bytes would be
the length for Ethernet).� A 1-byte ProtocolProtocol--LengthLength fieldfield specifying the length of the target protocol address (4 for IP).� A 16-bit OperationOperation CodeCode fieldfield specifying the operation desired (e.g., 1 for REQUEST or 0 for
RESPONSE).� The sender'ssender's EthernetEthernet addressaddress (Sender
Hardware Address) (if known).
� The sender'ssender's InternetInternet addressaddress (SenderProtocol Address) (if known).
� The target'starget's EthernetEthernet addressaddress (TargetHardware Address) (filled in response).
� The target'starget's InternetInternet addressaddress (TargetProtocol Address) (filled in response).
CS65-Computer Networks Dept. of EEE
Prepared by S.Muralidharan 12
45454545
ARP Details
• Conceptually, ARP consists of two parts: the software responsiblefor finding the physical address of an IP address (e.g., a client), andthe software responsible for answering ARP requests from othermachines (e.g., a server).
• When sending an IP datagram, the sender searches its local ARPcache for the desired target address. If found, ARP is done.
• If not found, send out a broadcast ARP request and wait for theresponse.
• In practice, waiting for a response is somewhat tricky, because thetarget machine may be down, the request might become lost andneed to be retransmitted, and so forth.
46464646
RARPRARP• The process of finding out the IP address of a
host given a hardware address is called Reverse Address Resolution
• Reverse address resolution is needed by diskless workstations when booting.
47474747
RARPRARPHEY - Everyone please listen! My Ethernet address is22:BC:66:17:01:75.Does anyone know my IP address ?
not me
Hi Red ! Your IP address is 128.213.1.17.
48484848
INTERNET CONTROL MESSAGE PROTOCOLINTERNET CONTROL MESSAGE PROTOCOL• “Internet Control Message Protocol (ICMP)” which is a
required companion to IP.• From a layering point of view, ICMP is a separate
protocol that sits above IP and uses IP to transport messages.
• In practice, ICMP is an integral part of IP and all IPmodules must support the ICMP protocol.
IP
TransportTCP/UDP
ICMP
CS65-Computer Networks Dept. of EEE
Prepared by S.Muralidharan 13
49494949
• The Internet Control Message Protocol (ICMP) allowsgateways and hosts to send network control informationto each other.
• ICMP provides feedback about :– When a datagram cannot reach its destination– When the gateway’s buffer overflows– When the gateway can direct the station to send
traffic on a shorter route.• An ICMP message is constructed and then passed on to
IP, which encapsulates the message with an IP header and then transmits it to the destination gateway or station.
50505050
Important points about ICMP error messages:
� No ICMP error message will be generated in response to adatagram carrying an ICMP error message.
� No ICMP error message will be generated for a fragmenteddatagram that is not the first fragment.
� No ICMP error message will be generated for a datagram having amulticast address.
� No ICMP error message will be generated for a datagram having aspecial address such as127.0.0.0 or 0.0.0.0.
51515151
• ICMP also does the job of diagnosis of some network problems by query messages.
52525252
IGMPIGMP• The IP protocol can be involved in two types of
communication: unicasting and multicasting. – Unicasting : communication between one sender and one
receiver– Multicasting : communication between one sender and many
receiver.• The Internet Group Management Protocol (IGMP) has
been designed to help a multicast router to identify the hosts in a LAN that are members of a multicast group. IGMP is a companion to the IP protocol.
CS65-Computer Networks Dept. of EEE
Prepared by S.Muralidharan 14
53535353 53
Dynamic Host Configuration Protocol (DHCP)� An IP address can be assigned to a workstation permanently (static assignment) or dynamically� Dynamic IP address assignment is a more efficient use of scarce IP addresses� DHCP is used to match workstations with an IP address. This address can be changed every time the machine boots. Allows configuration flexibility.� When a DHCP client issues an IP request, the DHCP server looks in its static table, If no entry exists, the server selects an IP address from an available pool.� Address assigned by the DHCP server is temporary. Part of agreement includes a specific period of time. If no time period specified, the default is one hour.� DHCP clients may negotiate for a renewal before the time period expires.
54545454
Here’s the protocol:1. Workstation broadcasts DHCPDISCOVER message on power-up. 2. Request may include items like: DNS servers, time servers, boot files,3. Several DHCP Servers may respond with DHCPOFFER messages
containing:IP address, subnet mask, Router address, Renewal Time
4. Workstation responds to one offer with DHCPREQUEST.5. DHCP Server now binds IP address and replies with DHCPACK
message with requested options.• Manager assigns multiple ranges of IP addresses to each DHCP
server and server manages distribution to clients.• Client must renew IP address at regular intervals indicated by
Renewal Time.• The message is actually sent using a protocol called the User
Datagram Protocol (UDP) that runs over IP.
55555555 56565656
• When trying to obtain configuration information, the client puts its hardware address (e.g., its Ethernet address) in the chaddr field. The DHCP server replies by filling in the yiaddr (“your” IP address) field and sending it to the client. Other information such as the default router to be used by this client can be included in the options field.
DHCP Packet Format