Вы находитесь на странице: 1из 30

CSS432 Basic Internetworking

Textbook Ch 3.2
Instructor: Joe McCarthy
(based on Prof. Fukudas slides)

CSS432: Basic Internetworking

You
are
here

CSS432: Internetworking

IP: Internet Protocol

Interconnected Collection of Networks


Bridged networks (link layer): homogenous
IP networks (network layer): heterogeneous
Viewed as a single logical network
Routers: nodes interconnecting networks

Protocol Stack
IP on all nodes (both hosts and router)
TCP and UDP on top of IP

H1
TCP

R1
IP

IP
ETH

H8

Identical packet

ETH

Identical frame

R2

Identical
datagram
FDDI

FDDI

IP

R3

Identical
datagram
PPP

PPP

IP

TCP
IP

ETH

ETH

Identical frame
CSS432: Basic Internetworking

Service Model

Global addressing

IP address (e.g., 128.95.155.134)

Best-effort delivery (unreliable service)

Connectionless (datagram-based)
Packets may be lost, reordered, duplicated, delayed
Lowest common denominator: run over anything
Simplifies routing (& routers)

IP Packet format:
Ex. Ethernet preamble

dest addr

src addr

0x0800

CRC

4
Version

8
HLen

Minimum / maximum header length?

TOS: type of service (priority queue in routers)


Length: packet length in bytes

frame type

Version: IPv4/IPv6
HLen: header length in 32-bit words

http://bpastudio.csudh.edu/fac/lpress/471/hout/netech/stackinaction.htm

16
TOS

Minimum / maximum packet size?

