Sie sind auf Seite 1von 94

Internetworking

or
Network Layer

The Big Picture

You are here


2

What we understand
Concepts of networking
How computers are internconnected

Transmission, and units of communication data


How data is sent through signal
How to detect transmission errors in a frame after
encoding

Bridge/Switch approach

Next
lets different networks work
together

Ethernet

Frame Relay

FDDI

Basics of Internetworking
What is an internetwork?
Illusion of a single (direct link) network
Built on a set of distributed, heterogeneous networks

Properties
Supports heterogeneity: independent of architecture,
operating system, network type and topology
Scales to global connectivity

Internet Protocol (IP)


Network protocol for the Internet
Operates on all hosts and routers
FTP

HTTP

NV

TFTP

UDP

TCP

IP

FDDI

Ethernet

ATM
6

Internet
Concatenation of networks

H6

H7

H1
R1

Network
Network
11
Ethernet
Ethernet

Network 2
Point
-topoint

H3

H2

R3

Network
Network
33
FDDI
FDDI

R2

Network
Network
44
Ethernet
Ethernet

H5

H8

H4

Protocol stack
H1

H8

TCP

R1
IP

IP
ETH

R2

ETH

R3

IP
PPP

PPP

IP
FDDI

FDDI

TCP
IP

ETH

ETH

Global Addresses
Data link layer address
Address formats can be different in different networks
No hierarchy

Network Address
Globally unique
hierarchical

Network Addresses
Internet uses IPv4 addresses

An IPv4 address is a 32-bit address


It is globally unique
address space of IPv4 is 232 or 4,294,967,296
IPv4 are hierarchical addresses: network + host

ted-decimal Notation and Binary notation for an IPv4 ad

10

Example
Change the following IPv4 addresses from binary notation to
dotted-decimal notation.

Solution
We replace each group of 8 bits with its equivalent decimal number
and add dots for separation.

11

Example
Change the following IPv4 addresses from dotted-decimal
notation to binary notation.

Solution
We replace each decimal number with its binary
equivalent (see Appendix B).

12

Example
Find the error, if any, in the following IPv4 addresses.

221.34.7.8.20
75.45.301.14

13

IP Address allocation
IP addresses are allocated to organizations in
blocks
Three kinds of blocks are designed
Class A blocks for large organizations
Class B blocks for medium size organizations
Class C blocks for small organizations

14

ing the classes in binary and dotted-decimal not

15

IP Addresses - Class A
start with binary 0
Network addresses with first octet 00000000 are
reserved
01111111 (127) reserved for loopback
range 1.x.x.x to 126.x.x.x
all allocated

16

IP Addresses - Class B

start with binary 10


range 128.x.x.x to 191.x.x.x
second octet also included in network address
214 = 16,384 class B addresses
all allocated

17

IP Addresses - Class C

start with binary 110


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

18

Classes
Traditional 3-class model; out of 4 billion
addresses
1/2 are class A
1/4 are class B
1/8 are class C

19

Example
Find the class of each address.
a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111
Solution
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0. This is a class C
address.
c. The first byte is 14; the class is A.
d. The first byte is 252; the class is E.
20

IP Address Summary
7 bits (126 nets)
Class A:

24 bits (16 million hosts)

Network

Host

14 bits (16k nets)


Class B:

16 bits (64K hosts)

Network

Host

21 bits (2 million nets)


Class C:

Network

8 bits (256)
Host

Example IP addresses
18.10.5.22
host in class A network (MIT)
130.126.143.254 host in class B network (UIUC)
192.12.70.111
host in class C network

More recent classes


Multicast (class D): starts with 1110
Future expansions (class E): starts with 1111
21

IPv4
The Internet Protocol version 4 (IPv4) is the Network
layer protocol used in Internet.

22

IPv4 datagram format

23

Current IP Protocol Version is 4, called IPv4

4
Version

16
TOS

HLen
Identification

TTL

19

Protocol

31
Length

Flags

Fragment
Offset
IP Header Checksum

