Você está na página 1de 14

CS65-Computer Networks Dept.

of EEE

Addressing

• 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
1 2

..contd
..contd
• Internet Address – IP Address The difference between classful IP
– Classful addressing – original architecture addressing and classless IP addressing
• Class A, B, C, D, and E
– Classless addressing – introduced during mid
• is in selecting the number of bits used for the
1990s
network ID portion of an IP address. In classful
• IPv4
IP addressing, the network ID portion can take
– 32-bit binary number
only the predefined number of bits 8, 16, or 24.
In classless addressing, any number of bits
can be assigned to the network ID.
– Dotted-Decimal Notation
128.11.3.31
255.255.255.0
• IPv6 - 128-bit
3 4

Prepared by S.Muralidharan 1
CS65-Computer Networks Dept. of EEE

..contd
..contd .. contd

• Classes : – Class B provides two byte hostid field


– Classes are designed to cover the needs of – Class C provide one byte hostid field.
different types of organizations. – Class D is reserved for “multicast address”.
– For eg. Class A use only one byte to Multicasting allows copies of a datagram to
identify class type and netid, and leave be passed to a select group of hosts rather
three bytes for host id. Which means this than to an individual host.
type of class can accommodate more hosts – Class E is reserved for future use.
than any other class.

5 6

Addressing – IPV4
Netid and Hostid • 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

Prepared by S.Muralidharan 2
CS65-Computer Networks Dept. of EEE

Finding the Class Number of blocks and block size in classful


IPv4 addressing

9 10

IP Addresses - Class A Classes and Blocks - Netid 73


128 Blocks; 16,777,216 Hosts
• 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

11 12

Prepared by S.Muralidharan 3
CS65-Computer Networks Dept. of EEE

IP Addresses - Class B Classes and Blocks - Netid 180


180..8
16384 Blocks; 65536 Hosts
• 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.

13 14

IP Addresses - Class C Classes and Blocks - Netid 200.11.8


2,097,152 Blocks; 255 Hosts
• 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)

15 16

Prepared by S.Muralidharan 4
CS65-Computer Networks Dept. of EEE

Sample Internet Class B

• An address defines a network with all host-id = 0


Class C
Class C

Class A

17 18

Problems with Classes SUBNETTING


• Earlier classes give only 2 levels of topology
• Class A usually to big ie. netid and hostid
• Class C often to small
• Not enough Class Bs
• Inefficient utilisation of address space
• Solution: extending the network part of
the address: Subnetting

19 20

Prepared by S.Muralidharan 5
CS65-Computer Networks Dept. of EEE

• Helps to achieve 3 levels of topology. Subnetting – 3 Level Hierarchy


• Three levels: Site, Subnet, Host

21 22

…contd
router
• An organization can subdivide it’s host address
space into groups called subnets.
• The subnet ID is generally used to group hosts Subnet 1 Subnet 2 Subnet 3
based on the physical network topology. 128.213.1.x 128.213.2.x 128.213.3.x
• Subnet masks define variable partition of host
part
• Subnets visible only within site

23 24

Prepared by S.Muralidharan 6
CS65-Computer Networks Dept. of EEE

An Institutional network

mail server
to external
network
router web server

switch
IP subnet

hub
hub hub

25 26

• Example: Take host address 213.23.47.37


and subnet mask 255.255.255.240 and
Take a network address and break it
Network number Host number up into subnets that can be assigned compute the subnet number.
to individual physical networks.
Class B address
Define a subnet mask to help create IP address 213. 23. 47. 37
111111111111111111111111 00000000
a new level of hierarchy in the Mask 255. 255. 255. 240
Subnet mask (255.255.255.0) addressing scheme.
-----------------------------------
The bitwise AND of the subnet mask
Network number Subnet ID Host ID 213. 23. 47. 32
with the full address gives the subnet
Subnetted address number.
37 0 0 1 0 0 1 0 1 AND operation
.
240 1 1 1 1 0 0 0 0
----------------------------
32 0 0 1 0 0 0 0 0
27 28

Prepared by S.Muralidharan 7
CS65-Computer Networks Dept. of EEE

27 26 25 24 23 22 21 20
A Network With and Without
128 64 32 16 8 4 2 1
Subnetting
140.192.56.45

