CS65-Computer Networks
Dept. of EEE
Addressing • In addition to the physical physical address (contained (contained in NIC) that identify i ndividual devices, the Internet requires an additional addressing convention : an address that identifies the connection of a host to its network. • Each internet internet address address consists of four bytes(32 bits) defining three fields : class type, netid, hostid. • These parts parts are varying varying lengths, depending on the class of the address 1
2
..contd ..contd The difference between classful IP addressing and classless IP addressing
• Internet Internet Address Address – IP Address Address – Classful addressing – original architecture • Class A, B, C, D, and E – Classless addressing – introduced during mid 1990s
• is in selecting the number of of bits used for the 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.
• IPv4 IPv4 – 32-bit binary number
– Dotted-Decimal Notation 128.11.3.31 255.255.255.0 3
• IPv6 - 128-bit
4
CS65-Computer Networks
Dept. of EEE
..contd ..contd
.. contd – Class B provides two byte hostid field
• Classes :
– Class C provide one byte hostid field.
– Classes are designed to cover the needs of different types of organizations.
– 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.
– 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.
5
– Class E is reserved for future use.
6
Addressing – IPV4
Netid and Hostid
• Network 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
7
8
CS65-Computer Networks
Dept. of EEE
Number of blocks and block size in classful classful IPv4 addressing
Finding the Class
9
10
Classes and Blocks - Netid 73
IP Addresses - Class A
128 Blocks; 16,777,216 Hosts
• 32 bit global internet 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
11
12
CS65-Computer Networks
Dept. of EEE
Classes and Blocks
IP Addresses - Class B
- Netid 180 180..8 .8
16384 Blocks; 65536 Hosts
• Range 128.x.x.x to 191.x.x.x 191.x.x.x • Second Octet also included included in network address • 214 = 16,384 class B addresses • It created a problem problem : it’s the type that most most organizations wanted, roughly right number of hosts in a network (64K), C is too small (256) and A way too many.
13
14
Classes and Blocks
IP Addresses - Class C
2,097,152 Blocks; 255 Hosts
• Range 192.x.x.x to 223.x.x.x 223.x.x.x • Second and and third octet octet also part part of network network address • 221 = 2,097,152 addresses • Nearly all allocated (still, (still, lots left, being allocated in chunk of addresses, not just net/host combinations)
15
16
- Netid 200.11.8
CS65-Computer Networks
Dept. of EEE
Sample Internet • An address defines a network with all host-id = 0
Class B
Class C Class C
Class A
17
18
Problems with Classes
SUBNETTING • Earlier classes give only 2 levels of topology topology ie. netid and hostid
• Class A usually to big • Class C often to small • Not enough Class Bs • Inefficient utilisation of address space • Solution: extending the network network part of the address: Subnetting
19
20
CS65-Computer Networks
Dept. of EEE
Subnetting – 3 Level Hierarchy
• Helps to achieve 3 levels levels of topology. topology.
21
• Three
levels: Site, Subnet, Host
22
…contd …contd router
• An organization organization can subdivide subdivide it’s host address space into groups called subnets. • The subnet ID is generally generally used to group hosts based on the physical network topology. • Subnet masks masks define variable partition partition of host part • Subnets visible only within within site
23
Subnet 1 128.213.1.x
24
Subnet 2 128.213.2.x
Subnet 3 128.213.3.x
CS65-Computer Networks
Dept. of EEE
An Institutional network mail server to external network
web server
router switch
IP subnet
hub
hub
hub
25
26
Netw Networ ork k numb number er
Host Host numb number er
Class B address 11111111111111 111111111111111111111 1111111111 111
00000000
Subnet mask (255.255.255.0) Network number
Subnet ID
Subnetted address
Host ID
• Example: Take host address 213.23.47.37 and subnet mask 255.255.255.240 and compute the subnet number.
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.
IP address
213.
23.
47.
37
Mask
255.
255.
255.
240
-----------------------------------
The bitwise AND of the subnet mask with the full address gives the subnet number.
213.
.
23.
37
0 0 1 0 0 1 0 1
240
1 1 1 1 0 0 0 0 ----------------------------
32 27
28
0 0 1 0 0 0 0 0
47.
32
AND operation
CS65-Computer Networks
Dept. of EEE
27
26
25
24
23
22
21
20
128
64 64
32
16
8
4
2
1
A Network With and Without Subnetting
140.192.56.45 140 1
0
0
0
1
192 1
0
0
1
1
0
0
0
56 0
0
0
0
0
1
Net work
255 1
1
1
1
1
255 1
1
1
1
1
1
140 1
0
0
0
1
1
1
1
1
1
1
1
1
192 1
0
0
1
1
0
0
0
1
1
0
0
0
1
1
45 0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
0
0
255
0
1
1
1
1
1
0
0
0
0
0
1
1
0
1
1
1
IP Address 1
Host
56 0
1
Subnet
NetMask
0 0
0
0
0
0
0
0
0
0
0
0
0
1
0
Network Address
140.192.56.0/24 24-bit mask 8-bit subnet mask
140.192.56.45 140 1
0
0
0
1
192 1
0
0
56
Net work
1
1
1
1
1
255 1
1
1
1
1
1
14 140 0 1
0
0
0
1
0
0
1
45
1
1
1
1
1
1
1
1
1
0
0
0
1
0
0 0
0
0
0
0
0
0
48 0
0
0
0
0
1
IP Address
Host
240
192 1
1
Subnet
255
1
0
0 0
0
0
0
0
0
0
NetMask
Network Address
140.192.48.0/20 20-bit mask 4-bit subnet mask
29
31
30
Fine Points on Subnetting
Subnets and Subnet Masks
• The subnet subnet mask does 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 possible to put 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 outside the subnetted subnetted domain, the whole thing is viewed as a single network. For this reason, subnets should be kept geographically close.
• Allow arbitrary arbitrary complexity complexity of internetworked LANs within organization • Insulate overall overall internet from growth growth of network numbers and routing complexity • Site looks to rest of internet like single network network • Each LAN LAN assigned subnet number number • Host portion of address partitioned partitioned into subnet number and host number • Local routers routers route within subnetted network network • Subnet mask mask indicates which bits are are subnet number and which are host number 32
CS65-Computer Networks
Dept. of EEE
Default masks for for classful addressing • Subnets can simplify routing. • IP subnet broadcasts have have a hostID of all 1s. • It is possible to have a single wire network with multiple subnets.
33
34
Address Resolution Protocol (ARP)
..contd ..contd • The Address Resolution Protocol is used by a sending host host when it knows the IP address of the destination destination but needs the Ethernet address. • ARP is a broadcast protocol - every host on 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 every time an IP datagram is sent - hosts remember the hardware addresses of each other.
• Why ARP? – When an IP packet 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 IP address, a LAN does not use IP addresses to deliver frames • A LAN uses the MAC layer layer address • ARP translates an an IP address into a MAC layer layer address so a frame can be delivered to the proper workstation
35
36
CS65-Computer Networks
Dept. of EEE
Address Resolution Table • Each host maintains its own address resolution table • Each entry correlates between IP address and MAC MAC address • In an entry there is a field that marks the way the entry was created (Static or Dynamic) Example:
• 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 node (Host, (Host, Router) on LAN LAN has ARP table. ARP Table has IP/MAC address mappings for some LAN nodes like as follows : < IP address; MAC address; TTL>
– TTL (Time To Live): Live): time after after which address mapping will be forgotten (typically 20 min) 37
IP Address
MAC Address
Type
TTL
1.1.24.1
00:30:7b:91:bd:6c
Dynamic
8:00
1.1.24.65
00:60:e1:00:9c:70
Static
---
1.1.24.223
00:60:e1:00:07:91
Dynamic
8:03
38
ARP operation •
‘A’ wants wants to send datagram to ‘B’, and 'A' knows ‘B’s’ IP address.
•
Suppose 'B'’s MAC address is is not in ‘A’s’ ARP table.
•
'A' broadcasts ARP query packet, containing 'B’s’ IP address
•
'B' receives ARP packet, replies to 'A' with its (‘B’s’) MAC address
•
'A' caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)
– all machines on LAN receive ARP query – frame sent to ‘A’s’ MAC address address (unicast)
– soft state: information that times out (goes away) unless refreshed •
ARP is “plug-and-p “plug-and-play”: lay”: – nodes create their ARP tables without intervention from net administrator
39
40
CS65-Computer Networks
Dept. of EEE
How ARP is used in Routing to another LAN
ARP
walkthrough: send datagram from A to B v ia R assume A know’s know’s B IP address
HEY - Everyone please listen! Will 128.213.1.5 please send me his/her Ethernet address
A
R B
not me
•
Hi Red! I’m 128.213.1.5, and my Ethernet address is 87:A2:15:35:02:C3
41
•
In routing table at source Host, find router 111.111.111.110
•
In ARP ARP table at source, find MAC address E6-E9-00-17-BB-4B, etc
42
•
A creates datagram with source A, destination B
•
A uses ARP to get R’s R’s MAC address 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 adapter sends frame
•
R’s adapter adapter receive receives s frame
•
R removes IP datagram from Ethernet frame, sees its destined to B
•
R uses uses ARP to get B’s MAC address address
•
R creates frame containing A-to-B IP datagram sends to B A
R
43
Two ARP tables in router R, one for each IP network network (LAN)
ARP FRAME FORMAT
The 2-byte Hardware- Hardware-Type Type field field gives gives the type of the hardware address we are interested in (e.g., 1 for Ethernet).
The 2-byte Protocol- Protocol -Type Type field gives the type of the higher level protocol 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 Hardware- Hardware-Length Length field specifying the length of the hardware address (6 bytes would be the length for Ethernet).
A 1-byte Protocol- Protocol -Length Length Length field field specifying field specifying the length of the target protocol address (4 for IP).
A 16-bit Operation Code Code field field specifying the operation desired (e.g., 1 for REQUEST or 0 for RESPONSE).
The sender's Ethernet Ethernet address (Sender Hardware Address) (if known).
The sender's Internet Internet Internet address address (Sender Protocol Address) (if known).
The target's target's Ethernet Ether Ethernet net net address address (Target Hardware Address) (filled in response).
The target's target's Internet Inter Internet net net address address (Target Protocol Address) (filled in response).
B 44
CS65-Computer Networks
Dept. of EEE
RARP ARP Details •
Conceptuall Conceptually, y, ARP consists consists of two parts: the software software responsible responsible for finding the physical address of an IP address (e.g., a client), and the software responsible responsible for answering answering ARP requests requests from other other machines (e.g., a server).
• The process of finding out the IP address of a host given a hardware address is called Reverse Address Resolution
•
When sending sending an IP datagram, datagram, the sender sender searches searches its local local ARP cache for the desired desired target address. If found, ARP is done. done.
• Reverse address address resolution is needed by diskless workstations when booting.
•
If not found, found, send out a broadcast broadcast ARP request request and wait for the response.
•
In practice, practice, waiting waiting for a response response is somewhat somewhat tricky, tricky, because the target machine may be down, the request might become lost and need to be be retransmitted, and so forth.
45
46
RARP
INTERNET CONTROL MESSAGE PROTOCOL • “Internet Control Message Protocol (ICMP)” which is a required companion to IP. • From a layering point of view, ICMP ICMP is a separate protocol that sits above IP and uses IP to transport messages. • In practic practice, e, ICMP ICMP is an integral integral part of IP and all IP
HEY - Everyone please listen! My Ethernet address is22:BC:66:17:01:75. Does anyone know my IP address ?
modules must support the ICMP protocol. Transport TCP/UDP
not me ICMP
Hi Red ! Your IP address is 128.213.1.17. 128.213.1.17. IP 47
48
CS65-Computer Networks
Dept. of EEE
Important points about ICMP error messages:
• The Internet Internet Contro Controll Messa Message ge Protoc Protocol ol (ICMP (ICMP)) allows allows gateways and hosts to send network control information to each other. • ICMP ICMP provides provides feedback 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 ICMP message is constructed and then passed on to IP, which encapsulates the message with an IP header and then transmits it to the destinati on gateway or station.
49
No ICMP ICMP error error messag message e will will be genera generated ted in respon response se to a datagram carrying an ICMP error message. No ICMP ICMP error error messag message e will will be genera generated ted for a fragme fragmente nted d datagram that is not the first fragment. No ICMP error message will be generated for a datagram having a multicast multicast address. address. No ICMP error message will be generated for a datagram having a special address such as127.0.0.0 or 0.0.0.0.
50
IGMP
• ICMP also does the job of diagnosis diagnosis of some some network problems by query messages.
• The IP protocol can be involved in two types of communication: unicasting and multicasting. – Unicasting : communication between one sender and one receiver – Multicasting : communication communication between between one sender and many receiver.
• The Internet Group Management 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.
51
52
CS65-Computer Networks
Dept. of EEE
Dynamic Host Configuration Protocol (DHCP)
Here’s the protocol:
An IP address can be assigned to a workstation permanently (static
1.
assignment) or dynamically
Dynamic IP address assignment is a more efficient use of scarce IP
addresses
Request Request may include items like: like: DNS DNS servers, time servers, servers, boot boot files,
3.
Several DHCP Servers may respond with DHCPOFFER DHCPOFFER messages containing:
DHCP is used to match workstations with with an IP address. This address can
IP address, subnet mask, Rout er address, Renewal Time
be changed every time the machine boots. Allows configuration flexibility. flexibility.
4.
When a DHCP client issues an IP request, the DHCP server looks in it s
5.
static table, If no entry exists, the server selects an IP address from an
Workstation responds to one offer with DHCPREQUEST DHCPREQUEST.. DHCP Server now binds binds IP address and replies replies with DHCP DHCPACK ACK message with requested options.
available pool.
Workstation broadcasts DHCPDISCOVER DHCPDISCOVER message on power-up.
2.
•
Address assigned by the DHCP server is temporary. Part of agreement
•
hour.
Manager assigns multiple multiple ranges of IP addresses to each DHCP server and server manages distribution to clients.
includes a specific period of time. If n o time period specified, the default is one
Client Client must renew renew IP address address at regular intervals intervals indicated indicated by Renewal Time .
DHCP clients may negotiate for a renewal before the time period expires. •
The message message is is actually actually sent using using a protocol protocol called called the User Datagram Protocol (UDP) that runs over IP.
53
53
54
•
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 t his client can be included in the options field.
DHCP Packet Format
5 5 55
56 56