Source IP Address
Destination IP Address
Options (variable)

Pad (variable)

24

Length of IP Header in number of 32 bit words including options.


Maximum header size is 60 bytes.

4
Version

16
TOS

HLen
Identification

TTL

19

Protocol

31
Length

Flags

Fragment
Offset
IP Header Checksum

Source IP Address
Destination IP Address
Options (variable)

Pad (variable)

25

The type-of-service field (8-bit) is used to differentiate the packets


based on the services they need. (It is largely ignored in current
routers)
0

4
Version

16
TOS

HLen
Identification

TTL

19

Protocol

31
Length

Flags

Fragment
Offset
IP Header Checksum

Source IP Address
Destination IP Address
Options (variable)

Pad (variable)

26

Total length of IP datagram (including header) in bytes. It is a 16 bit field. Largest size of an IP
datagram thus is 65,535 bytes. Maximum header size is 60 bytes.

4
Version

16
TOS

HLen
Identification

TTL

19

Protocol

31
Length

Flags

Fragment
Offset
IP Header Checksum

Source IP Address
Destination IP Address
Options (variable)

Pad (variable)

27

Identification field uniquely identifies each datagram sent by a host. It is normally incremented
by one each time a host sends a datagram. Very useful for fragmentation and reassembly.

4
Version

16
TOS

HLen
Identification

TTL

19

Protocol

31
Length

Flags

Fragment
Offset
IP Header Checksum

Source IP Address
Destination IP Address
Options (variable)

Pad (variable)

28

flags field also used for fragmentation and reassembly.

4
Version

16
TOS

HLen
Identification

TTL

19

Protocol

31
Length

Flags

Fragment
Offset
IP Header Checksum

Source IP Address
Destination IP Address
Options (variable)

Pad (variable)

29

Fragmentation offset used for fragmentation and reassembly.

4
Version

16
TOS

HLen
Identification

TTL

19

Protocol

31
Length

Flags

Fragment
Offset
IP Header Checksum

Source IP Address
Destination IP Address
Options (variable)

Pad (variable)

30

Time-to-live or TTL field sets an upper limit on how many routers a datagram can go through.
Every router decrements TTL by 1 before sending it forward. If TTL reaches 0 the datagram is
dropped.

4
Version

16
TOS

HLen
Identification

TTL

19

Protocol

31
Length

Flags

Fragment
Offset
IP Header Checksum

Source IP Address
Destination IP Address
Options (variable)

Pad (variable)

31

Identifies the protocol that sent the datagram. The protocol (today) can be TCP,
UDP, ICMP, IGMP etc.

4
Version

16
TOS

HLen
Identification

TTL

19

Protocol

31
Length

Flags

Fragment
Offset
IP Header Checksum

Source IP Address
Destination IP Address
Options (variable)

Pad (variable)

32

The header checksum is calculated over the IP header only. TCP, UDP etc protect
their own data and header by a checksum.
0

4
Version

16
TOS

HLen
Identification

TTL

19

Protocol

31
Length

Flags

Fragment
Offset
IP Header Checksum

Source IP Address
Destination IP Address
Options (variable)

Pad (variable)

33

Example

34

4
Version

16
TOS

HLen
Identification

TTL

19

Protocol

31
Length

Flags

Fragment
Offset
IP Header Checksum

Source IP Address
Destination IP Address
Options (variable)

Pad (variable)

e.g.,
record route (each router on the way adds its address),
time stamp (each router on the way adds its address and time stamp),
loose source routing, strict source routing.
35

4
Version

16
TOS

HLen
Identification

TTL

19

Protocol

31
Length

Flags

Fragment
Offset
IP Header Checksum

Source IP Address
Destination IP Address
Options (variable)

Pad (variable)

Options field always ends at a 32 bit boundary. Padding


added as needed.

36