TTL: time to live (# hops); default: 64


Protocol: TCP, UDP
Checksum (header, 1s complement)
SourceAddr: source IP address
DestinationAddr: destination IP address
Options: optional & variable
CSS432: Basic Internetworking

31
Length

Ident
TTL

19

Flags
Protocol

Offset
Checksum

SourceAddr
DestinationAddr
Options (variable)

Pad
(variable)

Data

Fragmentation & Reassembly

Each network has some MTU


(Maximum Transmission Unit)

To check each interface of your computer (Linux/Mac OS X):

netstat i
[/sbin/]ifconfig

Strategy

Fragment / split when necessary (MTU < Datagram size)


try to avoid fragmentation at source host
Re-fragmentation is possible
Each fragment is a self-contained datagram
Where should reassembly occur?
What about lost fragments?

CSS432: Basic Internetworking

Fragmentation & Reassembly

Each physical network has its MTU


(Maximum Transmission Unit)

To check each interface of your computer (Linux/Mac OS X):

netstat i
[/sbin/]ifconfig

Strategy

Fragment / split when necessary (MTU < Datagram size)


try to avoid fragmentation at source host
Re-fragmentation is possible
Each fragment is a self-contained datagram
Reassemble at destination
Lost fragment(s) discard packet

CSS432: Basic Internetworking

Fragmentation Example
Send a 1400 byte segment from H5 to H8

MTUs:
802.11:
Ethernet:
PPP: 532 bytes
CSS432: Basic Internetworking

Fragmentation Example
Send a 1400 byte segment from H5 to H8

MTUs:
802.11: 1500 bytes
Ethernet: 1500 bytes
PPP: 532 bytes
CSS432: Basic Internetworking

Fragmentation Example
Send a 1400 byte segment from H5 to H8

376

(a)

376

(b)

MTUs:
802.11: 1500 bytes
Ethernet: 1500 bytes
PPP: 532 bytes
CSS432: Basic Internetworking

Fragmentation Example
Send a 1400 byte segment from H5 to H8

376

(a)

376

(b)

MTUs:
802.11: 1500 bytes
Ethernet: 1500 bytes
PPP: 532 bytes
CSS432: Basic Internetworking

10

Global Addresses

Properties
globally

unique
hierarchical: network + host

Dotted Decimal Notation

Class A
1.0.0.1 126.255.255.254

(0.0.0.0 0.255.255.255, 1.0.0.0, 126.255.255.255,


and 127.0.0.0 127.255.255.255 reserved)

Class B
128.0.0.1 191.255.255.254
Class C

192.0.0.1 223.255.255.254

A:

B:

C:

24

Network

Host

1 0

1 1 0

CSS432: Basic Internetworking

14

16

Network

Host

21

Network

Host

11

Datagram Forwarding

Algorithm
If ( datagrams dest network # == network # of network interface x )
deliver it to the destination host over interface x
else if ( datagrams dest network # == network # of a next hop router y )
deliver it to the router y
else
deliver it to its default router

Example

CSS432: Basic Internetworking

12

Static Configuration for


Cisco Routers
172.16.5.0/24

Eth2: 172.16.5.1

Router 2

Eth0: 172.16.1.2

172.16.3.0/24

Eth1: 172.16.3.1

Eth0: 172.16.3.2

Router 3
Eth1: 172.16.4.1

172.16.2.0/24
Eth1: 172.16.2.1
Router 1
hostname router1
Eht0: 172.16.1.1
!
interface ethernet 0
ip address 172.16.1.1 255.255.255.0
!
interface ethernet 1
ip address 172.16.2.1 255.255.255.0
!
ip route 172.16.3.0 255.255.255.0 172.16.1.2
ip route 172.16.4.0 255.255.255.0 172.16.1.2
ip route 172.16.5.0 255.255.255.0 172.16.1.2
CSS432: Basic Internetworking

172.16.4.0/24
172.16.1.0/24

13

Address Translation

Map IP addresses into physical addresses

destination host
next hop router

Techniques

encode physical address in host part of IP address

Pha = f( IPa) or IPa =f-1(Pha)

Problems

Pha: 0010 0001 0100 1001 => IPa: 128.96.33.81


Class C has only 8 bits to indicate a host
Ethernet has 48 bits to present a host address

table-based

Resolution through dynamic binding


Address Resolution Protocol (ARP)

table of IP physical address bindings


broadcast request if IP address not in table
target machine responds with its physical address
table entries are discarded if not refreshed
CSS432: Basic Internetworking

14

CSS432: Internetworking

15

ARP Details
Request (from A): Im IPa and Pha. Youre IPb. How about Phb?

IP

Ph

IP

Ph

IPa

Pha

IPb

Phb

IPb

??

Response (from B): Im IPb and Phb. Youre IPa and Pha

table entries timeout after 15


minutes
Update table with source
info when you are the target,
otherwise no need to add an
entry
update table if already have
an entry

IP

Ph

IP

Ph

IPa

Pha

IPb

Phb

IPb

Phb

IPa

Pha

CSS432: Basic Internetworking

16

ARP Packet Format

An ARP packet is carried in a frame header


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
Source/Target Physical/Protocol
addresses
frame type

Ex. Ethernet

preamble

dest addr

src addr

0x0806

CSS432: Basic Internetworking

CRC

17

RARP: Reverse Address


Resolution Protocol
Request Im Pha. Whats my IPa?

IP

Ph

??

Pha

RARP server
IP

Ph

IPa

Pha

IPb

Phb

Response Youre IPa and Pha

IP

Ph

IPa

Pha

RARP server
IP

Ph

IPa

Pha

IPb

Phb

Use RARP if a client host is


diskless workstation
Use the unique MAC address
Ask an RARP server about a client
IP
Works in the same LAN
Retransmit an RARP message
after a large delay if it has been
lost.
Prepare a primary & secondary
server.

CSS432: Basic Internetworking

18

DHCP: Dynamic Host Configuration


Protocol
Broadcast
DHCP
relay
Host

Other network

Unicast
Frame addr

DHCP
server

datagram

UDP header

IP addresses must be configured for each network


DHCP server:
Centralized repository for available IP addresses
Pre-assigned or drawn from a pool
Accessible by sending a DHCPDISCOVER message
to an IP broadcast address (255.255.255.255)
May receive a DHCPDISCOVER from a Relay agent
connected to a different network

Client:

Receives a leased IP address


May renew the lease periodically
When lease expires, IP address can be reassigned
(by DHCP server)
CSS432: Basic Internetworking

BOOTP/DHCP

OP

Htype

HLEN HOPS
Xid
Secs
Flags
Client IP addr
Your IP addr
Server IP addr
Router IP aaddr
Client Hardware addr
Server host name
Boot file name
Options

19

DHCP Client State Transition


Host boots

INITIALIZE

/ DHCPDISCOVER to all servers


SELECT

Receive DHCPOFFER
from all servers

Select offer / DHCPREQUEST to a specific server

DHCPNACK
Or
Lease expires

REBIND

DHCPNACK

Lease reaches 87.5% expiration


/ DHCPREQUEST to any server

RENEW

DHCPACK
DHCPACK
REQUEST

Lease reaches 50% expiration


/ DHCPREQUEST to the current server

Receive DHCPACK from the current server


BOUND

Fig. 23.4 on p453 of Internetworking with TCP/IP


CSS432: Internetworking

20

Two-Step bootstrap Procedure


BOOTP server
Step 1A: BOOTP request: BOOT FILE NAME=I want to boot unix

Diskless Workstation

Step 1B:
BOOTP reply: Server = mercury, BOOT FILE NAME=/local/var/bootfiles/xncd19r

Step 2A: TFTP request: request for the image

File server
Step 2B: TFTP reply: image returned

OS Image:
Unix
Windows
CSS432: Internetworking

21

Internet Control Message


Protocol

http://www.borella.net/content/MITP432/ICMP/img4.html
CSS432: Internetworking

22

ICMP Message Types


Type field

Code field ICMP Message Type

0 and 8

Echo reply/request

Destination unreachable

Redirect (change a route)

11

TTL exceeded

11

Fragment reassemble failed

CSS432: Basic Internetworking

Applications
ping

Trace route,

23

ICMP Message Header

http://nmap.org/book/tcpip-ref.html
CSS432: Internetworking

24

Internet Control Message


Protocol (ICMP)
An error reporting message (ICMP)
Error occurred
Src

R1

R2

R3

RK

Rcv

Is Src responsible for this ICMP message?


RE Mistakenly routed
ICMP type 0-18
ICMP header

ICMP data

ICMP
IP

datagram heaader

Data Link

frame header

CSS432: Internetworking

25

Reviews
IP

Internet: Protocol stack,


fragmentation/reassembly, IP address, and
datagram forwarding
Address translation: ARP, RAPR, and DHCP
ICMP

Exercises in Chapter 3
Ex.

36 (fragmentation)
Ex. 44 (ARP)
Ex. 45 (ARP)
CSS432: Basic Internetworking

26

Ex 36
36. Suppose a TCP message that contains 1024 bytes of data
and 20 bytes of TCP header is passed to IP for delivery across
two networks interconnected by a router (i.e., it travels from
the source host to a router to the destination host).
The first network has an MTU of 1024 bytes; the second has a MTU of 576 bytes.
Each networks MTU gives the size of the largest IP datagram
that can be carried in a link-layer frame.
Give the sizes and offsets of the sequence of fragments delivered to the network
layer at the destination host. Assume all IP headers are 20 bytes.

CSS432: Internetworking

27

Ex 44
44. Suppose hosts A and B have been assigned the same IP address
on the same Ethernet, on which ARP is used. B starts up after A.
What will happen to As existing connections?
Explain how self-ARP (querying the network on start-up
for ones own IP address) might help with this problem.

CSS432: Internetworking

28

Ex 45
45. Suppose an IP implementation adheres literally to the following algorithm
on receipt of a packet, P, destined for IP address D:
if ( Ethernet address for D is in ARP cache )
send P
else
send out an ARP Query for D
put P into a queue until the response comes back
(a) If the IP layer receives a burst of packets destined for D,
how might this algorithm waste resources unnecessarily?
(b) Sketch an improved version.
(c) Suppose we simply drop P, after sending out a query,
when cache lookup fails. How would this behave?
(Some early ARP implementations allegedly did this)
CSS432: Internetworking

29

More Exercises (not from our textbook)


Q1.

Consider a host that has a disk and uses DHCP to


obtain an IP address. If the host stores its address on
disk along with the data the lease expires, and then
reboots within the lease period, can it use the same
address? Why or why not?

Q2.

(DHCP)

(DHCP)

DHCP mandates a minimum address lease of one


hour. Can you imagine a situation in which DHCPs
minimum lease causes inconvenience? Explain.

CSS432: Internetworking

30

Вам также может понравиться