Sunteți pe pagina 1din 38

IT 605

Computer Networks

Network Layer Addressing

Prof . Anirudha Sahoo


KReSIT
IIT Bombay

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.1


Addressing
Network layer

• Need:
– Hide type of subnet
– Ethernet, Token Ring, FDDI ...
– Hide topology of subnets
• Provides:
– Uniform addressing
– Packet delivery
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.2
Addressing
IP characteristics
• IP can run on
– Ethernet (CSMA/CD)
– FDDI (token ring)
– telephone trunks (SONET or PDH)
– wireless links (CSMA/CA)
– satellite links (ALOHA)
– other technologies like X.25, ISDN
• underlying technology can be upgraded
without affecting TCP/IP

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.3


Addressing
Network layer functions

• Internetworking
– uniform addressing scheme
• Routing
– choice of appropriate paths from
source to destination

• Congestion Control
– avoid overload on links/routers
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.4
Addressing
Addressing

– unicast: node-specific
– broadcast: all nodes on a
network
– multicast: some subset of nodes
on the network

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.5


Addressing
Addressing
• Addresses need to be globally
unique, so they are hierarchical
• Another reason for hierarchy:
aggregation
– reduces size of routing tables
– at the expense of longer routes

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.6


Addressing
IP addressing

• Internet Protocol (IP)


– connectionless packet delivery and
“best-effort” quality of service
• Every host interface has its own IP
address
• Routers have multiple interfaces,
each with its own IP address

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.7


Addressing
IP addressing example

223.1.1.1 223.1.2.1

223.1.1.4 223.1.2.9
223.1.1.2

223.1.2.2
223.1.1.3
11011111 00000001 00000001 00000001
223 1 1 1
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.8
Addressing
IPv4 addresses

• Logical address at network layer


• 32 bit address space
– Network number, Host number
– boundary identified by a subnet mask
– can aggregate addresses within
subnets
• Machines on the same "network" have
same network number
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.9
Addressing
IP address notation

• Dotted decimal notation


– 144.16.111.2 (Class B)
– 202.54.44.120 (Class C)
– Special Conventions
• All 0s -- this host
• All 1s -- limited broadcast

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.10


Addressing
Address classes

• Class A addresses - 8 bits


network number
• Class B addresses - 16 bits
network number
• Class C addresses - 24 bits
network number

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.11


Addressing
Address classes

• Distinguished by leading bits of


address
– leading 0 => class A (first byte <
128)
– leading 10 => class B (first byte in
the range 128-191)
– leading 110 => class C (first byte
in the range 192-223)
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.12
Addressing
IP addresses
class
1.0.0.0 to
A 0 network host 127.255.255.255

128.0.0.0 to
B 10 network host 191.255.255.255

192.0.0.0 to
C 110 network host 239.255.255.255

240.0.0.0 to
D 1110 multicast address 247.255.255.255

32 bits
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.13
Addressing
IP address issues
• Inefficient: wasted addresses
• Inflexible: fixed interpretation
• Not scalable:
– Number of networks is growing
– Not enough network numbers

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.14


Addressing
IP addressing schemes

• Sub-netting: Create sub networks


within an address space
• CIDR: Variable interpretations for
the network number
• DHCP: Dynamic host
configuration
• Ipv6: 128 bit address space
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.15
Addressing
Sub-netting
• Breaks larger network to many smaller
networks
• Reduces the broadcast domain (hence
network traffic within a subnet)
• Simplifies network management
(smaller network => simpler
management)
• To create subnetwork bits from the
host portion of the IP address is taken
and used to define subnets.
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.16
Addressing
Subnet mask
• For subnet scheme to work, every
machine on the network must know
which part of the host address will be
used as subnet mask.
– Accomplished by assigning subnet
mask to each machine
• When no subnetting : use default
subnet mask e.g.
– Class A : 255.0.0.0
– Class B : 255.255.0.0
– Class
Prof . Aniruddha sahoo, C : 255.255.255.0
KReSIT, IIT Bombay Network Layer 6.17
Addressing
Subnetting class C address
• Only 8 bits are available for hosts :
possible subnet masks are:
– 10000000 = 128
– 11000000 = 192
– 11100000 = 224
– 11110000 = 240
– 11111000 = 248
– 11111100 = 252
– 11111110 = 254
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.18
Addressing
Subnetting class C address
• Cannot have only 1 bit for subnetting
(as per RFC)
• Also need at least 2 bits for hosts
(with 1 bit, you cannot have a valid
host address, since the bit will be
used up for network id and broadcast
id)
• Hence only valid subnet masks are
from 192 to 252.
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.19
• Subnet id cannot be Addressing all zero or all
Subnetting class C address
• Example Subnet id 01000000 (64)
• The subnet id : 01000000 = 64
• First valid host id : 01000001 = 65
• Last valid host id : 01111110 = 126
• Broadcast address : 01111111 = 127

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.20