Example
An IPv4 packet has arrived with the first 8 bits as shown:
01000010
The receiver discards the packet. Why?
Solution
Thereisanerrorinthispacket.The4leftmostbits(0100)
showtheversion,whichiscorrect.Thenext4bits(0010)
showaninvalidheaderlength(24=8).Theminimum
numberofbytesintheheadermustbe20.Thepackethas
beencorruptedintransmission.
37

Example
In an IPv4 packet, the value of HLEN is 1000 in binary.
How many bytes of options are being carried by this
packet?
Solution
The HLEN value is 8, which means the total number of
bytesintheheaderis84,or32bytes.Thefirst20bytes
arethebaseheader,thenext12bytesaretheoptions.

38

Maximum transfer unit (MTU)

MTUs for some networks

1,500
39

Fragmentation and
Re-assembly
Different networks specify different max packet
size (MTU: max transmission unit)
Thus routers may need to fragment incoming datagram
into smaller pieces, called segment or fragments

Supposed MTUs:
Ethernet: 1500

IP Header Size = 20 bytes

FDDI: 4500

PPP: 532

40

Re-assembly
Issue of when to re-assemble
At intermediate nodes
need large buffers at routers
buffers may fill with fragments
all fragments must go through same router
may have to fragment again

At destination

41

IP Fragmentation
IP re-assembles at destination
only
uses fields in header
Data Unit Identifier (ID)
identifies original datagram
Data length
length of user data in octets
(bytes)
Offset
position of fragment of user
data in original datagram
in multiples of 64 bits (8
octets)
More flag
indicates that this is not the
last fragment
42

IP Fragmentation Example

43

Datagram Lifetime
Datagrams could loop indefinitely especially in
dynamic routing
consumes resources

Solution
Place upper bound on lifetime of a datagram

How?
Time To Live (TTL) field in IP
when lifetime expires, datagram discarded
simplest is hop count
44

How IP packets are forwarded?

Router

Packets are forwarded using routers


Router connects different networks
Its a Layer 3 (Network layer) device
Forwarding is based on IP addresses not on MAC
addresses
It uses a routing table to forward the packet towards the
destination

46

Routing Table
What information is stored in routing table??

47

Routing Table
Luckily we just need to have the entries for the
Networks in the routing table
thanks to the hierarchy in IP addresses

So instead of storing 4.2 billion (4,294,967,296)


entries, we will just store 2.1 million (2,113,662)
network entries

48

Datagram Forwarding
Every datagram contains destinations address
Network portion of address is compared with
pairs in the forwarding table
If directly connected to destination network, then
forward to host
If not directly connected to destination network,
then forward to some (default) router
49

Delivery

50

next-hop method

51

Routing Table
As there are around 2 million networks in the
world, looking them up every time a packet comes
in, can be very hectic
We can simplify it more by the use of default
entry in the routing table

52

Default method

53

An Example

a simple internet

54

Address Translation
Translate IP addresses to physical (link-layer /
subnetwork) addresses

55

Network layer
- example -

Network layer addresses


Data Link layer addresses

56

Address Resolution Protocol (ARP)


ARP table/cache
IP to physical address bindings
Stored on each host

To send a packet, check table for physical address


If IP address not in table
Broadcast a query (ARP request)
Wait for response

When query seen by target host


Creates table entry for requester if necessary
Responds with translation (its physical address)
57

ARP Details
Table entries are discarded if not refreshed ( more
on it after one slide)
ARP packet format
HardwareType: type of physical network (e.g. ethernet)
ProtocolType: type of higher layer protocol (e.g., IP)
HLEN & PLEN: length of physical and protocol
addresses
Operation: request or response
Addresses
58

ARP Packet Format


0

16

Hardware type = 1
HLen = 48

PLen = 32

31
Protocol

Type = 0x0800