140 192 56 45
IP Address
1 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 1 0 1 1 0 1
Network Subnet Host
255 255 255 0
NetMask
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0

140 192 56 0
Network Address
1 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0

140.192.56.0/24
24-bit mask
8-bit subnet mask

140.192.56.45
140 192 56 45
IP Address
1 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 1 0 1 1 0 1
Network Subnet Host
255 255 240 0
NetMask
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0

140 192 48 0
Network Address
1 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0

140.192.48.0/20
20-bit mask
4-bit subnet mask

29 30

Fine Points on Subnetting Subnets and Subnet Masks


• The subnet mask does not need to align on • Allow arbitrary complexity of internetworked
byte boundaries. (You don’t even have to have LANs within organization
contiguous 1’s, although that is not • Insulate overall internet from growth of
recommended.) network numbers and routing complexity
• It is possible to put multiple subnets on the • Site looks to rest of internet like single network
same physical network, but hosts on the same • Each LAN assigned subnet number
physical network may then have to go through
• Host portion of address partitioned into subnet
a router to talk to each other.
number and host number
• From outside the subnetted domain, the whole
• Local routers route within subnetted network
thing is viewed as a single network. For this
reason, subnets should be kept geographically • Subnet mask indicates which bits are subnet
close. number and which are host number
31 32

Prepared by S.Muralidharan 8
CS65-Computer Networks Dept. of EEE

Default masks for classful addressing

• 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.

33 34

Address Resolution Protocol (ARP) ..contd


..contd
• Why ARP? • The Address Resolution Protocol is used
by a sending host when it knows the IP
– When an IP packet has traversed the Internet and address of the destination but needs the
encounters the destination LAN, how does the packet Ethernet address.
find the destination workstation?
• ARP is a broadcast protocol - every host on
• Even though the destination workstation may have an IP the network receives the request.
address, a LAN does not use IP addresses to deliver frames
• Each host checks the request against it’s IP
• A LAN uses the MAC layer address address - the right one responds
• ARP translates an IP address into a MAC layer address so a • ARP does not need to be done every time an
frame can be delivered to the proper workstation IP datagram is sent - hosts remember the
hardware addresses of each other.
35 36

Prepared by S.Muralidharan 9
CS65-Computer Networks Dept. of EEE

Address Resolution Table


• Each host maintains its own address resolution table
• Part of the ARP protocol specifies that the • Each entry correlates between IP address and MAC
receiving host should also remember the IP address
and hardware addresses of the sending host. • In an entry there is a field that marks the way the entry
was created (Static or Dynamic)
• Each IP node (Host, Router) on LAN has ARP
Example:
table. ARP Table has IP/MAC address
mappings for some LAN nodes like as follows : IP Address MAC Address Type TTL

< IP address; MAC address; TTL> 1.1.24.1 00:30:7b:91:bd:6c Dynamic 8:00


– TTL (Time To Live): time after which
1.1.24.65 00:60:e1:00:9c:70 Static ---
address mapping will be forgotten (typically
20 min) 1.1.24.223 00:60:e1:00:07:91 Dynamic 8:03
37 38

ARP operation
• ‘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
39 40

Prepared by S.Muralidharan 10
CS65-Computer Networks Dept. of EEE

How ARP is used in Routing to another


ARP LAN
walkthrough: send datagram from A to B via R
HEY - Everyone please listen! Will 128.213.1.5 please send assume A know’s B IP address
me his/her Ethernet address

R
not me B

Hi Red! I’m 128.213.1.5, and my Ethernet address is


• Two ARP tables in router R, one for each IP network (LAN)
87:A2:15:35:02:C3 • 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
41 42

• A creates datagram with source A, destination B ARP FRAME FORMAT


• A uses ARP to get R’s MAC address for 111.111.111.110 The 2-byte Hardware
Hardware--Type field gives the type of the hardware address we are interested in (e.g.,
1 for Ethernet).
• A creates link-layer frame with R's MAC address as dest, frame
The 2-byte Protocol
Protocol--Type field gives the type of the higher level protocol address we are
contains A-to-B IP datagram interested in (e.g., 0x0800 for IP). Note, it is two bytes long, just like the Ethernet type field.
• A’s adapter sends frame A 1-byte Hardware
Hardware--Length field specifying the length of the hardware address (6 bytes would be
• R’s adapter receives frame the length for Ethernet).