Addressing
Classless Inter Domain
Routing (CIDR)

• Medium sized networks choose


class B addresses, leading to
wasted space
– allow ways to represent a set of
class C addresses as a block, so
that class C space can be used
– use a CIDR mask
• RFC 1518 and 1519
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.21
Addressing
CIDR

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.22


Addressing
IP header

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.23


Addressing
IP header

• Source and Destination IP


addresses of 4 bytes each
• Version number: IPv4, next IPv6
• IHL: header length, can be max.
60 bytes.
• 20 byte fixed part and a variable
length optional part
• Total length: max. 65 535 bytes
presently (header + data)
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.24
Addressing
IP header
• Type of Service (ToS): to be used
for providing quality of service
• TTL (Time to Live): reduced by one
at each router. Packet is dropped
at the router which decrements
TTL to 0. Prevents indefinite
looping
• Checksum: over header, NOT data
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.25
Addressing
IP header

• Protocol: 1=ICMP, 6=TCP, 17=UDP


– RFC 1700 for well known protocols
• Identification, 3-bit flags and
fragment offset (4 bytes) fields used
for fragmentation and reassembly of
packets
– DF: “Don’t fragment” bit.
– MF: More fragments bit.
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.26
Addressing
IP forwarding at a Host
• Destination on my net?
• If yes,
– use ARP and deliver directly
• If not,
– give to default gateway

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.27


Addressing
IP forwarding at a Gateway
• Am I the destination IP?
• If yes,
– deliver packet to higher layer
• If not,
– which interface to forward on?
– consult Routing Tables to decide

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.28


Addressing
ICMP (Internet Control
Message)
• Unexpected events are reported to
the source by routers, using ICMP
• ICMP messages are of two types:
query, error
• ICMP messages are transmitted by IP
datagrams (layered above IP)
• ICMP messages, if lost, are not
retransmitted

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.29


Addressing
Example ICMP messages
• “destination unreachable” (type 3)
– can’t find destination network or
protocol
• “time exceeded” (type 11)
– expired lifetime (TTL reaches 0):
symptom of loops or congestion . . .

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.30


Addressing
Example ICMP messages

• redirect
– advice sending host of a better
route
• echo request,echo-reply (query)
– testing if destination is reachable
and alive
• timestamp request, timestamp-
reply
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.31
– sampling delay characteristics Addressing
ICMP header

• 8-byte header
8-bit type 8-bit code 16-bit checksum

(contents depend on type and code)

• 15 values for the type field


identify the particular ICMP
message
• Code values are then used to
further
Prof . Aniruddha sahoo, KReSIT,specify
IIT Bombay the error
Network Layer 6.32
Addressing
ICMP types
Type Code description
0 0 echo reply (ping)
3 0 dest. network unreachable
3 1 dest host unreachable
3 2 dest protocol unreachable
3 3 dest port unreachable
3 6 dest network unknown
3 7 dest host unknown
4 0 source quench
8 0 echo request (ping)
9 0 route advertisement
10 0 router discovery
11 0 TTL expired
12 0 bad IP header
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.33
Addressing
MTU: maximum
transmission unit

• Maximum packet size usable for an IP packet


– Ethernet = 1500
– FDDI = 4352
– X.25 = 576
– Frame Relay = 1600 or more
– ATM with AAL5 = 9180
– Hyper channel (bet. CPU and disk) 65535
– PPP = 296 to 1500

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.34


Addressing
Path MTU discovery
1. Source sets DF bit on a large
datagram to estimate Path MTU
2. When MTU exceeds that of any link,
corresponding router sends an ICMP
“Destination Unreachable”
3. Source reduces path MTU estimate to
smaller value

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.35


Addressing
IP fragmentation &
reassembly
length ID fragflag offset
=4000 =x =0 =0

One large datagram becomes


several smaller datagrams

length ID fragflag offset


=1500 =x =1 =0

length ID fragflag offset


=1500 =x =1 =1480

length ID fragflag offset


=1040 =x =0 =2960

Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.36


Addressing
Ping
• Used to test
– destination reachability
– compute round trip time
– count the # of hops to destination
– Sample output:

Reply from 164.107.144.3: 48 bytes


in 47 msec. TTL: 253
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.37
Addressing
Traceroute

• Exploit TTL and ICMP


– Send the packet with time-to-live =
1 (hop)
– The first router discards the packet
and sends an ICMP “time-to-live
exceeded message”
– Send the packet with time-to-live =
2 (hops) etc…
Prof . Aniruddha sahoo, KReSIT, IIT Bombay Network Layer 6.38
Addressing

S-ar putea să vă placă și