Operation (Req 1, Rep 2

SourceHardwareAddr (bytes 0

3)

SourceHardwareAddr (bytes 4

5) SourceProtocolAddr (bytes 0

1)

SourceProtocolAddr (bytes 2

3) TargetHardwareAddr (bytes 0

1)

TargetHardwareAddr (bytes 2
TargetProtocolAddr (bytes 0

5)
3)

59

ARP travelleing on an Ethernet

60

ARP caching time / reachable time


Windows 7 and above
Min reachable time 15 sec
Max reachable time 45 sec

To check the current refresh time, use following


commands
netsh interface ipv4 show interfaces
To check the interface numbers
netsh interface ipv4 show interface 9
To show reachable time value on interface 9
61

Example

62

Routing Protocols

63

Routing Protocols
A routing table can be either static or dynamic.
A static table is one with manual entries.
A dynamic table is one that is updated automatically
when there is a change somewhere in the Internet.

A routing protocol is a combination of rules and


procedures that lets routers in the Internet inform
each other of changes.

64

Routing Information Protocol


(RIP)

65

RIP
Routing Table
Destination
Next Node/hop
Distance or Cost

dest next

dist

Table updation
Neighbors exchange table
entries
Determine current best next
hop based on distance
Directly connected network
has a cost of 1

Inform neighbors
Periodically
After changes

66

xample of a Domain using RIP

67

Note

In distance vector routing, each node


shares its routing table with its
immediate neighbors periodically and
when there is a change.

68

Routing Information Protocol (RIP)


Max limited to 15
suitable for small networks (local area environments)
value of 16 is reserved to represent infinity
small number limits the count-to-infinity problem

69

RIP Operation
Router sends update message to neighbors every 30 sec
A router expects to receive an update message from each of its
neighbors within 180 seconds in the worst case
If router does not receive update message from neighbor X
within this limit, it assumes the link to X has failed and sets the
corresponding minimum cost to 16 (infinity)
Uses split horizon
Convergence speeded up by triggered updates
neighbors notified immediately of changes in distance vector
table

70

IP Address wastage
Inefficient address allocation (by class system)
Class A is too large for almost any organization
Class B is also too large for majority of the organizations
Class C is too small for many organizations

Questions
What network(s) should you allocate to a company with 1000
machines ?
What about a company with 200 machines ?
What about a company with 2 machines that plans to grow rapidly ?

71

IP Address wastage
Pressure primarily on class B networks
Most companies plan to grow beyond 255 machines
Renumbering is a hassle and can interrupt service
Only around 16,000 class B networks available (14 bits)

Class B networks arent very efficient


Few organizations have ~10,000 machines
More likely a network uses ~1,000 out of 65,000 addresses

Scaling problems with alternatives


Multiple table entries if class C networks used instead
Routing protocols do not scale beyond 10,000 networks
72

Solutions / IPv4 enhancements


Classless adressing
NAT/NAPT

73

NetID and HostID


IP address = Netid + Hostid
Number of bits used for Netid can be found by finding the
class of IP address
OR
Using mask (The network bits are represented by the 1s in the mask, and
the host bits are represented by the 0s )

74

Example
A mask allows you to identify the network and
host parts of the address

75

Classless Addressing
(Supernetting, Subnetting)

Example
Suppose an organization needs 1000 IP addresses
It has two options
Purchase a class B address
Or purchase 4 class C addressess

Suppose it goes for the second option


How many entries other routers will need to keep
in order to reach to this network????
Supernetting allows us to represent such a network
77
with one single NetworkID

Supernetting
Several networks are combined to form a supernet
Internet part
Network ID

Host ID

11000000 11100110 00010100 00000000


11000000 11100110 00010101 00000000
11000000 11100110 00010110 00000000
11000000 11100110 00010111 00000000
4 Class C IP network

78

Supernet : an example
Four class C networks were put together to form the supernet:
192.230.80. 0
11000000 11100110 01010000 00000000
192.230.81. 0
192.230.82. 0
192.230.83. 0

11000000 11100110 01010001 00000000


11000000 11100110 01010010 00000000
11000000 11100110 01010011 00000000

This network is now known in the world with 192.230.80.0 / 22


or 192.230.80.0 with subnet mask of 255.255.252.0

79

Supernetting: Another example


Example: 200.158.16.0/20
IP Address (200.158.16.0) & mask length (20)
IP add = 11001000 10011110 00010000 00000000
Mask = 11111111 11111111

11110000 00000000

Contains 16 Class C blocks:


From
11001000 10011110 00010000 00000000
i.e. 200.158.16.0
Up to
11001000 10011110 00011111 00000000
i.e. 200.158.31.0
80

Restrictions
To simplify the handling of addresses, the Internet
authorities impose some restrictions on classless
address blocks:
The addresses in a block must be contiguous, one after
another
The number of addresses in a block must be a power of
2 (1, 2, 4, 8, ... )
The first address must be evenly divisible by the
number of addresses
81

Subnetting
Subnet addressing allows the division of large block into
smaller blocks
Example:
An ISP is assigned a class B network.
Subnetting allows it to divide the class B network into smaller
networks to be issued to its clients

Original
address

1 0

Net ID

Subnetted
address

1 0

Net ID

Host ID

Subnet ID

Host ID

82

Subnetting
For example, a company is assigned with the class-C address
201.222.5.0
If 20 subnets are needed and each subnet is accessed with five
computers, how can the subnet be divided?
255.255.255.0

201.222.5.8
255.255.255.248

201.222.5.0
201.222.5.16
255.255.255.248
201.222.5.24
255.255.255.248
201.222.5.32
255.255.255.248

201.222.5.9
255.255.255.248
201.222.5.17
255.255.255.248
201.222.5.25
255.255.255.248
201.222.5.33
255.255.255.248
83

Example

In this example a 3 bit subnet mask is used


There are 23 = 8 subnets available with this size mask
Find out the remaining subnets
subnets with all 0's and all 1's are not used generally

Each subnet has 8190 (213-2) nodes


84

Variable length Subnetting Example


An ISP is granted a block of addresses starting with 190.100.0.0/16
(65,536 addresses). The ISP needs to distribute these addresses to
three types of organizations as follows:
a. 64 organizations; each needs 256 addresses.
b. 128 organizations; each needs 128 addresses.
c. 128 organizations; each needs 64 addresses.
Create the subnets and find out how many addresses are still
available after these allocations.

First confirm, if the requirement is


within the limit.
85

Example (continued)
Solution
Group 1
For this group, each organization needs 256 addresses. This
means that 8 bits are needed for host part. The prefix
length is then 32 8 = 24. The addresses are

86

Example (continued)
Group 2
For this group, each organization needs 128 addresses. This
means that 7 (log2 128) bits are needed for host part. The
prefix length is then 32 7 = 25. The addresses are

87

Example (continued)
Group 3
For this group, each organization needs 64 addresses. This
means that 6 (log264) bits are needed for host part. The
prefix length is then 32 6 = 26. The addresses are

Number of granted addresses to the ISP: 65,536


Number of allocated addresses by the ISP: 40,960
Number of available addresses: 24,576
88

Summary

89

Forwarding in Classless addressing


scenario
CIDR

90

Example
Make a routing table for router R1, using the configuration
in Figure below.
Solution

91

Example
Show the forwarding process if a packet arrives at R1 in Figure on
last slide with the destination address 180.70.65.140.
Solution
The router performs the following steps:
1. The first mask (/26) is applied to the destination address. The result
is 180.70.65.128, which does not match the corresponding network
address.
2. The second mask (/25) is applied to the destination address. The
result is 180.70.65.128, which matches the corresponding network
address. The next-hop address and the interface number m0 are
passed to ARP for further processing.
92

Address aggregation

93

Datagram Forwarding
Network #

Netmask

Next hop/ port

18.0.0.0
255.0.0.0
1
128.32.0.0
255.255.0.0
0.0.0.0
0.0.0.0
3
dest: 18.26.10.0

mask with 255.0.0.0

matched! send to port 1

dest: 128.16.14.0 mask with 255.0.0.0 not matched


mask with 255.255.0.0 not matched
matched! send to port 3
mask with 0.0.0.0
94

Das könnte Ihnen auch gefallen