• R removes IP datagram from Ethernet frame, sees its destined A 1-byte Protocol
Protocol--Length field specifying the length of the target protocol address (4 for IP).
to B A 16-bit Operation Code field specifying the operation desired (e.g., 1 for REQUEST or 0 for
RESPONSE).
• R uses ARP to get B’s MAC address
The sender's Ethernet address (Sender
• R creates frame containing A-to-B IP datagram sends to B Hardware Address) (if known).

The sender's Internet address (Sender


A Protocol Address) (if known).

The target's Ethernet address (Target


Hardware Address) (filled in response).

R The target's Internet address (Target


B Protocol Address) (filled in response).

43 44

Prepared by S.Muralidharan 11
CS65-Computer Networks Dept. of EEE

RARP
ARP Details

• Conceptually, ARP consists of two parts: the software responsible


• The process of finding out the IP address of a
for finding the physical address of an IP address (e.g., a client), and host given a hardware address is called
the software responsible for answering ARP requests from other
machines (e.g., a server). Reverse Address Resolution
• When sending an IP datagram, the sender searches its local ARP • Reverse address resolution is needed by
cache for the desired target address. If found, ARP is done. diskless workstations when booting.
• If not found, send out a broadcast ARP request and wait for the
response.

• In practice, waiting for a response is somewhat tricky, because the


target machine may be down, the request might become lost and
need to be retransmitted, and so forth.

45 46

RARP INTERNET CONTROL MESSAGE PROTOCOL


• “Internet Control Message Protocol (ICMP)” which is a
HEY - Everyone please listen! required companion to IP.
My Ethernet address is22:BC:66:17:01:75.
Does anyone know my IP address ? • 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 IP
modules must support the ICMP protocol.

Transport
TCP/UDP
not me
ICMP
Hi Red ! Your IP address is 128.213.1.17.
IP
47 48

Prepared by S.Muralidharan 12
CS65-Computer Networks Dept. of EEE

Important points about ICMP error messages:


• The Internet Control Message Protocol (ICMP) allows
gateways and hosts to send network control information No ICMP error message will be generated in response to a
to each other. datagram carrying an ICMP error message.
No ICMP error message will be generated for a fragmented
• ICMP provides feedback about : datagram that is not the first fragment.
– When a datagram cannot reach its destination No ICMP error message will be generated for a datagram having a
multicast address.
– When the gateway’s buffer overflows No ICMP error message will be generated for a datagram having a
– When the gateway can direct the station to send special address such as127.0.0.0 or 0.0.0.0.
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.

49 50

• ICMP also does the job of diagnosis of some IGMP


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 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.

51 52

Prepared by S.Muralidharan 13
CS65-Computer Networks Dept. of EEE

Dynamic Host Configuration Protocol (DHCP)


An IP address can be assigned to a workstation permanently (static Here’s the protocol:
assignment) or dynamically 1. Workstation broadcasts DHCPDISCOVER message on power-up.
Dynamic IP address assignment is a more efficient use of scarce IP 2. Request may include items like: DNS servers, time servers, boot files,
addresses 3. Several DHCP Servers may respond with DHCPOFFER messages
DHCP is used to match workstations with an IP address. This address can containing:
be changed every time the machine boots. Allows configuration flexibility. IP address, subnet mask, Router address, Renewal Time
When a DHCP client issues an IP request, the DHCP server looks in its 4. Workstation responds to one offer with DHCPREQUEST.
static table, If no entry exists, the server selects an IP address from an 5. DHCP Server now binds IP address and replies with DHCPACK
available pool. message with requested options.
Address assigned by the DHCP server is temporary. Part of agreement • Manager assigns multiple ranges of IP addresses to each DHCP
includes a specific period of time. If no time period specified, the default is one server and server manages distribution to clients.
hour. • Client must renew IP address at regular intervals indicated by
DHCP clients may negotiate for a renewal before the time period expires. Renewal Time.
• The message is actually sent using a protocol 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 this client can be included in
the options field.

DHCP Packet Format

55 56

Prepared by S.Muralidharan 14

Você também pode gostar