Chp. 4, Part II - comp
Download
Report
Transcript Chp. 4, Part II - comp
Chapter 4: Internetworking
(Internet Protocol)
Dr. Rocky K. C. Chang
16 March 2004
1
1. The IP technology (except routing)
•
•
•
•
•
•
•
•
IP service model
IP protocol family
IP datagram structure
IP datagram fragmentation and reassembly
IP subnets
IP forwarding mechanisms
IP tunnels
Other IP layer protocols
2
2. The IP service model
• The IP service model consists of
– an addressing scheme to identify an IP host, and
– a datagram (connectionless) model of data delivery.
• IP provides a best-effort service.
– IP makes its best effort to send a datagram to its
destination.
– The best-effort service does not guarantee reliable
datagram delivery, i.e., an unreliable service.
3
3. Internet protocol suite (incomplete)
Application
FTP
Ping
DNS
HTTP
NV
TFTP
RTP
SSL
Transport
Network
UDP
TCP
ICMP
IGMP
IP
ARP & RARP
Data-link
NET1
NET2
…
NETn
4
4. IP datagram
0
4
Version
8
HLen
16
TOS
31
Length
Ident
TTL
19
Flags
Protocol
Offset
Checksum
SourceAddr
DestinationAddr
Options (variable)
Pad
(variable)
Data
5
4. IP datagram
• Version: 4 for the current IP.
• Type of service (TOS) for specifying how a
router should handle this datagram.
• Header length handles a variable-length header.
– 20-byte IP header without IP options
• A 16-bit length limits the size of an IP datagram
to 65,535 bytes, including the IP header.
• Identification, flags, and offset are used for
packet fragmentation and reassembly.
6
4. IP datagram
• Time to live (TTL) limits the the number of
times that a datagram processed by routers.
• Protocol specifies the type of payload, e.g., 6
for TCP and 17 for UDP.
• Checksum is a 16-bit word checksum.
• IP options, e.g.,
– Source routing
– Record route
7
5. MTU and packet fragmentation
• Each network chooses a maximum packet size
that can be sent on it, Maximum Transmission
Unit (MTU). For example,
– 1500 bytes for 10-Mbps Ethernet
– 4352 bytes for FDDI
– 17914 bytes for 16-Mbps token ring
• Note that all MTUs are smaller than IP
datagram’s maximum size.
• One internetworking problem is to
accommodate various MTU values.
8
5. MTU and packet fragmentation
• To send datagrams to a directly attached host,
use the network’s MTU.
• To send datagrams to a nondirectly attached
host, use the path MTU.
– Path MTU is the minimum of the networks’ MTUs
on the path from the source to destination.
• If the actual MTU used is larger than the path
MTU, packet fragmentation occurs.
– Fragmentation occurs when a router attempts to
forward it to a network with a smaller MTU.
9
5. MTU and packet fragmentation
H1
ETH IP (1400)
R1
R2
FDDI IP (1400)
R3
H8
PPP IP (512)
ETH IP (512)
PPP IP (512)
ETH IP (512)
PPP IP (376)
ETH IP (376)
10
Start of header
Ident = x
(a)
0
Offset = 0
Rest of header
1400 data bytes
Start of header
Ident = x
(b)
1
Offset = 0
Rest of header
512 data bytes
Start of header
Ident = x
1
Offset = 512
Rest of header
512 data bytes
Start of header
Ident = x
0 Offset = 1024
Rest of header
376 data bytes
11
5. MTU and packet fragmentation
• Each IP fragment contains enough information
for forwarding to the destination.
• A fragmented IP datagram will be reassembled
only at the destination node.
• If any fragments do not arrive within a certain
time, other received fragments in the datagram
will be discarded.
• Fragmentation could occur multiple times to an
IP datagram.
12
6. IP subnets
• IP subnets introduce additional levels within an
IP network:
– A network address, a subnet ID, and a host ID.
• IP subnets offer flexibility in allocating
addresses to different sizes of sub-networks.
• A subnet mask is used to indicate which bits are
referred to the network and subnet ID.
– Each network interface stores subnet mask and its
unicast IP address.
13
6. IP subnets
• Subnetting for a class B address:
Network number
Host number
Class B address
1111111111111111 11111111
00000000
Subnet mask (255.255.255.0)
Network number
Subnet ID
Host ID
Subnetted address
14
6. IP subnets
Subnet mask: 255.255.255.128
Subnet number: 128.96.34.0
128.96.34.15
128.96.34.1
H1
R1
Subnet mask: 255.255.255.128
Subnet number: 128.96.34.128
128.96.34.130
128.96.34.139
128.96.34.129
H2
R2
H3
128.96.33.1
128.96.33.14
Subnet mask: 255.255.255.0
Subnet number: 128.96.33.0
15
7. IP forwarding mechanisms
• Assume that both routers and hosts already
have appropriate routing tables in place.
– Routing tables for routers are constructed from
routing protocols.
– Routing tables for hosts are constructed from other
means.
• Problem: Given a routing table, how do hosts
and routers forward datagrams?
16
7.1 Examples of routing tables
• For example, R1’s routing table:
–
–
–
–
Network/Subnet
128.96.34.0
128.96.34.128
128.96.33.0
Subnet Mask
255.255.255.128
255.255.255.128
255.255.255.0
Next Hop
upper int.
lower int.
128.96.34.129
• For example, H1’s routing table:
– Network/Subnet
– 128.96.34.0
– 0.0.0.0
Subnet Mask
Next Hop
255.255.255.128 upper int.
0.0.0.0
128.96.34.1
17
7.2 Host’s forwarding mechanisms
• A host sends a datagram to another host on the
same LAN or not.
– In the former, it sends the datagram to the
destination directly.
– In the latter, it sends the datagram to a default
router.
– In both cases, the host uses ARP cache or ARP to
find out the corresponding MAC addresses.
18
7.3 A general forwarding mechanism
D = Destination IP address
for each entry (Network/Subnet ID, Subnet Mask, Next Hop)
D1 = Subnet mask & D
if D1 = Network/Subnet ID
if Next Hop is an interface
deliver datagram directly to destination
else
deliver datagram to Next Hop (a router)
19
7.4 Characteristics of IP forwarding
• Both hosts and routers are involved in
forwarding.
– Compared with routers, a host makes a much
simpler binary decision.
• IP forwarding is done on a hop-by-hop basis.
• It is assumed that the next-hop router is really
closer to the destination.
• IP forwarding is able to specify a route to a
network, and not have to specify a route to
every host.
20
8. IP tunnels
• Two network nodes (hosts or routers) may
“tunnel” IP datagrams between them.
– Other nodes on the path are not aware of the other
datagram encapsulated by the outer datagram.
– A tunnel configured from R1 to R2, which is
assigned with a virtual number of 0:
•
•
•
•
Network
1
2
Default
Next Hop
Interface 0
Virtual interface 0
Interface 1
21
8. IP tunnels
• Network interfaces configured as tunnel
endpoints perform IP-in-IP encapsulation.
– When sending datagrams to each other, the sender
uses its IP address as the source address and the
other’s IP address as the destination address.
– Each performs IP-in-IP encapsulation/decapsulation
and then IP routing.
– A datagram may traverse several IP tunnels before
arriving at the destination.
22
8.1 An example of IP tunnels
Network 1
R1
Internetwork
R2
Network 2
10.0.0.1
IP header,
Destination = 2.x
IP header,
Destination = 10.0.0.1
IP header,
Destination = 2.x
IP payload
IP header,
Destination = 2.x
IP payload
IP payload
23
8.2 Uses of IP tunnels
• Mobile IP: IP tunnel between a foreign agent
(or a mobile host) and a home agent.
• Mbone (Multicast backbone): IP tunnels
connect islands of multicast-enabled IP
networks.
• IPv6: IP tunnels will be used for IPv4-IPv6
transition.
• IPSec: IP tunnels with security is used in
establishing Virtual Private Networks (VPNs).
24
8.3 Virtual private networks
C
Physical links
A
B
Corporation X private network
K
L
M
Corporation Y private network
(a)
K
C
L
Physical links
A
M
B
Virtual circuits
(b)
25
9. Dynamic host configuration protocol
• DHCP provides a framework for passing
configuration information to hosts.
– IP addresses, address of a default router, etc.
• DHCP is a client-server system, including a
relay agent.
• DHCP operation:
– A DHCP client initially broadcasts a DISCOVER
message to find a DHCP server.
• If the server is not directly connected to the client, a relay
agent on the LAN will forward this message to the server.
26
9. Dynamic host configuration protocol
– The server sends an OFFER message back to the
relay agent, which then forwards it in either unicast
or broadcast back to the client.
– Upon accepting an OFFER from a DHCP server,
the client sends a REQUEST message to that server.
– The final step is for the server to send a REQUEST
ACK back to the client.
• DHCP provides IP addresses to clients for a
finite lease duration.
– The client either renews the lease or rebinds to
another new address.
27
9. Dynamic host configuration protocol
Unicast to server
DHCP
relay
Other networks
DHCP
server
Broadcast
Host
28
10. Internet control message protocol
• The main functions associated with the ICMP
are error reporting, reachability test, and routechange notification.
• ICMP reports errors to the source for host
unreachable, lost of fragments, etc.
• Ping program uses ICMP echo request and
reply to test a host’s aliveness.
• ICMP sends a re-direct message for a better
route back to the source.
29
10. Internet control message protocol
Host
(1) IP datagram
(2) IP datagram
R1
R2
(3) ICMP redirect
to the destination
30